All Products
Search
Document Center

:CreateLiveStreamRecordIndexFiles

Last Updated:Mar 11, 2024

Creates an M3U8 index file for a recording in a specified time range.

Usage notes

You must have configured Object Storage Service (OSS) before you call this operation. For more information, see Configure OSS.

ApsaraVideo Live allows you to record a live stream in the M3U8 format and store the M3U8 file in OSS. You can edit the TS segments that are included in the stored M3U8 file in real time.

Note
  • You can create an index file only after a live stream is ingested. If no live stream is available within the specified time range or the name of the specified live stream is invalid, the index file fails to be created.
  • The time range that is specified by the StartTime and EndTime parameters must be the duration of at least one TS segment. The default duration of a TS segment is 30 seconds.
  • ApsaraVideo Live stores the information about TS segments for only three months. You can create M3U8 index files only for the recordings of the last three months.
  • OSS stores TS segments for a time period that is specified by the storage configuration in OSS. For more information, see Configure lifecycle rules.
  • ApsaraVideo Live stores the information about M3U8 index files for only six months. You can query only the information about the M3U8 index files that are created in the last six months.
  • OSS stores M3U8 index files for a time period that is specified by the storage configuration in OSS.

QPS limit

You can call this operation up to 45 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 CreateLiveStreamRecordIndexFiles

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

DomainName String Yes example.com

The main streaming domain.

AppName String Yes liveApp****

The name of the application to which the live stream belongs.

StreamName String Yes liveStream****

The name of the live stream.

OssEndpoint String Yes cn-oss-****.aliyuncs.com

The endpoint of the OSS bucket.

OssBucket String Yes liveBucket****

The name of the OSS bucket.

OssObject String Yes {AppName}/{StreamName}/{Date}/{Hour}/{Minute}_{Second}.m3u8

The name of the recording that is stored in OSS.

StartTime String Yes 2017-12-21T08:00:00Z

The start time of the index file. TS segments that are uploaded after the start time are included in the index file. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

EndTime String Yes 2017-12-22T08:00:00Z

The end time of the index file. TS segments that are uploaded before the end time are included in the index file. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

EndTimeIncluded Boolean No false

Specifies whether to include the end time. If you set this parameter to true, the system attempts to include one more TS segment. The created index file covers the entire time range that is specified by the StartTime and EndTime parameters.

Response parameters

Parameter

Type

Example

Description

RequestId String 550439A3-F8EC-4CA2-BB62-B9DB43EEEF30

The request ID.

RecordInfo Object

The recording configuration.

RecordUrl String http://*****/atestObject.m3u8

The URL of the index file.

StreamName String liveStream****

The name of the live stream.

CreateTime String 2016-05-27T09:40:56Z

The time when the index file was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

RecordId String c4d7f0a4-b506-43f9-8de3-07732c3f****

The ID of the index file.

Height Integer 480

The height of the video.

OssBucket String liveBucket****

The name of the OSS bucket.

DomainName String example.com

The main streaming domain.

OssObject String liveObject****.m3u8

The name of the recording that is stored in OSS.

EndTime String 2015-12-01T07:40:00Z

The end time of the index file. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

AppName String liveApp****

The name of the application to which the live stream belongs.

StartTime String 2015-12-01T07:36:00Z

The start time of the index file. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Width Integer 640

The width of the video.

Duration Float 20

The recording length. Unit: seconds.

OssEndpoint String cn-oss-****.aliyuncs.com

The endpoint of the OSS bucket.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateLiveStreamRecordIndexFiles
&DomainName=example.com
&AppName=liveApp****
&StreamName=liveStream****
&OssEndpoint=cn-oss-****.aliyuncs.com
&OssBucket=liveBucket****
&OssObject={AppName}/{StreamName}/{Date}/{Hour}/{Minute}_{Second}.m3u8
&StartTime=2017-12-21T08:00:00Z
&EndTime=2017-12-22T08:00:00Z
&EndTimeIncluded=false
&<Common request parameters>

Sample success responses

XML format

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

<CreateLiveStreamRecordIndexFilesResponse>
    <RequestId>550439A3-F8EC-4CA2-BB62-B9DB43EEEF30</RequestId>
    <RecordInfo>
        <EndTime>2015-12-01T07:40:00Z</EndTime>
        <DomainName>example.com</DomainName>
        <CreateTime>2016-05-27T09:40:56Z</CreateTime>
        <StartTime>2015-12-01T07:36:00Z</StartTime>
        <OssBucket>liveBucket****</OssBucket>
        <Duration>20</Duration>
        <AppName>liveApp****</AppName>
        <StreamName>liveStream****</StreamName>
        <OssEndpoint>cn-oss-****.aliyuncs.com</OssEndpoint>
        <RecordUrl>http://*****/atestObject.m3u8</RecordUrl>
        <OssObject>liveObject****.m3u8</OssObject>
        <Height>480</Height>
        <RecordId>c4d7f0a4-b506-43f9-8de3-07732c3f****</RecordId>
        <Width>640</Width>
    </RecordInfo>
</CreateLiveStreamRecordIndexFilesResponse>

JSON format

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

{
  "CreateLiveStreamRecordIndexFilesResponse" : {
    "RequestId" : "550439A3-F8EC-4CA2-BB62-B9DB43EEEF30",
    "RecordInfo" : {
      "EndTime" : "2015-12-01T07:40:00Z",
      "DomainName" : "example.com",
      "CreateTime" : "2016-05-27T09:40:56Z",
      "StartTime" : "2015-12-01T07:36:00Z",
      "OssBucket" : "liveBucket****",
      "Duration" : 20,
      "AppName" : "liveApp****",
      "StreamName" : "liveStream****",
      "OssEndpoint" : "cn-oss-****.aliyuncs.com",
      "RecordUrl" : "http://*****/atestObject.m3u8",
      "OssObject" : "liveObject****.m3u8",
      "Height" : 480,
      "RecordId" : "c4d7f0a4-b506-43f9-8de3-07732c3f****",
      "Width" : 640
    }
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidStartTime.Malformed Specified StartTime is malformed. The format of the start time is invalid. Check whether the value of the StartTime parameter is valid.
400 InvalidEndTime.Malformed Specified EndTime is malformed. The format of the end time is invalid. Check whether the value of the EndTime parameter is valid.
400 InvalidEndTime.Mismatch Specified end time does not math the specified start time. The end time does not match the start time. Check whether the value of the EndTime parameter matches.
400 InvalidOssBucket.Malformed Specified OssBucket is malformed. The OSS bucket is invalid. Check whether the value of the OssBucket parameter is valid.
400 InvalidOssObject.Malformed Specified OssObject is malformed. The OSS object is invalid. Check whether the value of the OssObject parameter is valid.
400 InvalidStream.NotFound Speicified stream does not exist. The live stream does not exist. Check whether the value of the StreamName parameter is valid.
400 InvalidConfig.Changed The oss bucket info between StartTime and EndTime has changed. The time range that is specified by the StartTime and EndTime parameters for the OSS bucket changed.
400 NoRecordContent The record content between StartTime and EndTime is empty. No recordings exist in the time range that is specified by the StartTime and EndTime parameters.

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