All Products
Search
Document Center

ApsaraVideo VOD:RefreshMediaPlayUrls

Last Updated:May 11, 2024

Submits media refresh or prefetch tasks based on the media IDs.

Operation description

  • ApsaraVideo VOD allows you to refresh and prefetch resources. The refresh feature forces the point of presence (POP) to clear cached resources and retrieve the latest resources from origin servers. The prefetch feature allows the POP to retrieve frequently accessed resources from origin servers during off-peak hours. This increases the cache hit ratio.
  • You can call this operation to submit refresh or prefetch tasks based on the media ID. You can also specify the format and resolution of the media streams to refresh or prefetch based on your business requirements.
  • You can submit a maximum of 20 refresh or prefetch tasks at a time.

QPS limits

You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits on API operations in ApsaraVideo VoD.

Debugging

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

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
MediaIdsstringYes

The IDs of the media files that you want to refresh or prefetch. You can specify a maximum of 20 IDs. Separate multiple IDs with commas (,). 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 Video and Audio page, 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 VideoId from the response to the CreateUploadVideo operation that you call to upload media files.
  • Obtain the value of VideoId from the response to the SearchMedia operation that you call to query the media ID after the media file is uploaded.
ca3a8f6e4957b658067095869****, a6e49sfgd23p5g9ja7095863****
TaskTypestringYes

The type of the task that you want to create. Valid values:

  • Refresh
  • Preload
Preload
FormatsstringNo

The formats of the media streams you want to refresh or prefetch. You can specify multiple formats. Separate multiple formats with commas (,). If you leave this parameter empty, media streams in all formats are refreshed or prefetched by default. Valid values:

  • mp4
  • m3u8
  • mp3
  • flv
  • webm
  • ts
mp4,m3u8
DefinitionsstringNo

Specifies the resolutions of the media streams you want to refresh or prefetch. You can specify multiple resolutions. Separate multiple resolutions with commas (,). If you leave this parameter empty, media streams in all resolutions are refreshed or prefetched by default.

Note The value must be supported in the Definition section in Parameters for media assets.
HD, SD
StreamTypestringNo

Specifies the types of media streams you want to refresh or prefetch. You can specify multiple types. Separate multiple types with commas (,). If you leave this parameter empty, media streams in all types are refreshed or prefetched by default. Valid values:

  • video
  • audio
video
ResultTypestringNo

Specifies the type of the refresh or prefetch operation. Default value: Single. Valid values:

  • Single: Only one latest transcoded stream is refreshed or prefetched for each resolution and format.
  • Multiple: All transcoded streams are refreshed or prefetched for each resolution and format.
Single
SliceFlagbooleanNo

Specifies whether to refresh or prefetch the playback URLs of the TS files of the M3U8 media stream. Default value: false. Valid values:

  • false
  • true
false
SliceCountintegerNo

Specifies the number of the playback URLs of the TS files for the M3U8 media stream you want to refresh or prefetch. After you set this parameter, only the playback URLs of the first N TS files will be refreshed or prefetched. Valid values: 1 to 20. Default value: 5.

5
UserDatastringNo

The custom configurations such as callback configurations and upload acceleration configurations. The value is a JSON string. For more information, see Request parameter.

Note
  • The callback configurations take effect only after you specify the HTTP callback URL and select specific callback events in the ApsaraVideo VOD console. For more information about how to configure HTTP callback settings in the ApsaraVideo VOD console, see Configure callback settings.
  • You must submit a ticket to enable the upload acceleration feature. For more information, see Overview .
{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"}, "Extend":{"localId":"xxx","test":"www"}}

Response parameters

ParameterTypeDescriptionExample
object

The returned data.

MediaRefreshJobIdstring

The ID of the refresh or prefetch task.

41d465e31957****
NonExistMediaIdsstring

The IDs of the media files that do not exist.

ca3a8f6e4957b658067095869****
ForbiddenMediaIdsstring

The IDs of the media files that cannot be operated on. In most cases, media files cannot be operated on because you are not authorized to perform the operations. For more information, see Overview .

a6e49sfgd23p5g9ja7095863****
RequestIdstring

The ID of the request.

25818875-5F78-4AF6-04D5-D7393642****

Examples

Sample success responses

JSONformat

{
  "MediaRefreshJobId": "41d465e31957****",
  "NonExistMediaIds": "ca3a8f6e4957b658067095869****",
  "ForbiddenMediaIds": "a6e49sfgd23p5g9ja7095863****",
  "RequestId": "25818875-5F78-4AF6-04D5-D7393642****"
}

Error codes

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

Change history

Change timeSummary of changesOperation
2022-03-31Add Operationsee changesets