This topic describes the parameters and provides configuration examples for PlayConfig, ReAuthInfo, UserData, SpriteSnapshotConfig, and EncryptConfig in ApsaraVideo VOD APIs.
Custom playback settings: PlayConfig
Parameter descriptions
A JSON string that specifies custom settings for media playback. You can use this parameter to specify a domain name for playback. The following fields are supported:
Field name | Type | Required | Description |
PlayDomain | String | No | The domain name for playback. If you configure multiple origin fetch domain names, you can specify one of them to play the current video. If the specified domain name does not exist, the playback URL of the default domain name for the video storage is returned. Example: |
XForwardedFor | String | No | The originating IP address of the client that initiates the request. This can be used in scenarios such as authenticating secure IP addresses. ApsaraVideo VOD can obtain the originating client IP address based on this field after a request passes through multiple proxy servers. To ensure data security, this IP address is encrypted using the Example: yqCD7Fp1uqChoVj/sl/p5Q== |
PreviewTime | String | No | The preview duration for video-on-demand, in seconds. The minimum value is 1. The maximum value is the total duration of the video. If you do not specify this parameter, the entire video can be played. To enable the preview feature, see Preview videos. |
MtsHlsUriToken | String | No | The MtsHlsUriToken generated by your token service. This parameter applies to the playback of videos that use HLS encryption. It protects your decryption key from being stolen. For more information, see HLS encryption. |
EncryptType | String | No | The encryption type. You can use this parameter to filter and play unencrypted or encrypted streams. Valid values:
Note For information about the usage and limits of encrypted stream URLs, see Obtain URLs in advance through event notifications. |
StorageClass | String | No | The storage class of the media asset. You can use this parameter to filter and return playback streams of a specific storage class. Valid values:
|
Configuration example
PlayConfig={
"PlayDomain": "vod.test_domain",
"XForwardedFor": "yqCD7Fp1uqChoVj/sl/p5Q==",
"PreviewTime": "20",
"MtsHlsUriToken": "yqCD7Fp1uqChoVjslp5Q",
"StorageClass": "Standard"
} CDN reauthentication settings: ReAuthInfo
Parameter descriptions
A JSON string that specifies the parameters for CDN reauthentication during media playback. If you enable CDN reauthentication, you can use this parameter to set the `uid` and `rand` fields for the signed URL. The following fields are supported:
Field name | Type | Required | Description |
uid | String | No | An additional parameter. The default value is 0. You can customize this parameter. |
rand | String | No | A random number. The default value is 0. To ensure that a unique URL is generated each time, you can use a UUID or another method to generate a random number. |
Configuration example
ReAuthInfo={
"uid": "12345",
"rand": "abckljd"
}Custom upload settings: UserData
Parameter descriptions
A JSON string that specifies custom settings for media uploads, such as message callbacks.
The following fields are supported:
Field name | Type | Required | Description |
MessageCallback | String | No | The message callback settings. The data type is a JSON object. If you specify this parameter, these event notification settings are used. Otherwise, the global event notification settings are used. For more information, see Configure multiple webhooks. Parameter descriptions:
Example values:
|
Extend | String | No | A custom extension field. This field is passed through and returned in the callback. The maximum length is 512 bytes. The data type is a JSON object. Note Avoid using special characters, such as the dollar sign ($), forward slash (/), and backslash (\\), in the extension field. If you must use them, Base64-encode the parameter value and Base64-decode it when you retrieve it. |
AccelerateConfig | String | No | The upload acceleration settings. The data type is a JSON object. Example: {"Type":"oss","Domain":"https://oss-accelerate.aliyuncs.com"}. `Type` is the acceleration method (only `oss` is supported). `Domain` is the accelerated domain name, which corresponds to an OSS region and endpoint. The default protocol is HTTPS. Note You must request to activate the upload acceleration feature before you can use it. For information about how to activate this feature and its billing, see Upload acceleration. |
Configuration example
UserData={
"MessageCallback": {
"MNSEndpoint":"http://174809843091****.mns.cn-beijing.aliyuncs.com",
"MNSQueueName":"vod-callback-bj",
"CallbackType": "mns"
},
"Extend": {
"localId": "xxx",
"test": "www"
},
"AccelerateConfig": {
"Type": "oss",
"Domain": "https://oss-accelerate.aliyuncs.com"
}
}
Encryption configuration: EncryptConfig
Specifies the standard encryption configuration.
Field name | Type | Required | Description |
CipherText | String | Yes | The ciphertext of the data key. It is used to obtain the plaintext data key. Set this parameter to the |
DecryptKeyUri | String | Yes | The URI that is used to obtain the decryption key based on the ciphertext. The key URI is a combination of the decryption service address and the You must build your own decryption service. For example, if your decryption service address is
|
KeyServiceType | String | Yes | The type of key service. The default value is `KMS`, which indicates Alibaba Cloud Key Management Service (KMS). |
Sprite snapshot configuration: SpriteSnapshotConfig
Field name | Type | Required | Description |
CellWidth | String | No | The width of a sub-image in the sprite. The default value is the width of the snapshot output. Unit: px. |
CellHeight | String | No | The height of a sub-image in the sprite. The default value is the height of the snapshot output. Unit: px. |
Padding | String | No | The padding of a sub-image. The default value is 0. Unit: px. |
Margin | String | No | The margin of a sub-image. The default value is 0. Unit: px. |
Color | String | No | The background color of the sprite. The default value is Black. |
Columns | String | No | The number of columns of sub-images. Valid values: [1, 10000]. Default value: 10. |
Lines | String | No | The number of rows of sub-images. Valid values: [1, 10000]. Default value: 10. |
KeepCellPic | String | No | Specifies whether to retain the sub-images. Valid values:
Default value: keep. |
If you want to use the default values for all parameters in SpriteSnapshotConfig, you can pass an empty JSON string: {}.