All Products
Search
Document Center

ApsaraVideo Live:AddShowIntoShowList

Last Updated:Nov 14, 2024

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 .

Note
  • 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

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
live:AddShowIntoShowListcreate
*Caster
acs:live:*:{#accountId}:caster/{#CasterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
showListarray<object>No

The episodes that you want to add to the episode list. Each episode has a unique name and resource URL.

objectNo
durationlongNo

The duration of the episode. Unit: seconds.

Note You can specify only one of the RepeatTimes and Duration parameters.
20
liveInputTypeintegerNo

The custom type label.

1
repeatTimesintegerNo

The number of times the episode repeats after the first playback is complete. The default value is 0.

Note
  • You can specify only one of the RepeatTimes and Duration parameters.

  • The RepeatTimes parameter specifies the number of repetitions. For example, if you set the value to 0, the episode is to be played once. If you set the value to 1, the episode is to be played twice.

0
resourceIdstringNo

The ID of the resource.

a2b8e671-2fe5-4642-a2ec-bf93880e****
resourceTypestringNo

The resource type. Valid values:

  • live: live stream
  • vod: on-demand video
  • pic: image
Note
  • When you select media resources from ApsaraVideo VOD, we recommend that you select resources that are stored in hosted 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.

  • You can add a live stream from ApsaraVideo Live or by using a third-party URL.

  • You can add an on-demand video from ApsaraVideo VOD or by using a third-party URL, or add an on-demand image.

vod
resourceUrlstringNo

The URL of the resource.

http://****/atestObject****.m3u8
showNamestringNo

The name of the episode.

liveShow****
CasterIdstringYes

The ID of the production studio.

  • If the production studio was created by calling the CreateCaster operation, check the value of the response parameter CasterId to obtain the ID.
  • If the production studio was created by using the ApsaraVideo Live console, obtain the ID on the Production Studio Management page. To go to the page, log on to the ApsaraVideo Live console and click Production Studios in the left-side navigation pane.
Note You can find the ID of the production studio in the Instance Name column.
LIVEPRODUCER_POST-cn-0pp1czt****
ShowNamestringNo

The name of the episode.

liveShow****
ResourceTypestringNo

The resource type. Valid values:

  • live: live stream
  • vod: on-demand video
  • pic: image
Note
  • When you select media resources from ApsaraVideo VOD, we recommend that you select resources that are stored in hosted 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. - You can add a live stream from ApsaraVideo Live or by using a third-party URL. - You can add an on-demand video from ApsaraVideo VOD or by using a third-party URL, or add an on-demand image.
vod
ResourceUrlstringNo

The URL of the resource.

http://****/atestObject****.m3u8
ResourceIdstringNo

The ID of the resource.

a2b8e671-2fe5-4642-a2ec-bf93880e****
DurationlongNo

The duration of the episode. Unit: seconds.

Note You can specify only one of the RepeatTimes and Duration parameters.
20
RepeatTimesintegerNo

The number of times the episode repeats after the first playback is complete. The default value is 0.

Note
  • You can specify only one of the RepeatTimes and Duration parameters. - The RepeatTimes parameter specifies the number of repetitions. For example, if you set the value to -1, the episode is to be played for infinite times. If you set the value to 0, the episode is to be played once. If you set the value to 1, the episode is to be played twice.
0
SpotintegerNo

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
LiveInputTypeintegerNo

The custom type label.

1
isBatchModebooleanNo

Specifies whether to add multiple episodes to the episode list at a time. Valid values:

  • true: adds multiple episodes to the episode list at a time.
  • false: adds a single episode to the episode list.
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

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

987DA143-A39C-5B5D-AF5B-3B07944A0036
ShowIdstring

The ID of the episode.

a2b8e671-2fe5-4642-a2ec-bf93880e****
failedListstring

The list of resources that failed to be added and the reason for failure.

failedList[Show1, Show2...]
successfulShowIdsstring

The IDs of the episodes that were added.

f1933f16-5467-4308-b3a9-e8d451a90999,547436b8-c839-4469-a2c0-704c1ce5ce00

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError message
400InvalidUserId.Malformed%s
400InvalidParameter.Malformed%s
400InvalidCasterId.Malformed%s
400InvalidVodUrl.Malformed%s
400MissingParameter%s
401IllegalOperation%s
404InvalidCaster.NotFound%s
404InvalidShowList.NotFound%s
500InternalError%s

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

Change history

Change timeSummary of changesOperation
No change history

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);
        }
    }