All Products
Search
Document Center

ApsaraVideo VOD:GetPlayInfo

Last Updated:Mar 03, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
vod:GetPlayInfoRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
VideoIdstringYes

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:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Media Files > Audio/Video. On the Video and Audio page, you can view the ID of the audio or video file. This method is applicable to files that are uploaded by using the ApsaraVideo VOD console.
  • Obtain the value of the VideoId parameter from the response to the CreateUploadVideo operation.
  • Obtain the value of the VideoId parameter from the response to the SearchMedia operation. This method is applicable to files that have been uploaded.
93ab850b4f654b6e91d24d81d44****
FormatsstringNo

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

  • mp4
  • m3u8
  • mp3
  • mpd
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
AuthTimeoutlongNo

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

  • If you set OutputType to cdn:

    • The playback URL has a validity period only if URL signing is enabled. Otherwise, the playback URL is permanently valid. For more information about how to enable and configure URL signing, see URL signing.
    • Minimum value: 1.
    • Maximum value: unlimited.
    • Default value: The default validity period that is specified in URL signing is used.
  • If you set OutputType to oss:

    • This parameter takes effect only when the ACL of the Object Storage Service (OSS) bucket is private. Otherwise, the playback URL does not expire.
    • Minimum value: 1.
    • Maximum value: If the media file is stored in the VOD bucket, the maximum validity period is 2592000 (30 days). If the media file is stored in an OSS bucket, the maximum validity period is 129600 (36 hours). This limit is imposed to reduce security risks of the origin server. If you require a longer validity period, set OutputType to cdn and configure URL signing to specify a longer validity period.
    • Default value: 3600.
1800
OutputTypestringNo

The type of the output URL. Default value: oss. Valid values:

  • oss
  • cdn
cdn
StreamTypestringNo

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

  • video
  • audio

By default, video and audio streams are returned.

video
ReAuthInfostringNo

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"}
DefinitionstringNo

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

  • FD: low definition
  • 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, 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
ResultTypestringNo

The type of the data to return. Default value: Single. Valid values:

  • Single: Only one latest transcoded stream is returned for each quality and format.
  • Multiple: All transcoded streams are returned for each quality and format.
Single
PlayConfigstringNo

The custom playback configuration. The value is a JSON string. For more information, see PlayConfig .

Note
  • If you do not specify PlayConfig or 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.
  • If the 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"}
    AdditionTypestringNo

    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
    TracestringNo

    The custom digital watermark.

    • If you set DigitalWatermarkType to TraceMark, specify this parameter to configure the video tracing watermark and return the video stream that contains the watermark. The value can be up to 1,024 characters in length and can contain letters and digits.
    • If you set DigitalWatermarkType to CopyrightMark, specify the watermark text that you created for the watermark template for this parameter.`` You can specify this parameter to query and return the video stream that contains the specified watermark text.
    test mark
    DigitalWatermarkTypestringNo

    The type of the digital watermark. Valid values:

    • TraceMark: tracing watermark
    • CopyrightMark: copyright watermark
    TraceMark

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned result.

    RequestIdstring

    The ID of the request.

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

    The basic information about the audio or video file.

    CreationTimestring

    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
    Statusstring

    The status of the audio or video file. For more information about the value range and description, see the Status table.

    Normal
    VideoIdstring

    The ID of the media file.

    93ab850b4f654b6e91d24d81d44****
    CoverURLstring

    The thumbnail URL of the audio or video file.

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

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

    3.1667
    Titlestring

    The title of the audio or video file.

    ApsaraVideo VOD
    MediaTypestring

    The type of the media file. Valid values:

    • video
    • audio
    video
    DanMuURLstring

    The URL of the masked live comment data.

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

    The storage class of the audio or video file. Valid values:

    • Standard: All media resources are stored as Standard objects.
    • IA: All media resources are stored as IA objects.
    • Archive: All media resources are stored as Archive objects.
    • ColdArchive: All media resources are stored as Cold Archive objects.
    • SourceIA: Only the source files are IA objects.
    • SourceArchive: Only the source files are Archive objects.
    • SourceColdArchive: Only the source files are Cold Archive objects.
    • Changing: The storage class of the audio or video file is being changed.
    • SourceChanging: The storage class of the source file is being changed.
    Standard
    PlayInfoListobject []

    The information about the audio or video stream.

    CreationTimestring

    The time when the audio or video 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
    Statusstring

    The status of the audio or video stream. Valid values:

    • Normal: The latest transcoded stream in each quality and format is in the Normal status.
    • Invisible: If multiple streams are transcoded in the same quality and format, the latest transcoded stream is in the Normal status and other streams are in the Invisible status.
    Normal
    Specificationstring

    The specifications of transcoded audio and video streams. For more information about the valid values, see Output specifications.

    H264.LD
    NarrowBandTypestring

    The type of Narrowband HD transcoding. Valid values:

    • 0: normal transcoding
    • 1.0: Narrowband HD 1.0
    • 2.0: Narrowband HD 2.0

    This parameter is returned only when a quality that is available in the built-in Narrowband HD 1.0 transcoding template is specified. For more information, see the Definition parameter in the TranscodeTemplate table.

    0
    Heightlong

    The height of the media stream. Unit: pixels.

    640
    Bitratestring

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

    450.878
    ModificationTimestring

    The time when the audio or video file 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
    WatermarkIdstring

    The ID of the watermark that is associated with the media stream.

    dgfn26457856****
    Encryptlong

    Indicates whether the media stream is encrypted. Valid values:

    • 0: The media stream is not encrypted.
    • 1: The media stream is encrypted.
    1
    Definitionstring

    The quality of the media stream. Valid values:

    • FD: low definition
    • 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
    EncryptTypestring

    The encryption type of the media stream. Valid values:

    • AliyunVoDEncryption: Alibaba Cloud proprietary cryptography
    • HLSEncryption: HTTP Live Streaming (HLS) encryption
    Note If the encryption type is AliyunVoDEncryption, only ApsaraVideo Player SDK can be used to play videos.
    AliyunVoDEncryption
    StreamTypestring

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

    video
    JobIdstring

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

    80e9c6580e754a798c3c19c59b16****
    Sizelong

    The size of the media stream. Unit: bytes.

    418112
    Widthlong

    The width of the media stream. Unit: pixels.

    360
    Fpsstring

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

    25
    Durationstring

    The duration of the media stream. Unit: seconds. 86,400 seconds is equivalent to 24 hours.

    9.0464
    PlayURLstring

    The playback URL of the media stream.

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

    The format of the media stream.

    • If the media file is a video file, the valid values are mp4 and m3u8.
    • If the media file is an audio-only file, the value is mp3.
    m3u8
    HDRTypestring

    The HDR type of the media stream. Valid values:

    • HDR
    • HDR10
    • HLG
    • DolbyVision
    • HDRVivid
    • SDR+
    HLG
    BitDepthinteger

    The color depth. This value is an integer.

    8
    JobTypeinteger

    The type of the digital watermark. Valid values:

    • 1: tracing watermark
    • 2: copyright watermark
    2
    JobExtstring

    The custom watermark information of the copyright watermark. This parameter is returned if you set JobType to 2.

    CopyrightMarkTest

    Examples

    Sample success responses

    JSONformat

    {
      "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 timeSummary of changesOperation
    2023-10-18The request parameters of the API has changedsee changesets
    Change itemChange content
    Input ParametersThe request parameters of the API has changed.
      Added Input Parameters: Trace
      Added Input Parameters: DigitalWatermarkType
    2023-09-05The response structure of the API has changedsee changesets
    Change itemChange content
    Output ParametersThe response structure of the API has changed.
    2021-12-23The response structure of the API has changedsee changesets
    Change itemChange content
    Output ParametersThe response structure of the API has changed.
    2021-11-16The response structure of the API has changedsee changesets
    Change itemChange content
    Output ParametersThe response structure of the API has changed.