ApsaraVideo VOD provides playback URLs for different scenarios. You can control the type of playback URL by adjusting domain name configuration, transcoding settings, and playback settings.
Domain name configuration
-
Add a domain name
-
Configure an accelerated domain name: Ensure that your ApsaraVideo VOD domain name has an ICP filing. For more information, see Domain name admission standards.
-
CNAME resolution: Create a CNAME record for your domain name. Otherwise, playback will fail. For instructions, see Configure a CNAME record by using Alibaba Cloud DNS. You can also use services like DNSPod.
-
Configure a CDN accelerated domain name: For details, see Add an accelerated domain name.
-
-
URL authentication configuration
-
Expiration time: Use the
AuthTimeoutparameter to set the expiration time for a CDN accelerated URL. For details on how the URL expiration is calculated, see the "URL expiration time" section in URL authentication. -
Secondary authentication:
-
With CDN secondary authentication configured, set the
ReAuthInfoparameter to add theuidandrandparameters to the CDN authentication request. For more information, see Configure CDN secondary authentication by using ReAuthInfo. -
Without CDN secondary authentication, use the
randparameter inReAuthInfoto generate a unique URL each time. For example, use a universally unique identifier (UUID) as the random number. For more information, see Configure CDN secondary authentication by using ReAuthInfo.
-
-
-
Multi-domain name selection
If your origin server is configured with multiple domain names, you can set the
PlayDomainfield of thePlayConfigparameter to return a playback URL for a specific CDN domain name. For more information, see Customize media playback by using PlayConfig.To distribute different videos through different accelerated domain names, use one of the following methods:
-
Method 1: When you call the GetPlayInfo operation, specify a different accelerated domain name for each video using the
PlayDomainfield of thePlayConfigparameter. For example, setPlayConfig={"PlayDomain":"cdn-a.example.com"}for Video A andPlayConfig={"PlayDomain":"cdn-b.example.com"}for Video B. The operation returns playback URLs with the corresponding domain names. -
Method 2: After you obtain the playback URL, replace the domain name in the URL with the target accelerated domain name in your code. For example, replace
cdn-default.example.comin the returned URL withcdn-b.example.com.
Before you use either method, add multiple accelerated domain names and complete the CNAME configuration in Distribution and Acceleration > Domain Name Management.
-
-
HTTPS acceleration
By default, the playback API returns HTTP image and playback URLs. To obtain HTTPS URLs, enable HTTPS acceleration for your CDN domain names. For details, see HTTPS acceleration.
Transcoding settings
ApsaraVideo VOD lets you choose whether to transcode the media files you upload.
-
If you transcode your files, the playback service returns playback URLs for the transcoded files. The format, definition, encryption status, and watermark ID depend on your transcoding settings.
-
If you do not transcode your files, the playback service returns a playback URL for the uploaded source file. Only MP4, FLV, M3U8, MP3, and WEBM files can be played directly without transcoding.
For more information, see Transcoding templates.
Playback settings
The playback service supports three playback methods:
-
Console preview: No configuration is required.
-
Playback URL: Call the GetPlayInfo operation and use playback settings to filter the returned playback URLs.
-
Player: Configure playback settings in the ApsaraVideo Player SDK. The player automatically filters and selects a playback URL.
Playback API settings
The ApsaraVideo VOD GetPlayInfo operation lets you filter results by the following criteria for different playback scenarios.
-
Definition
The
Definitionparameter allows you to select multiple definitions for adaptive switching based on network conditions. If you do not set this parameter, the playback API returns playback URLs for all available definitions of the specified video. -
Output file format
The
Formatsparameter specifies the container format of the transcoded file. OnlyMP4,MP3, andM3U8are supported. You can specify multiple values. -
Output stream type
The
StreamTypeparameter specifies whether the stream is video or audio. -
Output file type
The
OutputTypeparameter:-
If you do not configure a CDN accelerated domain name, the playback API returns an OSS origin URL by default.
-
After you configure a CDN accelerated domain name, the playback API returns a CDN accelerated URL by default.
-
You can also set the
OutputTypeparameter to obtain either an OSS origin URL or a CDN accelerated URL.
-
-
Output result type
The
ResultTypeparameter: By default, ApsaraVideo VOD provides only one playback URL for each combination of definition and format. If you submit a new transcoding job for an already-transcoded video, multiple playback URLs are created for each definition-format combination. The playback API returns only the most recent stream URL by default. To retrieve all URLs for all transcoded streams, setResultTypetoMultiple.ImportantIf a video has more than 100 output stream URLs, setting
ResultTypetoMultiplereturns a maximum of 100 output stream URLs.
Player settings
ApsaraVideo Player SDK uses a playback credential to automatically obtain a playback URL. The SDK is available for Web (H5 and Flash), iOS, and Android.
-
ApsaraVideo Player SDK for Web
-
The H5 player supports setting the output stream type (
mediaType), output file format (format), and definition (definition). For more information, see Features. -
The Flash player supports playback of video files only. You can set the output stream type (
mediaType) and output file format (format).
-
-
ApsaraVideo Player SDK for iOS
You can set the output file format (
format) and the preferred definition (quality). -
ApsaraVideo Player SDK for Android
You can set the output file format (
format) and the preferred definition (quality).