All Products
Search
Document Center

ApsaraVideo VOD:Use playback URLs to play videos

Last Updated:Mar 18, 2024

After you obtain the playback URL of an audio or video file stored in ApsaraVideo VOD, you can use the playback URL to play the file by using ApsaraVideo Player or third-party players including the system player, open source player, and self-developed player. This topic describes how to obtain playback URLs and play audio and video files stored in ApsaraVideo VOD.

Playback process

Important

The server must have the AccessKey pair of a RAM user and must be granted the playback permissions. For more information, see Overview.

For more information about how to use ApsaraVideo Player SDK, see Use ApsaraVideo Player SDK to play videos.

Obtain a playback URL

You can obtain playback URLs from event notifications or by using the API or SDK.

Event notifications

You can obtain the playback URL from the StreamTranscodeComplete or TranscodeComplete callback. Save the playback URL on your server and access your server to play the file.

Usage notes:

  • The playback URLs obtained from callbacks are fixed URLs. If URL signing is enabled, you must generate a signed URL for playback. In this case, you can play the file only by using the signed URL. For more information, see Configure URL signing.

  • If the old domain name is disabled or deleted, replace the domain name in the playback URL with the new domain name. Otherwise, video playback fails.

  • If video encryption is configured, the returned playback URL must be decrypted before the video can be played.

API/SDK

You can directly call the GetPlayInfo operation or call the operation by using the ApsaraVideo VOD SDK. When you call this operation, specify the video ID that you obtained during the upload to obtain the playback URL.

Call methods:

  • We recommend that you call API operations by using ApsaraVideo VOD SDKs. This helps you obtain media asset information in an efficient manner. For more information about ApsaraVideo VOD SDKs, see Overview. For more information about API operations, see the API documentation.

  • You can also create an HTTP or HTTPS request by following the instructions as described in Request syntax and signature method V2 for RPC APIs.

Limits:

  • By default, the GetPlayInfo operation returns only the latest transcoded stream in each definition and format to ensure that the latest transcoded stream is played each time. When you call the GetPlayInfo operation, you can set ResultType to Multiple to obtain the playback URLs of all transcoded streams of the file.

  • If you specify Alibaba Cloud proprietary cryptography, you can play the file only by using ApsaraVideo Player. By default, the system does not return the playback URL of a stream that is encrypted by using Alibaba Cloud proprietary cryptography when you call the GetPlayInfo operation. This ensures video security. You can set ResultType to Multiple to obtain the playback URLs of all the transcoded streams.

  • If you specify HLS encryption, the system preferentially returns the playback URL of a stream that is encrypted by using HLS.

  • If you use tiered storage for media assets, the following rules apply when you call the GetPlayInfo operation to obtain the playback URLs of audio or video files. For more information about tiered storage, see Change the storage class of a media asset.

    • If the storage class of the audio or video file is Standard, the playback URL of the file is returned by default. If the storage class of the media resources is not Standard, no playback URL is returned. If the storage class of the source file is not Standard, only playback URLs of the transcoded streams are returned, the playback URL of the original-quality stream is not returned.

    • You can configure the StorageClass and PlayConfig parameters to obtain playback URLs of audio and video streams of a specified storage class other than Standard.

Play the file

Note

We recommend that you use playback URLs for high-concurrent playback. You can save the playback URLs to your business server and issue them to players to prefetch videos in advance. This allows you to play millions of concurrent videos. For more information, see Refresh and prefetch.

You can obtain the playback URL and pass it to a third-party player for playback.

  • You can use ApsaraVideo Player to directly play the file based on the URL. For more information, see Use ApsaraVideo Player SDK to play videos.

  • You can also use third-party players including the system player, open source player, and self-developed player to play the file.