ApsaraVideo VOD supports audio and video playback. You can preview audio and video files in the ApsaraVideo VOD console and play the files by using ApsaraVideo Player SDK or third-party players. This topic describes the process, preparations, prerequisites, methods, playback URLs, and security of audio and video playback.
Introduction
ApsaraVideo VOD allows you to play the following types of audio and video files:
Transcoded stream files: If you specify a transcoding template when you upload audio and video files, transcoded stream files are generated.
Original files: If you use the No Transcoding template when you upload audio and video files, the files are played in the original quality. You can play only audio and video files in the MP4, FLV, M3U8, MP3, and WEBM formats in the original quality without transcoding.
You can use one of the following methods to play audio and video files:
Log on to the ApsaraVideo VOD console and preview the files. For more information, see Manage media assets.
Integrate ApsaraVideo Player SDK. For more information, see Overview.
Integrate third-party players.
You can use one of the following methods to obtain playback URLs:
View the event notification after transcoding is complete or call the GetPlayInfo operation.
Integrate ApsaraVideo Player SDK and call the GetVideoPlayAuth operation to obtain playback credentials. ApsaraVideo Player SDK can automatically obtain playback URLs based on playback credentials.
Preparations
Configure a domain name to accelerate. Make sure that the ICP filing for the domain name that you want to use in ApsaraVideo VOD is complete. For more information, see Domain name requirements.
Bind a CNAME record to the domain name. If you do not bind a CNAME record to the domain name, video playback fails. For more information, see Add a CNAME record in Alibaba Cloud DNS. You can also use DNSPod to bind a CNAME record to the domain name. For more information, see Configure a CNAME record on DNSPod.
Configure the transcoding settings. You can specify whether to transcode media files that are uploaded to ApsaraVideo VOD. For more information, see Audio and video transcoding.
Specify the security policies. ApsaraVideo VOD provides multiple security policies including access control, URL signing, remote authentication, video encryption, and secure download to protect your video content. The security policies determine whether videos can be played. For more information, see Overview.
Prerequisites
Video status
When an audio or video file is being produced, processed, or distributed, the status of the audio or video file changes. The status of the video is a key condition that determines whether the video can be played. For more information about the video status, see the "Status: the status of a video" section of the Basic data types topic.
Videos that can be played
Only videos whose
Status
is Normal can be played. You can obtain the playback URLs of these videos by using the ApsaraVideo VOD API or SDK.Videos whose
Status
is Checking or Blocked can be played only by using the ApsaraVideo VOD console or IP addresses that are added to review security groups. You can add IP addresses to review security groups by using ApsaraVideo VOD API or SDK. For more information, see Security IP address preview.
When videos are ready for playback
After a video is uploaded, the video is ready for playback only after ApsaraVideo VOD receives the video. You can determine when the video is ready for playback based on event notifications.
Audio or video files that are not transcoded are ready for playback after you receive the FileUploadComplete event notification. After you receive the FileUploadComplete event notification, you can call the GetPlayInfo operation to obtain the playback URLs. You can play only audio and video files in the MP4, FLV, M3U8, MP3, and WEBM formats without transcoding.
Audio or video files that are transcoded are ready for playback after you receive the StreamTranscodeComplete event notification. To ensure that videos in all definitions are obtained, play videos after you receive the TranscodeComplete event notification.
Playback methods
Preview videos in the ApsaraVideo VOD console
Log on to the ApsaraVideo VOD console. In the left-side navigation pane, click Audio/Video. On the Video and Audio page that appears, preview the video. Encrypted streams are preferentially played.
On the Video and Audio page, find the video that you want to preview and click Manage in the Actions column. On the Video URL tab, select the stream that you want to preview. To ensure video security, you can preview only unencrypted streams on the Video URL tab.
Integrate ApsaraVideo Player SDK
You can obtain playback credentials from ApsaraVideo VOD and issue them to clients. This method provides higher security. For more information, see Use playback credentials to play videos.
ApsaraVideo Player supports URL-based playback. You can pass playback URLs to ApsaraVideo Player for playback. For more information, see Obtain playback URLs to play videos.
Integrate third-party players
You can integrate a third-party player to obtain playback URLs for playback. For more information, see Obtain playback URLs to play videos.
You can pass playback URLs to a third-party player for playback. In this case, you must perform development operations such as converting video definition and handling exceptions.
Playback URLs
An accelerated domain name is configured
If you configure an accelerated domain name in the ApsaraVideo VOD console, the playback URLs of videos are Alibaba Cloud CDN URLs. To view playback URLs, perform the following steps: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, click Audio/Video. On the Video and Audio page, find the video for which you want to view the playback URL and click Manage in the Actions column. On the Video URL tab, view the playback URL of the video. Playback URLs are classified into fixed URLs and dynamic URLs based on whether URL signing is enabled. For more information about how to enable and configure URL signing, see Configure URL authentication.
Fixed URLs
Fixed URLs 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 that have low security requirements. By default, URL signing is disabled after you add a domain name to ApsaraVideo VOD.Dynamic URLs
Dynamic URLs are dynamically generated and expire after a specific period of time. They are suitable for scenarios that have high security requirements. The
Default Validity Period
parameter that you specified when you enable URL signing specifies the default validity period of the dynamic URL. You can specify the validity period when you generate the playback URL or when you call the GetPlayInfo operation. For more information, see Configure URL authentication and GetPlayInfo. If you access an expired playback URL, anHTTP 403
status code is returned.Sample code:
http://example.aliyundoc.com/video/aliyun-sample.mp4?auth_key=1500523200-0-0-80cd3862d699b7118eed99103f2a****
NoteIn this example, the number before the first hyphen (-) in the value of the auth_key parameter is 1500523200. This indicates the time 12:00:00 on July 20, 2017. If the Default Validity Period parameter is set to 60 minutes, this URL expires at 13:00:00 on July 20, 2017.
No accelerated domain name is configured
If you do not configure an accelerated domain name, the playback URLs of videos are Object Storage Service (OSS) URLs and URL signing is not supported. In this case, OSS authentication information is automatically generated. For more information, see Add signatures to URLs in the OSS documentation. You can still use the
AuthTimeout
parameter to specify the validity periods of OSS URLs when you call the GetPlayInfo operation. However, you cannot create custom authentication rules based on the AccessKey pair.If you set Read-write permission for a
bucket
to Public Read and Private Write on the Storage page in the ApsaraVideo VOD console, ignore the OSS authentication information. In this case, playback URLs are permanently valid. However, the URLs are exposed to hotlinking and illegal downloads. We recommend that you set Read-write permission to Private Read and Write for thebucket
. For more information, see Manage VOD storage.
For more information about common playback URL settings, see Common playback settings.
Playback security (limits on playback and download)
Video security
ApsaraVideo VOD provides multiple security policies including access control, URL signing, video encryption (Alibaba Cloud proprietary cryptography and HLS encryption) to protect your video content. For more information, see Access limits, Configure URL authentication, and Overview.
Account security
To ensure the security of your account, do not use the AccessKey pair of your Alibaba Cloud account or of a RAM user on the clients, especially web clients to access ApsaraVideo VOD. For more information, see Overview.
Playback errors
If playback errors occur, you can use the check tool for playback URLs to troubleshoot the errors. The tool allows you to diagnose common playback errors and provides suggestions to troubleshoot specific errors. For more information, see Troubleshoot playback errors.
You can also view common issues and solutions to these issues described in FAQ about ApsaraVideo Player for multiple platforms.