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
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:
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 reviewis enabled, the process changes accordingly.
- A user obtains the upload authorization.
- ApsaraVideo for VoD delivers the upload URL, upload credential, and
- The user uploads a video and saves the video ID.
- The server requests a playback credential.
- ApsaraVideo for VOD issues a playback credential with a validity period.
- The server issues the playback credential to players, which can then play the video.
Configure a CDN domain name. Ensure that your domain name to be used in ApsaraVideo for VOD has been registered.
Confirm the transcoding configuration. ApsaraVideo for VOD can
transcodeuploaded files or
does not transcodethem. For more information, see Transcoding template.
Confirm the security configuration. ApsaraVideo for VOD protects your video content with a variety of measures, including
video encryption, and
secure download. The security configuration determines whether a video can be played. For more information, see Video security.
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.
Only videos whose Status is
Normalcan be played. That is, you can obtain the playback URLs of these videos by using the API or SDK.
Videos whose status is
Blockedcan 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.
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.
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.
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.
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.
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 Periodparameter 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 Periodparameter.
The following URL is a dynamic URL example:
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.
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 Writefor 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 Writefor 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.
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.
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.