All Products
Search
Document Center

Have fun with short videos

Last Updated: Aug 13, 2019

Preface

After years of industry development, short videos have become a new popular medium for content dissemination in addition to text and images. Leading products of the short video industry have attracted and nurtured a large number of users. With the development of 4G networks, users’ demand for short videos is growing stronger. Short videos apply to various scenarios such as entertainment, social contact, e-commerce, and early childhood education. This topic describes the products required for a short video application to help you quickly build a short video application.

Client SDK

This section is intended for client developers.

The client SDK provides you with the capabilities to collect, edit, upload, and play videos.

Server configuration and development

This section is intended for server developers.

Before publishing produced videos online for users to watch and interact with, you need to configure and develop the following services:

  • ApsaraVideo for VOD

ApsaraVideo for VOD is an all-in-one audio/video-on-demand solution. It integrates video collection, editing, and upload, media resource management, automatic transcoding (Narrowband HD™), video content moderation and analysis, and CDN for accelerated content delivery.

  • AppServer

To build a short video application, you need to develop an AppServer that can provide the application with the following capabilities: registration, logon, storage of user relationship data as well as user and video relationship data, video lists, video upload signatures, and reception of ApsaraVideo for VOD callback notifications. You can develop an AppServer on an ECS instance.

When developing an AppServer, you need to authorize permissions to your Alibaba Cloud account. Each time you request to use ApsaraVideo for VOD APIs or the client SDK, Alibaba Cloud verifies the user identity based on your requested operation to check whether your account has the necessary permissions. An AccessKey is required for user authentication.

ApsaraVideo for VOD

  1. Activate ApsaraVideo for VOD.

  2. Learn about the product information on the product page of ApsaraVideo for VOD on the Alibaba Cloud official website.

  3. Click Buy Now. On the subscription page that appears, select a billing method and confirm the order.Activate ApsaraVideo for VOD

  4. After the service is activated, go to the Overview page of the ApsaraVideo for VOD console and start using the service.Overview

  5. Add a domain name.

  6. In the ApsaraVideo for VOD console, click Domain Names in the left-side navigation pane. On the Domain Names page that appears, add a domain name for video delivery and acceleration.

    Note: Ensure that the domain name is filed and you have the permission to use it.

    Add a domain name

  7. After the domain name is added, Alibaba Cloud CDN assigns you a CNAME address. Obtain the CNAME address and add the CNAME record.

    Note:

AppServer

  • Configure the AccessKey of a RAM user

    To use ApsaraVideo for VOD APIs, you need to use an AccessKey for access to ApsaraVideo for VOD. If you directly use an Alibaba Cloud account AccessKey, it may pose high security risks. In this case, you can use the AccessKey of a RAM user to effectively avoid security risks caused by a leakage of the Alibaba Cloud account AccessKey or password.

    When configuring permissions, select the AliyunVODFullAccess and AliyunSTSAssumeRoleAccess policies. The AliyunVODFullAccess policy provides you with access to ApsaraVideo for VOD APIs, and the AliyunSTSAssumeRoleAccess policy allows you to use STS to obtain a temporary AccessKey, as shown in the following figure.

    Configure RAM user permissions

  • Configure an STS temporary AccessKey

    When a client submits a request to upload produced videos to the cloud, ApsaraVideo needs to deliver authentication information to the client. The previously mentioned RAM user AccessKey is permanently valid, but is not suitable to be delivered to and stored on the client. Therefore, ApsaraVideo needs to generate a temporarily valid AccessKey that can be used by the client. The procedure is as follows:

  1. Create a role.

In the RAM console, choose RAM Roles > Create RAM Role. In the Create RAM Role dialog box that appears, follow instructions to create a RAM role.

Create a role

  1. Configure role permissions.

Configure role permissions

Note: Select the AliyunVODFullAccess policy as shown in the preceding figure.

  1. Use STS to obtain a temporary AccessKey.

    Write the following code on the AppServer:

    1. static AssumeRoleResponse assumeRole(String accessKeyId, String accessKeySecret,
    2. String roleArn, String roleSessionName, String policy,
    3. ProtocolType protocolType) throws ClientException {
    4. try {
    5. // Creates an Alibaba Cloud AcsClient for initiating API requests.
    6. IClientProfile profile = DefaultProfile.getProfile(REGION_CN_HANGZHOU, accessKeyId, accessKeySecret);
    7. DefaultAcsClient client = new DefaultAcsClient(profile);
    8. // Creates an AssumeRoleRequest and sets request parameters.
    9. final AssumeRoleRequest request = new AssumeRoleRequest();
    10. request.setVersion(STS_API_VERSION);
    11. request.setMethod(MethodType.POST);
    12. request.setProtocol(protocolType);
    13. request.setRoleArn(roleArn);
    14. request.setRoleSessionName(roleSessionName);
    15. request.setPolicy(policy);
    16. // Initiates the request and obtains a response.
    17. final AssumeRoleResponse response = client.getAcsResponse(request);
    18. return response;
    19. } catch (ClientException e) {
    20. throw e;
    21. }
    22. }
    • accessKeyId and accessKeySecret: the AccessKey information obtained from the RAM console for the RAM user who plays the RAM role.
    • roleArn: the ARN value on the details page of the RAM role, as shown in the following figure.roleArn
    • roleSessionName: the custom session name used to identify a user in subsequent audits.
    • policy: the finer-grained permission control over each granted permission.
    1. String policy = "{\n" +
    2. " \"Version\": \"1\",\n" +
    3. " \"Statement\": [\n" +
    4. " {\n" +
    5. " \"Action\": \"vod:*\",\n" +
    6. " \"Resource\": \"*\",\n" +
    7. " \"Effect\": \"Allow\"\n" +
    8. " }\n" +
    9. " ]\n" +
    10. "}";
  2. Deliver the obtained data to the client, which can use the STS temporary AccessKey to call upload APIs and upload videos.

Partners

  1. Facial Augmented Reality (AR) solution: FaceUnity provides face filters for short video scenarios, such as a basic face filter that supports skin smoothing, skin whitening, and skin shining, and an advanced face filter that supports eye widening and face thinning. Currently, FaceUnity provides the advanced face filter in the official demo and charges a third-party fee. You can communicate with this partner in Alibaba Cloud Marketplace. For more information, see the facial AR solution.

  2. Online music solution: Taihe Music Group provides DMH Music to offer online music resources in short video scenarios. DMH Music covers different kinds of genres and provides tens of thousands of high-quality songs whose copyright can be authorized. It allows you to access music resources by using SDKs or APIs. DMH Music charges a third-party fee for online music based on the number of calls. You can directly communicate with this partner. For more information, see the online music solution.

  3. Short video effect production solution: Xi’an Zhong Jing Film and TV Media Co., Ltd. owns numerous creative and themed short video (music video) templates. It is superior in video post-production and the creation of short video effect materials. Zhong Jing charges a third-party fee for effect production. You can directly communicate with this partner. For more information, see the short video effect production solution.

Appendix