All Products
Search
Document Center

Overview

Last Updated: Sep 17, 2019

Overview

ApsaraVideo for VOD allows you to play audio and video files, including:

  • Transcoded stream files: When files are uploaded with transcoding enabled, transcoded stream files are generated after transcoding.

  • Mezzanine files: When files are uploaded with transcoding disabled, the uploaded mezzanine files can be directly played in original quality.

You can play audio and video files by using:

Overall process

The following figure shows the overall process for uploading, storing, processing, and playing audio and videos in ApsaraVideo for VOD.

This is a standard process where the audio and videos are transcoded and a playback credential is used for playback. If transcoding is disabled or media review is enabled, the process changes accordingly.

Upload and playback process

  1. A user obtains the upload authorization.
  2. ApsaraVideo for VoD delivers the upload URL, upload credential, and video ID.
  3. The user uploads a video and saves the video ID.
  4. The server requests a playback credential.
  5. ApsaraVideo for VOD issues a playback credential with a validity period.
  6. The server issues the playback credential to players, which can then play the video.

Preparations

  • Configure a CDN domain name. Ensure that your domain name to be used in ApsaraVideo for VOD has been registered.

  • Bind a CNAME record to the domain name. If this operation is not performed, video playback fails. For more information, see the configuration procedures for HiChina, Xinnet, and DNSPod domain names.

  • Confirm the transcoding configuration. ApsaraVideo for VOD can transcode uploaded files or does not transcode them. For more information, see Transcoding template.

  • Confirm the security configuration. ApsaraVideo for VOD protects your video content with a variety of measures, including access control, URL signing, CDN reauthentication, video encryption, and secure download. The security configuration determines whether a video can be played. For more information, see Video security.

Prerequisites

Video status

When audio or videos are produced, processed, or distributed, their status changes constantly. The video status is a key condition that determines whether videos can be played.For more information about the video status, see Status. The following figures show how the video status changes in detail.

  • With transcodingwith transcoding

  • Without transcodingwithout transcoding

Playback conditions

  • Only videos whose Status is Normal can be played. That is, you can obtain the playback URLs of these videos by using the API or SDK.

  • Videos whose status is Checking or Blocked can only be played in the ApsaraVideo for VOD console or from IP addresses that have been added to review security groups. You can add IP addresses to review security groups by using the API or SDK.

Check whether videos can be played

When a video is uploaded, it is not immediately ready for playback. ApsaraVideo for VOD needs to confirm that the video has been received completely. You can determine whether videos are ready for playback based on event notifications.

  • For a video (or audio) that does not need to be transcoded, you can play it when a FileUploadComplete event notification is received. You can call the GetPlayInfo operation to obtain the playback URL.

  • For a video that needs to be transcoded, you can play it when a StreamTranscodeComplete event notification is received. To ensure that streams in all definitions can be obtained, wait until a TranscodeComplete event notification is received.

Playback methods

Use the ApsaraVideo for VOD console to preview videos

  • On the Media Files > Video and Audio page of the ApsaraVideo for VOD console, you can preview a video. An encrypted stream of the video is played preferentially.

  • On the Media Files > Video and Audio > Manage > Video URL page of the ApsaraVideo for VOD console, you can select a stream to preview it. To ensure video security, ApsaraVideo for VOD allows you to select only unencrypted streams to preview.

Use ApsaraVideo Player SDKs

  • You can obtain and transmit the playback credential of a video from the ApsaraVideo for VOD server to your player. This method provides higher security. For more information, see Use playback credentials.

  • Currently, ApsaraVideo Player can directly play a video from a playback URL. Therefore, you can directly transmit the obtained playback URL to ApsaraVideo Player for playback. For more information, see Use playback URLs.

Use third-party players

You can obtain and transmit the playback URL of a video to your player. This method is convenient, but requires you to convert the definition, handle exceptions, and perform other development work. For more information, see Use playback URLs.

Playback URL

When a CDN domain name is configured

After a CDN domain name is configured in the ApsaraVideo for VOD console, playback URLs are CDN URLs. You can view playback URLs on the Media Files > Video and Audio > Manage > Video URL page of the ApsaraVideo for VOD console. Playback URLs are classified into fixed URLs and dynamic URLs, depending on whether URL signing is enabled. For more information about how to enable and configure URL signing, see URL signing.

  • Fixed URLs are URLs that do not contain authentication information (auth_key). They are generated when URL signing is disabled. Fixed URLs are permanently valid and are suitable for scenarios with low security requirements. Currently, URL signing is disabled by default for a domain name when it is configured in the ApsaraVideo for VOD console.

  • Dynamic URLs are dynamically generated and expire after a certain period of time. They are suitable for scenarios with high security requirements. The default validity period of a dynamic URL is determined by the Default Validity Period parameter that you set when enabling URL signing. You can set the validity period when generating playback URLs or obtaining playback URLs. When you access an expired playback URL, CDN returns an HTTP 403 error.

A playback URL that contains the auth_key parameter is a dynamic URL. In the parameter value, the numeral before the first hyphen (-) is a timestamp. The expiration time of the playback URL is the time expressed by the timestamp plus the value of the Default Validity Period parameter.

The following URL is a dynamic URL example:

  1. http://vod.example.com/video/aliyun-sample.mp4?auth_key=1500523200-0-0-80cd3862d699b7118eed99103f2a3a4f

In this example, the numeral before the first hyphen (-) in the auth_key parameter value is 1500523200, representing the date and time 2017-07-20 12:00:00. If the Default Validity Period parameter is set to 60 minutes, this URL expires at 13:00:00 on July 20, 2017.

When no CDN domain name is configured

  • If no CDN domain name is configured, playback URLs are OSS URLs. In this case, URL signing cannot be used, but OSS authentication information is generated by default. For more information, see Add a signature to a URL in the OSS documentation.You can still use the AuthTimeout parameter to specify the expiration time of OSS URLs when calling the GetPlayInfo operation. However, you cannot customize authentication information based on the AccessKey.

  • If you set the permissions to Public Read and Private Write for the bucket allocated ApsaraVideo for VOD on the Storage page, OSS authentication information is ignored. In this case, playback URLs are permanently valid, causing the risks of hotlinking and illegal download. Therefore, we recommend that you set the permissions to Private Read and Write for the bucket allocated by ApsaraVideo for VOD.

We strongly recommend that you configure a CDN domain name instead of using OSS URLs. This allows your videos to be played more smoothly and reduces costs.

Playback security (playback and download restrictions)

Video security

ApsaraVideo for VOD protects your video content with a variety of measures, including access control, URL signing, and video encryption (Alibaba Cloud video encryption and standard HLS encryption). For more information, see Video security.

Account security

To ensure the security of your account, do not use the AccessKey of the Alibaba Cloud account or a RAM user on the clients (especially web players). For more information, see Account permissions.