Creates a scheduled task to start and stop the playback of a playlist at the specified points in time.

Usage notes

You can call this operation to create a scheduled task to start and stop the playback of a playlist at the specified points in time. Make sure that the parameter settings are valid for calling this operation.

QPS limit

You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limit on an API operation in ApsaraVideo Live.

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 InitializeAutoShowListTask

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

CasterConfig String Yes {"CasterTemplate": "lp_ld","LiveTemplates":["lhd", "lsd","lud"]}

The configurations of the streaming panel. The following fields are involved:

  • CasterTemplate: required. The output resolution of the streaming panel.
  • LiveTemplate: optional. The templates to be used for transcoding.
Note Set the value to a JSON string. Use upper camel case for fields of the string.
DomainName String Yes example.aliyundoc.com

The output streaming domain.

EndTime Long Yes 1645688994000

The end timestamp of the playback. Unit: milliseconds.

ResourceIds String Yes ["89e02xxxxfb349axxxxa0c350d**** ","6ae0xxxxxb349axxxxa0c350a****"]

The IDs of on-demand media asset files in the playlist. Only on-demand video files are supported.

You can specify up to three video files in the playlist. The video files in the playlist are automatically played in sequence. The playback stops at the point in time specified by the EndTime parameter.

Note
  • You can obtain the ID of a video file in the ApsaraVideo Live console or by calling an API operation. For more information, see Media asset management or CreateUploadVideo.
  • If all video files in the playlist are played before the specified end time of the playback, the last frame of the last video file is displayed until the playback ends.
StartTime Long Yes 1645688994000

The start timestamp of the playback. Unit: milliseconds.

CallbackUrl String No http://***.com/callback

The callback URL.

Response parameters

Parameter Type Example Description
CasterId String b4810848-bcf9-4aef-bd4a-e6bba2d9****

The ID of the streaming panel.

Note You can specify the ID of a streaming panel in a request to query the streaming URLs of the streaming panel, start the streaming panel, add a video resource, a layout, a component, or a playlist to the streaming panel, or query a layout of the streaming panel.
RequestId String 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

The ID of the request.

StreamList String [{"videoFormat":"flv","outputStreamUrl":"http://example.aliyundoc.com","transcodeConfig":"original"}]

The list of output video streams.

  • videoFormat: the format of the streaming URL.
  • outputStreamUrl: the source URL.
  • transcodeConfig: the output resolution specified for video transcoding of the source URL.

Examples

Sample requests

http(s)://live.aliyuncs.com/?Action=InitializeAutoShowListTask
&CasterConfig={"CasterTemplate": "lp_ld","LiveTemplates":["lhd", "lsd","lud"]}
&DomainName=example.aliyundoc.com
&EndTime=1645688994000
&ResourceIds=["89e02xxxxfb349axxxxa0c350d****  ","6ae0xxxxxb349axxxxa0c350a****"]
&StartTime=1645688994000
&<Common request parameters>

Sample responses

XML format

<InitializeAutoShowListTaskResponse>
  <RequestId>9F6448C9-6F92-1BAC-AFDD-C308782A6573</RequestId>
  <StreamList>
        <videoFormat>flv</videoFormat>
        <outputStreamUrl>http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****.flv</outputStreamUrl>
        <transcodeConfig>original</transcodeConfig>
  </StreamList>
  <CasterId>6277b6a3-1a40-4063-85f7-145666e3****</CasterId>
</InitializeAutoShowListTaskResponse>

JSON format

{
    "RequestId": "9F6448C9-6F92-1BAC-AFDD-C308782A6573",
    "StreamList": [
        {
            "videoFormat": "flv",
            "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****.flv",
            "transcodeConfig": "original"
        }
    ],
    "CasterId": "6277b6a3-1a40-4063-85f7-145666e3****"
}

Error codes

For a list of error codes, visit the API Error Center.

Sample code


    public void InitializeAutoShowListTask() throws ClientException {
        CommonRequest initializeAutoShowListTaskRequest = new CommonRequest()
        initializeAutoShowListTaskRequest.setAction("InitializeAutoShowListTask");
        initializeAutoShowListTaskRequest.setDomain("live.aliyuncs.com");
        initializeAutoShowListTaskRequest.setVersion("2016-11-01");
        JSONArray resourceIds = new JSONArray();
        resourceIds.add("xxx1");
        initializeAutoShowListTaskRequest.putQueryParameter("ResourceIds", resourceIds.toJSONString());
        long currentTimeMillis = System.currentTimeMillis();
        // The playback of the playlist starts in 30 seconds and continues for 1 minute.
        long startTime = currentTimeMillis + 30 * 1000;
        long endTime = startTime + 1 * 60 * 1000;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // Convert a timestamp into a datetime object.
        String start = sdf.format(new Date(Long.parseLong(String.valueOf(startTime)))); 
        // Convert a timestamp into a datetime object.
        String end = sdf.format(new Date(Long.parseLong(String.valueOf(endTime)))); 
        System.out.printf("Formatted result: start %s end %s\n", start, end);
        initializeAutoShowListTaskRequest.putQueryParameter("StartTime", String.valueOf(startTime));
        initializeAutoShowListTaskRequest.putQueryParameter("EndTime", String.valueOf(endTime));
        JSONObject casterConfig = new JSONObject();
        casterConfig.put("CasterTemplate", "lp_hd");
        JSONArray liveTemplate = new JSONArray();
        liveTemplate.add("lhd");
        liveTemplate.add("lsd");
        casterConfig.put("LiveTemplate", liveTemplate);
        initializeAutoShowListTaskRequest.putQueryParameter("CasterConfig", casterConfig.toJSONString());
        initializeAutoShowListTaskRequest.putQueryParameter("DomainName", "testdomainplay.alivecdn.com");
        DefaultAcsClient client = initClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET);
        CommonResponse commonResponse = client.getCommonResponse(initializeAutoShowListTaskRequest);
        System.out.printf("Status is %s and Response is:\n", commonResponse.getHttpStatus());
        JSONObject jsonObject = JSON.parseObject(commonResponse.getData());
        System.out.println(JSON.toJSONString(jsonObject, true));
    }
            

Sample response in the JSON format


{
  "RequestId": "9F6448C9-6F92-1BAC-AFDD-C308782A6573",
  "StreamList": [
    {
      "videoFormat": "flv",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****.flv",
      "transcodeConfig": "original"
    },
    {
      "videoFormat": "rtmp",
      "outputStreamUrl": "rtmp://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****",
      "transcodeConfig": "original"
    },
    {
      "videoFormat": "m3u8",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****.m3u8",
      "transcodeConfig": "original"
    },
    {
      "videoFormat": "flv",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lhd.flv",
      "transcodeConfig": "lhd"
    },
    {
      "videoFormat": "rtmp",
      "outputStreamUrl": "rtmp://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lhd",
      "transcodeConfig": "lhd"
    },
    {
      "videoFormat": "m3u8",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lhd.m3u8",
      "transcodeConfig": "lhd"
    },
    {
      "videoFormat": "flv",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lsd.flv",
      "transcodeConfig": "lsd"
    },
    {
      "videoFormat": "rtmp",
      "outputStreamUrl": "rtmp://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lsd",
      "transcodeConfig": "lsd"
    },
    {
      "videoFormat": "m3u8",
      "outputStreamUrl": "http://example.aliyundoc.com/caster/2967b3b2b52242019c277de2a11a****_lsd.m3u8",
      "transcodeConfig": "lsd"
    }
  ],
  "CasterId": "6277b6a3-1a40-4063-85f7-145666e3****"
}