Adds an episode to an episode list.
Operation description
You must create a production studio in the new playlist mode and add media resources to the production studio before you can call this operation. For information about how to create a production studio by calling an operation, see CreateCaster .
- When you select media resources from ApsaraVideo VOD, we recommend that you select resources that are stored in hosted Object Storage Service (OSS) buckets. Resources stored in non-hosted OSS buckets have a validity period. Pay attention to the validity if you select resources that are stored in non-hosted OSS buckets.
- When you add media resources to a production studio, we recommend that you select resources from ApsaraVideo Live and ApsaraVideo VOD. If you add a third-party stream by specifying a streaming URL, the stream may fail to be played. You must pay attention to the quality and validity of third-party streams.
QPS limit
You can call this operation up to 10 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 limit on an API operation in ApsaraVideo Live.
Debugging
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 |
---|---|---|---|---|
live:AddShowIntoShowList | create | *Caster acs:live:*:{#accountId}:caster/{#CasterId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
showList | array<object> | No | The episodes that you want to add to the episode list. Each episode has a unique name and resource URL. | |
object | No | |||
duration | long | No | The duration of the episode. Unit: seconds. Note
You can specify only one of the RepeatTimes and Duration parameters.
| 20 |
liveInputType | integer | No | The custom type label. | 1 |
repeatTimes | integer | No | The number of times the episode repeats after the first playback is complete. The default value is 0. Note
| 0 |
resourceId | string | No | The ID of the resource. | a2b8e671-2fe5-4642-a2ec-bf93880e**** |
resourceType | string | No | The resource type. Valid values:
Note
| vod |
resourceUrl | string | No | The URL of the resource. | http://****/atestObject****.m3u8 |
showName | string | No | The name of the episode. | liveShow**** |
CasterId | string | Yes | The ID of the production studio.
Note
You can find the ID of the production studio in the Instance Name column.
| LIVEPRODUCER_POST-cn-0pp1czt**** |
ShowName | string | No | The name of the episode. | liveShow**** |
ResourceType | string | No | The resource type. Valid values:
Note
| vod |
ResourceUrl | string | No | The URL of the resource. | http://****/atestObject****.m3u8 |
ResourceId | string | No | The ID of the resource. | a2b8e671-2fe5-4642-a2ec-bf93880e**** |
Duration | long | No | The duration of the episode. Unit: seconds. Note
You can specify only one of the RepeatTimes and Duration parameters.
| 20 |
RepeatTimes | integer | No | The number of times the episode repeats after the first playback is complete. The default value is 0. Note
| 0 |
Spot | integer | No | The position of the episode in the episode list. Position indexes start from 0. By default, the episode is added to the end of the episode list. | 1 |
LiveInputType | integer | No | The custom type label. | 1 |
isBatchMode | boolean | No | Specifies whether to add multiple episodes to the episode list at a time. Valid values:
Note
If you do not specify this parameter or this parameter is left empty, a single episode is to be added to the episode list.
| false |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "987DA143-A39C-5B5D-AF5B-3B07944A0036",
"ShowId": "a2b8e671-2fe5-4642-a2ec-bf93880e****",
"failedList": "failedList[Show1, Show2...]",
"successfulShowIds": "f1933f16-5467-4308-b3a9-e8d451a90999,547436b8-c839-4469-a2c0-704c1ce5ce00"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidUserId.Malformed | %s |
400 | InvalidParameter.Malformed | %s |
400 | InvalidCasterId.Malformed | %s |
400 | InvalidVodUrl.Malformed | %s |
400 | MissingParameter | %s |
401 | IllegalOperation | %s |
404 | InvalidCaster.NotFound | %s |
404 | InvalidShowList.NotFound | %s |
500 | InternalError | %s |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
Sample code
public static DefaultAcsClient initClient(String accessKeyId, String accessKeySecret) throws ClientException {
String regionId = "cn-shanghai";
DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
return client;
}
private static CommonResponse addShowIntoShowList(DefaultAcsClient client, String showName, String resourceId, String resourceUrl,
String resourceType, Integer spot, Integer repeatTimes,
String casterId, Long duration) throws ClientException {
CommonRequest addShowIntoShowListRequest = new CommonRequest();
addShowIntoShowListRequest.setSysDomain("live.aliyuncs.com");
addShowIntoShowListRequest.setSysVersion("2016-11-01");
addShowIntoShowListRequest.setSysAction("AddShowIntoShowList");
if (casterId == null || resourceType == null) {
return null;
}
if (resourceId == null && resourceUrl == null) {
return null;
}
addShowIntoShowListRequest.putQueryParameter("CasterId", casterId);
addShowIntoShowListRequest.putQueryParameter("ResourceType", resourceType);
if (showName != null) {
addShowIntoShowListRequest.putQueryParameter("ShowName", showName);
}
if (resourceUrl != null) {
addShowIntoShowListRequest.putQueryParameter("ResourceUrl", resourceUrl);
}
if (resourceId != null) {
addShowIntoShowListRequest.putQueryParameter("ResourceId", resourceId);
}
if (spot != null) {
addShowIntoShowListRequest.putQueryParameter("Spot", spot.toString());
}
if (repeatTimes != null) {
addShowIntoShowListRequest.putQueryParameter("RepeatTimes", repeatTimes.toString());
}
if (duration != null) {
addShowIntoShowListRequest.putQueryParameter("Duration", duration.toString());
}
CommonResponse addShowIntoShowListResponse = client.getCommonResponse(addShowIntoShowListRequest);
return addShowIntoShowListResponse;
}
public void addshows() throws ClientException {
DefaultAcsClient client = initClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET);
String[] resourceIds = new String[]{"698d2b23581f476ea71107703e647d1e", "9c97e83e211a435b9f797e4e20eeea27", "76c6addaa41c438985666a8a964fa5e5"};
for (int i = 0; i < resourceIds.length; i++) {
String showName = "ShowName#" + i;
Integer repeatTimes = i;
addShowIntoShowList(client, showName, resourceIds[i], null, "vod", null, repeatTimes, testCasterId, null);
}
}