Registers a media file.
Operation Description
After you store an audio or video file in an Object Storage Service (OSS) bucket that is used for ApsaraVideo VOD, you can call the RegisterMedia operation to register the media file. After the media file is registered, you can use the media ID associated with the media file to submit transcoding jobs and snapshot jobs in ApsaraVideo VOD. For more information, see SubmitTranscodeJobs and SubmitSnapshotJob.
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vod:RegisterMedia | Read |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegisterMetadatas | string | Yes | The metadata of the media file that you want to register. The value is a JSON string. You can specify the metadata for a maximum of 10 media files at a time. For more information about the metadata of media files, see the RegisterMetadata section of this topic. | [{"FileURL":"https://****.oss-cn-shanghai.aliyuncs.com/video/test/video123.m3u8","Title":"VideoName"}] |
TemplateGroupId | string | No | The ID of the transcoding template group. You can use one of the following methods to obtain the ID of the transcoding template group:
Note | ca3a8f6e49c87b65806709586**** |
UserData | string | No | The custom configurations such as callback configurations. The value is a JSON string. For more information, see the "UserData: specifies the custom configurations for media upload" section of the Request parameters topic. | {"Extend":{"localId":"****","test":"www"}} |
WorkflowId | string | No | The ID of the workflow. To view the ID of the workflow, log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Workflows. NoteIf both the WorkflowId and TemplateGroupId parameters are set, the value of the WorkflowId parameter takes effect. For more information, see Workflows. | 637adc2b7ba51a83d841606f8**** |
RegisterMetadata
The following table describes the metadata of the media file that you want to register.
Parameter | Type | Required | Description |
---|---|---|---|
FileURL | String | Yes | The OSS URL of the source file. You can call the GetMezzanineInfo operation to obtain the OSS URL of the source file. The URL can be up to 1,024 bytes in length. The file name must be globally unique. If the media file that you want to register is registered before, the unique media ID that is associated with the media file is returned. |
Title | String | Yes | The title of the media file. The title can be up to 128 bytes in length. The value must be encoded in UTF-8. |
Description | String | No | The description of the media file. The description can be up to 1,024 bytes in length. The value must be encoded in UTF-8. |
Tags | String | No | The one or more tags of the media file. Each tag can be up to 32 bytes in length. You can specify a maximum of 16 tags. Separate multiple tags with commas (,). The value must be encoded in UTF-8. |
CoverURL | String | No | The URL of the thumbnail. The URL can be up to 1,024 bytes in length. |
CateId | Long | No | The category ID of the media file. You can use one of the following methods to obtain the category ID: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories. On the Categories page, you can view the category ID of the media file. View the value of the CateId parameter returned by the AddCategory operation that you called to create a category. View the value of the CateId parameter returned by the GetCategories operation that you called to query a category. |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "14F43C5C-8033-448B-AD04F64E5098****",
"FailedFileURLs": [
"[\"http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_03.mp4\"]"
],
"RegisteredMediaList": [
{
"NewRegister": false,
"FileURL": "http://****.oss-cn-shanghai.aliyuncs.com/vod_sample_01.mp4",
"MediaId": "d97af32828084d1896683b1aa38****"
}
]
}
Error codes
For a list of error codes, visit the Service error codes.