All Products
Search
Document Center

ApsaraVideo VOD:GetPlayInfo

更新時間:Oct 22, 2024

Queries the playback URL of a video or audio file by its ID. After you obtain the playback URL of a file stored in ApsaraVideo VOD, you can use ApsaraVideo Player SDK for URL-based playback or use a third-party player such as a system player, open-source player, or self-developed player to play the file.

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.
  • Only videos whose Status is Normal can be played. 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:GetPlayInfoget
  • 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 ID:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Media Files > Audio/Video. On the page that appears, view the media ID.
  • Obtain the value of the VideoId parameter in the response to the CreateUploadVideo operation that you called to upload the audio or video file.
  • Obtain the value of VideoId 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
  • flv
  • 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 dash 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 must be 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
    • 4K
    • SQ: standard sound quality
    • HQ: high sound quality
    • AUTO: adaptive bitrate
    Note
  • By 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 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 must be a JSON string. You can specify a domain name for playback. For more information, see PlayConfig .

    Note
  • If you do not set the PlayConfig parameter or the PlayDomain parameter that is nested under the PlayConfig parameter, the default domain name specified in ApsaraVideo VOD is used in this operation. If no default domain name is specified, the domain names are queried in reverse chronological order based on the time when the domain names were last modified. To prevent domain name issues, we recommend that you perform the following steps to specify the default playback domain name: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. Find the domain name that you want to configure and click Manage in the Actions column. On the page that appears, set the default playback domain name in the Origin Domain Name section.
  • If you set the EncryptType parameter nested under the PlayConfig parameter to AliyunVoDEncryption, the playback URLs of videos encrypted by using Alibaba Cloud proprietary cryptography are not automatically returned to ensure video security. To return playback URLs of videos encrypted by using Alibaba Cloud proprietary cryptography, 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.

    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 response parameters.

    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 media 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 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 file is stored as a Cold Archive object.
    • Changing: The storage class of the video file is being changed.
    • SourceChanging: The storage class of the source file is being changed.
    Standard
    PlayInfoListarray<object>

    The information about the audio or video stream.

    PlayInfoobject

    The audio or video details.

    CreationTimestring

    The time when the audio or video stream was created. The time is 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 transcoding type. Valid values:

    • 0: regular transcoding
    • 1.0: Narrowband HD™ 1.0 transcoding
    • 2.0: Narrowband HD™ 2.0 transcoding
    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 last updated. The time is 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 video stream. Valid values:

    • FD: low definition
    • LD: standard definition
    • SD: high definition
    • HD: ultra-high definition
    • OD: original definition
    • 2K
    • 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
    EncryptModestring

    The encryption type of the media stream. Valid values:

    • License: decryption on local devices
    Note If the encryption type is License, only ApsaraVideo Player SDK can be used to play videos.
    License
    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.

    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 asset 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: user-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",
            "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"
          }
        ]
      }
    }

    Error codes

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2024-10-11The response structure of the API has changedView Change Details
    2023-10-18The request parameters of the API has changedView Change Details
    2023-09-05The response structure of the API has changedView Change Details
    2021-12-23The response structure of the API has changedView Change Details
    2021-11-16The response structure of the API has changedView Change Details