All Products
Search
Document Center

ApsaraVideo VOD:GetPlayInfo

Last Updated:Nov 09, 2022

Queries the playback URL of a video or audio file by its ID.

Operation Description

You 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. For more information, see Obtain playback URLs to play videos.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
vod:GetPlayInfoRead
  • VOD
    acs:vod:*:{#accountId}:*/*
    without
without

Request parameters

ParameterTypeRequiredDescriptionExample
VideoIdstringYes

The ID of the audio or video file. You can use one of the following methods to obtain the ID of the file:

  • 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 when you call the CreateUploadVideo operation to upload files.
  • Obtain the value of the VideoId parameter by calling 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
NoteBy 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 configured 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 the OutputType parameter is set to cdn:
    • This parameter takes effect only if URL authentication is enabled. Otherwise, the playback URL does not expire.
    • Minimum value: 1.
    • Maximum value: unlimited.
    • Default value: The default validity period that is specified in URL authentication is used.
  • If the OutputType parameter is set 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: 2592000 (30 days). This limit is imposed to reduce security risks of the origin.
    • Default value: 3600.
1800
OutputTypestringNo

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

  • oss: OSS URL
  • cdn: CDN URL
cdn
StreamTypestringNo

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

  • video
  • audio

By default, both 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 set 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
NoteBy default, ApsaraVideo VOD returns video streams in all the preceding qualities. However, video streams for adaptive bitrate streaming are returned only if the PackageSetting parameter is set 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 set 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 avoid domain name issues, we recommend that you set 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 by default to ensure video security. If you need 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. Value: danmu.

    NoteThis parameter takes effect only when the outputType parameter is set to cdn.
    danmu

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned data.

    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 audio or video 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.

    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****
    PlayInfoListarray

    The information about the audio or video stream.

    object

    The information about the audio or video stream.

    CreationTimestring

    The time when the stream URL 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 media stream. Valid values:

    • Normal
    • Invisible
    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: regular
    • 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 stream URL 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 video stream was encrypted. Valid values:

    • 0: no
    • 1: yes
    1
    Definitionstring

    The quality of the video 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
    NoteIf 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 ID of the media transcoding job. 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.

    9.0464
    PlayURLstring

    The playback URL of the video 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 must be an integer.

    8

    Example

    Normal return example

    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": "VOD",
        "MediaType": "video",
        "DanMuURL": "http://example.aliyundoc.com/****?auth_key=abdf2123-6783232****"
      },
      "PlayInfoList": [
        {
          "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
        }
      ]
    }

    Error codes

    For a list of error codes, visit the API error center.

    Change history

    Change timeSummary of changesOperate
    2021-12-23The response structure of the API operation has changed
    Change itemChange content
    Output ParametersThe response structure of the API operation has changed
    2021-11-16The response structure of the API operation has changed
    Change itemChange content
    Output ParametersThe response structure of the API operation has changed

    Common errors

    The following table describes the common errors that this operation can return.

    Error codeError messageHTTP status codeDescription
    Forbidden.IllegalStatusStatus of the video is illegal. Current Status is %s.403The error message returned because the video status is invalid. %s indicates the current video status. Only videos in the Normal state can be played.
    InvalidVideo.NotFoundThe video does not exist.404The error message is returned because the video does not exist.
    InvalidVideo.NoneStreamThe video has no stream to play for the request parameter 'Formats: mp4, Definition: LD, StreamType: video'.404The error message returned because no transcoded stream that meets the specified filter criteria is available for playback. Check whether the transcoding configuration matches the filter criteria.
    Forbidden.AliyunVoDEncryptionCurrently only the AliyunVoDEncryption stream exists, you must use the Aliyun player to play or set the value of ResultType to Multiple.403The error message returned because only transcoded files that are encrypted by using Alibaba Cloud proprietary cryptography exist. You must use ApsaraVideo Player to play the files or set the ResultType parameter to Multiple.