GetPlayInfo

Updated at:

Retrieves the playback URL of an audio or video file based on the media ID. You can then use ApsaraVideo Player or a third-party player, such as a native, open-source, or custom player, to play the media content.

Operation description

  • Before you invoke this operation, make sure that you fully understand the billing methods and pricing of ApsaraVideo VOD. Downloading or playing videos directly from the playback URL of ApsaraVideo VOD incurs outbound traffic fees. If no accelerated domain name is configured, refer to Billing of storage outbound traffic. If an accelerated domain name is configured, refer to Billing of acceleration services. If you have enabled storage transfer acceleration, downloading or playing videos directly from the playback URL of ApsaraVideo VOD also incurs download acceleration fees. For billing details, refer to Billing of storage transfer acceleration.

  • Only videos in the Normal status (the value of the Status field is Normal) can be played normally. For more information about the playback instructions and limits of playback URLs, refer to Media playback.

  • When the media asset storage type is non-standard storage, you must configure the StorageClass field in the PlayConfig parameter accordingly. For more information, refer to PlayConfig.

  • If video playback is abnormal, you can invoke the GetMezzanineInfo operation to check whether the information about the video source file is correct.

  • To invoke this operation to generate an m3u8 tracing watermark video stream, submit a ticket to apply for activation. For more information about how to submit a ticket, refer to Contact us. For more information about tracing watermarks, refer to Digital watermarking.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vod:GetPlayInfo

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

VideoId

string

No

The ID of the audio or video file. You can specify only one ID. You can obtain the ID by using one of the following methods:

  • For an audio or video file uploaded in the console, log on to the ApsaraVideo VOD console and choose Media Library > Audio/Video to view the ID.

  • When you upload an audio or video file by calling the CreateUploadVideo operation, the ID is the value of the VideoId response parameter.

  • After an audio or video file is uploaded, you can call the SearchMedia operation to query the ID, which is the value of the VideoId response parameter.

93ab850b4f654b6e91d24d81d44****

Formats

string

No

The format of the media stream. Separate multiple formats with commas (,). Valid values:

  • mp4

  • m3u8

  • mp3

  • flv

  • mpd

Note
  • By default, streams of all formats are retrieved.

  • The mpd format is output only when the dash container format is configured in the transcoding template. For more information, refer to Container: container format.

mp4,m3u8

AuthTimeout

integer

No

The validity period of the playback URL. Unit: seconds.

  • When OutputType is set to cdn:

    • The playback URL expires periodically only if URL authentication is enabled. Otherwise, the URL is permanently valid. For more information about how to enable and configure URL authentication, refer to URL authentication.

    • Minimum value: 1.

    • Maximum value: unlimited.

    • Default value: If this parameter is not specified, the default validity period configured for URL authentication is used.

  • When OutputType is set to oss:

    • The playback URL expires periodically only if the storage permission is set to private. Otherwise, the URL is permanently valid.

    • Minimum value: 1.

    • Maximum value: To reduce security risks of the origin server, the maximum value is 604800 (7 days) when the audio or video file is stored in an ApsaraVideo VOD bucket, and 129600 (36 hours) when the file is stored in a user-owned OSS bucket. If the maximum value does not meet your requirements, you can set OutputType to cdn and configure URL authentication to set a longer validity period.

    • Default value: If this parameter is not specified, the value is 3600.

1800

OutputType

string

No

The type of the output URL. Valid values:

  • oss: the back-to-origin URL.

  • cdn (default): the accelerated URL.

cdn

StreamType

string

No

The type of the media stream. Separate multiple types with commas (,). Valid values:

  • video: video.

  • audio: audio.

By default, streams of all types are retrieved.

video

ReAuthInfo

string

No

The CDN reauthentication parameter, which is a JSON string. When type A signing of URL authentication is enabled, you can use this parameter to set the uid and rand values of the authenticated URL. For more information, refer to Type A signing.

{"uid":"12345","rand":"abckljd"}

Definition

string

No

The definition of the video stream. Separate multiple definitions with commas (,). Valid values:

  • FD: fluent.

  • LD: standard definition.

  • SD: high definition.

  • HD: ultra-high definition.

  • OD: original definition.

  • 2K: 2K.

  • 4K: 4K.

  • SQ: standard sound quality.

  • HQ: high sound quality.

  • AUTO: adaptive bitrate.

Note
  • By default, streams of all definitions are retrieved.

  • When a tracing watermark is generated, this parameter is required and must be consistent with the definition configured for tracing watermark transcoding.

  • The AUTO format is output only when transcoding packaging is configured in the transcoding template. For more information, refer to PackageSetting: transcoding packaging settings.

LD

ResultType

string

No

The type of the returned data. Valid values:

  • Single (default): returns only the latest transcoded stream for each definition and format.

  • Multiple: returns all transcoded streams for each definition and format.

Single

PlayConfig

string

No

The custom playback settings. The value is a JSON string. You can specify the domain name for playback. For more information about how to construct the parameter, refer to PlayConfig.

Note
  • If PlayConfig is not specified or the PlayDomain field in PlayConfig is not specified, the operation uses the default domain name configured in ApsaraVideo VOD by default. If no default domain name is configured, the operation queries domain names in descending order of modification time and uses the most recently modified domain name as the playback domain name. To prevent an unexpected domain name from being returned, we recommend that you configure a default playback domain name. You can log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management Configuration > Storage Management > Manage > Domain Names that Route Back-to-origin Traffic to This Storage Address to configure the default playback domain name.

  • When the EncryptType parameter in PlayConfig is set to AliyunVoDEncryption, the playback URL of the private encrypted stream is not returned by default to ensure video security. To return the playback URL of the private encrypted stream, you must also 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 live comment mask data. Valid value: danmu.

Note

This parameter takes effect only when OutputType is set to cdn.

danmu

Trace

string

No

The custom digital watermarking information.

  • When DigitalWatermarkType is set to TraceMark, you can pass this parameter to set the tracing watermark information for the video and return the video stream that contains the watermark information. Only English letters, digits, and Chinese characters are supported. A maximum of 1,024 characters are supported.

  • When DigitalWatermarkType is set to CopyrightMark, Trace corresponds to the Watermark Text set when the watermark template is created. By passing this parameter, you can query and return the video stream with the specified watermark text.

test mark

DigitalWatermarkType

string

No

The digital watermarking type. Valid values:

  • TraceMark: tracing watermark.

  • CopyrightMark: copyright watermark.

TraceMark

CodecName

string

No

The codec.

H264

ReferenceId

string

No

The custom ID. The ID must be 6 to 64 characters in length and can contain only lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_). The ID must be unique per user.

123-123

Response elements

Element

Type

Description

Example

object

The response.

RequestId

string

The request ID.

F552E596-967D-5500-842F-17E6364****

VideoBase

object

The basic information about the audio or video file.

CreationTime

string

The time when the audio or video file was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2017-06-26T06:38:48Z

Status

string

The status of the audio or video file. For more information about the valid values and descriptions, refer to Status: media status.

Normal

VideoId

string

The ID of the audio or video file.

93ab850b4f654b6e91d24d81d44****

CoverURL

string

The URL of the thumbnail for the audio or video file.

Note

If you need to obtain the thumbnail URL in real time after a video is uploaded, you can configure an ApsaraVideo VOD callback. For more information, refer to HTTP callbacks and Video snapshot completion event.

http://example.aliyundoc.com/sample.jpg?auth_key=2333232-atb****

Duration

string

The duration of the audio or video file. Unit: seconds.

3.1667

Title

string

The title of the audio or video file.

ApsaraVideo VOD

MediaType

string

The type of the media file. Valid values:

  • video: video.

  • audio: audio-only.

video

DanMuURL

string

The URL of the live comment mask data.

http://example.aliyundoc.com/****?auth_key=abdf2123-6783232****

StorageClass

string

The media storage type. Valid values:

  • Standard: standard.

  • IA: infrequent access for media assets.

  • Archive: archive for media assets.

  • ColdArchive: cold archive for media assets.

  • SourceIA: infrequent access for mezzanine files.

  • SourceArchive: archive for mezzanine files.

  • SourceColdArchive: cold archive for mezzanine files.

  • Changing: the storage type of the media asset is being changed.

  • SourceChanging: the storage type of the mezzanine file is being changed.

Standard

PlayInfoList

object

PlayInfo

array<object>

The playback information about the audio or video file, which includes stream information.

object

The details of the audio or video file.

CreationTime

string

The time when the stream was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2022-04-18T07:37:15Z

Status

string

The status of the media stream. Valid values:

  • Normal: The stream is in the normal state. This state marks the latest transcoded stream for each definition and format.

  • Invisible: The stream is in the invisible state. When multiple duplicate transcoded streams exist for each definition and format, only the latest stream is marked as normal, and other streams are marked as invisible.

Normal

Specification

string

The output specification of the audio or video transcoding. For more information about the valid values and descriptions, refer to Output specifications: Specification.

H264.LD

NarrowBandType

string

The transcoding type. Valid values:

  • 0: standard transcoding.

  • 1.0: Narrowband HD 1.0 transcoding.

  • 2.0: Narrowband HD 2.0 transcoding.

0

Height

integer

The height of the media stream. Unit: pixels.

640

Bitrate

string

The bitrate of the media stream. Unit: Kbit/s.

Note

Due to the dynamic slicing feature of M3U8, the bitrate calculation may have deviations.

450.878

ModificationTime

string

The time when the stream was updated. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2022-04-20T06:32:19Z

WatermarkId

string

The ID of the watermark template associated with the current media stream.

dgfn26457856****

Encrypt

integer

Specifies whether the media stream is encrypted. Valid values:

  • 0: no.

  • 1: yes.

1

Definition

string

The definition of the video stream. Valid values:

  • FD: fluent.

  • LD: standard definition.

  • SD: high definition.

  • HD: ultra-high definition.

  • OD: original definition.

  • 2K: 2K.

  • 4K: 4K.

  • SQ: standard sound quality.

  • HQ: high sound quality.

  • AUTO: adaptive bitrate.

LD

EncryptType

string

The encryption type of the media stream. Valid values:

  • AliyunVoDEncryption: Alibaba Cloud video encryption.

  • HLSEncryption: HLS encryption.

Note

If the encryption type is AliyunVoDEncryption, the video can be played normally only by using ApsaraVideo Player SDK.

AliyunVoDEncryption

EncryptMode

string

The encryption mode of the media stream. Valid values:

  • License: local decryption mode.

Note

If the encryption mode is License, the video can be played normally only by using ApsaraVideo Player SDK.

License

StreamType

string

The type of the media stream. If the media stream is a video, the value is video. If the media stream is audio-only, the value is audio.

video

JobId

string

The ID of the transcoding job for the media stream. This ID uniquely identifies the media stream.

80e9c6580e754a798c3c19c59b16****

Size

integer

The size of the media stream. Unit: bytes.

Note

Due to the dynamic slicing feature of M3U8, the size calculation of the media stream may have deviations.

418112

Width

integer

The width of the media stream. Unit: pixels.

360

Fps

string

The frame rate of the media stream. Unit: frames per second.

25

Duration

string

The duration of the media stream. Unit: seconds.

9.0464

PlayURL

string

The playback URL of the video stream.

https://example.aliyundoc.com/d52ee123f331466aabf6ab32a93d****/a777f9e24e6e47a2a942467d5c38ea37-8ee8e04293c6657fdda282bc422704****.m3u8

Format

string

The format of the media stream.

  • If the media file is a video, valid values are mp4 and m3u8.

  • If the media file is audio-only, the valid value is mp3.

m3u8

HDRType

string

The HDR type of the media stream. Valid values:

  • HDR

  • HDR10

  • HLG

  • DolbyVision

  • HDRVivid

  • SDR+

HLG

BitDepth

integer

The color depth. The value is an integer.

8

JobType

integer

The digital watermarking type. Valid values:

  • 1: tracing watermark.

  • 2: copyright watermark.

2

JobExt

string

The custom watermark information of the copyright watermark. This field is returned only when JobType is 2.

CopyrightMarkTest

CodecName

string

The codec. Valid values:

  • H264

  • H265

H264

Examples

Success response

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": "Alibaba Cloud VOD",
    "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",
        "EncryptMode": "License",
        "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",
        "CodecName": "H264"
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.