All Products
Search
Document Center

ApsaraVideo Live:AddShowIntoShowList

Last Updated:Feb 20, 2024

Adds an episode to an episode list.

Usage notes

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.

You can add up to 1,000 episodes to an episode list.

Important
  • 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 the third-party stream.

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 limits.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

AddShowIntoShowList

The operation that you want to perform. Set the value to AddShowIntoShowList.

showList.N.showName

String

No

liveShow****

The name of the episode.

showList.N.repeatTimes

Integer

No

0

The number of times the episode repeats after the first playback is complete. Default value: 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.

showList.N.resourceType

String

No

vod

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.

showList.N.resourceUrl

String

No

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

The URL of the resource.

showList.N.liveInputType

Integer

No

1

The custom type label.

showList.N.duration

Long

No

20

The duration of the episode. Unit: seconds.

Note

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

showList.N.resourceId

String

No

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

The ID of the resource.

CasterId

String

Yes

LIVEPRODUCER_POST-cn-0pp1czt****

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.

ShowName

String

No

liveShow****

The name of the episode.

ResourceType

String

No

vod

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.

ResourceUrl

String

No

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

The URL of the resource.

ResourceId

String

No

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

The ID of the resource.

Duration

Long

No

20

The duration of the episode. Unit: seconds.

Note

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

RepeatTimes

Integer

No

0

The number of times the episode repeats after the first playback is complete. Default value: 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.

Spot

Integer

No

1

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.

LiveInputType

Integer

No

1

The custom type label.

isBatchMode

Boolean

No

false

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.

Response parameters

Parameter

Type

Example

Description

RequestId

String

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

The request ID.

ShowId

String

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

The ID of the episode.

successfulShowIds

String

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

The IDs of the episodes that were added.

failedList

String

failedList[Show1, Show2...]

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

Examples

Sample requests

http(s)://live.aliyuncs.com/?Action=AddShowIntoShowList
&CasterId=LIVEPRODUCER_POST-cn-0pp1czt****
&ResourceType=vod
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddShowIntoShowListResponse>
    <RequestId>987DA143-A39C-5B5D-AF5B-3B07944A0036</RequestId>
    <failedList>
        <show>
            <resourceUrl>test</resourceUrl>
            <resourceType>vod</resourceType>
        </show>
        <failInfo>ResourceUrl is invalid, probe failed</failInfo>
    </failedList>
    <failedList>
        <show>
            <resourceUrl>http://error.test.case</resourceUrl>
            <resourceType>vod</resourceType>
        </show>
        <failInfo>ResourceUrl is invalid, probe failed</failInfo>
    </failedList>
    <successfulShowIds>f1933f16-5467-4308-b3a9-e8d451a90999, 547436b8-c839-4469-a2c0-704c1ce5ce00</successfulShowIds>
</AddShowIntoShowListResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "987DA143-A39C-5B5D-AF5B-3B07944A0036",
  "failedList" : [ {
    "show" : {
      "resourceUrl" : "test",
      "resourceType" : "vod"
    },
    "failInfo" : "ResourceUrl is invalid, probe failed"
  }, {
    "show" : {
      "resourceUrl" : "http://error.test.case",
      "resourceType" : "vod"
    },
    "failInfo" : "ResourceUrl is invalid, probe failed"
  } ],
  "successfulShowIds" : "f1933f16-5467-4308-b3a9-e8d451a90999, 547436b8-c839-4469-a2c0-704c1ce5ce00"
}

Error codes

For a list of error codes, see Service error codes.

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