Queries the playback URL of a video or audio file by its ID.
Operation description
- Make sure that you understand the billing method and price of ApsaraVideo VOD before you call this operation. You are charged for outbound traffic when you download or play videos based on URLs in ApsaraVideo VOD. For more information about billing of outbound traffic, see Billing of outbound traffic. If you have configured an accelerated domain name, see Billing of the acceleration service. If you have activated the acceleration service, you are charged acceleration fees when you upload media files to ApsaraVideo VOD. For more information, see Billing of acceleration traffic.
- You can use the ID of a media file to query the playback URL of the file. After you integrate ApsaraVideo Player SDK for URL-based playback or a third-party player, you can use the obtained playback URLs to play audio and video files.
- Only videos whose Status is Normal can be played. The Status parameter in the response indicates the status of the video. For more information, see Overview .
- If video playback fails, you can call the GetMezzanineInfo operation to check whether the video source information is correct.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vod:GetPlayInfo | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
VideoId | string | Yes | The ID of the media file. You can specify only one ID. You can use one of the following methods to obtain the media ID:
| 93ab850b4f654b6e91d24d81d44**** |
Formats | string | No | The format of the media stream. Separate multiple formats with commas (,). Valid values:
Note
By default, ApsaraVideo VOD returns video streams in all the preceding formats. However, video streams in the MPD format are returned only if the MPD container format is specified in the transcoding template. For more information, see the Container parameter in the TranscodeTemplate table.
| mp4,m3u8 |
AuthTimeout | long | No | The validity period of the playback URL. Unit: seconds.
| 1800 |
OutputType | string | No | The type of the output URL. Default value: oss. Valid values:
| cdn |
StreamType | string | No | The type of the media stream. Separate multiple types with commas (,). Valid values:
By default, video and audio streams are returned. | video |
ReAuthInfo | string | No | The CDN reauthentication configuration. The value is a JSON string. If CDN reauthentication is enabled, you can use this parameter to specify the UID and rand fields for URL authentication. For more information, see URL authentication. | {"uid":"12345","rand":"abckljd"} |
Definition | string | No | The quality of the video stream. Separate multiple qualities with commas (,). Valid values:
Note
By default, ApsaraVideo VOD returns video streams in all preceding qualities. However, video streams for adaptive bitrate streaming are returned only if the PackageSetting parameter is specified in the transcoding template. For more information, see the PackageSetting parameter in the TranscodeTemplate table.
| LD |
ResultType | string | No | The type of the data to return. Default value: Single. Valid values:
| Single |
PlayConfig | string | No | The custom playback configuration. The value is a JSON string. For more information, see PlayConfig . Note
PlayDomain in PlayConfig, the default domain name configured in ApsaraVideo VOD is used in this operation. If no default domain name is configured, the domain names are queried in reverse chronological order based on the time when the domain names were modified. The domain name that was last modified is used as the streaming domain name. To prevent domain name issues, we recommend that you specify the default streaming domain name. You can log on to the ApsaraVideo VOD console and choose Configuration Management > Media Management > Storage > Manage > Origin Domain Name to set the default streaming domain name.EncryptType parameter in PlayConfig is set to AliyunVoDEncryption , the playback URL of the stream encrypted by using proprietary cryptography is not returned to ensure video security. If you want to return such URL, you must set the ResultType parameter to Multiple . | {"PlayDomain":"vod.test_domain","XForwardedFor":"yqCD7Fp1uqChoVj/sl/p5Q==","PreviewTime":"20","MtsHlsUriToken":"yqCD7Fp1uqChoVjslp5Q"} |
AdditionType | string | No | The URL of the masked live comment data. Set the value to danmu. Note
This parameter takes effect only when the outputType parameter is set to cdn.
| danmu |
Trace | string | No | The custom digital watermark.
| test mark |
DigitalWatermarkType | string | No | The type of the digital watermark. Valid values:
| TraceMark |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "F552E596-967D-5500-842F-17E6364****",
"VideoBase": {
"CreationTime": "2017-06-26T06:38:48Z",
"Status": "Normal",
"VideoId": "93ab850b4f654b6e91d24d81d44****",
"CoverURL": "http://example.aliyundoc.com/sample.jpg?auth_key=2333232-atb****",
"Duration": "3.1667",
"Title": "ApsaraVideo VOD\n",
"MediaType": "video",
"DanMuURL": "http://example.aliyundoc.com/****?auth_key=abdf2123-6783232****",
"StorageClass": "Standard"
},
"PlayInfoList": {
"PlayInfo": [
{
"CreationTime": "2022-04-18T07:37:15Z",
"Status": "Normal",
"Specification": "H264.LD",
"NarrowBandType": "0",
"Height": 640,
"Bitrate": "450.878",
"ModificationTime": "2022-04-20T06:32:19Z",
"WatermarkId": "dgfn26457856****",
"Encrypt": 1,
"Definition": "LD",
"EncryptType": "AliyunVoDEncryption",
"StreamType": "video",
"JobId": "80e9c6580e754a798c3c19c59b16****",
"Size": 418112,
"Width": 360,
"Fps": "25",
"Duration": "9.0464",
"PlayURL": "https://example.aliyundoc.com/d52ee123f331466aabf6ab32a93d****/a777f9e24e6e47a2a942467d5c38ea37-8ee8e04293c6657fdda282bc422704****.m3u8",
"Format": "m3u8",
"HDRType": "HLG",
"BitDepth": 8,
"JobType": 2,
"JobExt": "CopyrightMarkTest"
}
]
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2023-10-18 | The request parameters of the API has changed | see changesets | ||||||
| ||||||||
2023-09-05 | The response structure of the API has changed | see changesets | ||||||
| ||||||||
2021-12-23 | The response structure of the API has changed | see changesets | ||||||
| ||||||||
2021-11-16 | The response structure of the API has changed | see changesets | ||||||
|