All Products
Search
Document Center

ApsaraVideo Live:Retrieval and management of recording files

Last Updated:Mar 26, 2024

This topic describes the scenarios, procedure, example practices, and usage notes of recording file retrieval.

Scenarios

You can perform the following operations on recording files:

  • Configure a callback to receive an HTTP request whenever a recording file is generated. You can process the recording file in real time based on your business requirements.

  • Query the recording content. The time periods during which a live stream is recorded are displayed along a timeline.

  • Generate an M3U8 index file based on the recorded Transport Stream (TS) segments for a specified time period and store the recording file in the bucket that you specify. You can directly play the recording file.

Usage notes

Call the corresponding API operation to retrieve and manage recording files. The following table lists the API operations used for retrieval and management of recording files.

API operation

Description

AddLiveRecordNotifyConfig

Configures the recording callbacks for a domain name, including event callbacks and callbacks of on-demand recording.

DeleteLiveRecordNotifyConfig

Deletes the recording callback configuration that is no longer needed for a domain name.

DescribeLiveRecordNotifyConfig

Queries the recording callback configuration for a domain name.

UpdateLiveRecordNotifyConfig

Updates the recording callback configuration for a domain name.

Callbacks of live stream recording

Defines the HTTP message that is sent upon a recording event callback.

DescribeLiveStreamRecordContent

Queries the time periods during which a live stream is recorded.

CreateLiveStreamRecordIndexFiles

Creates an M3U8 index file for a specified time period.

DescribeLiveStreamRecordIndexFiles

Queries the M3U8 index files in a specified time period.

DescribeLiveStreamRecordIndexFile

Queries information about an M3U8 index file.

Example practices

  • Configure a callback for recording file generation

    Call the AddLiveRecordNotifyConfig operation to configure ApsaraVideo Live to send a callback to http://example.aliyundoc.com each time a recording file under the domain name aliyundoc.com is generated.

    /?DomainName=aliyundoc.com
    &NotifyUrl=http://example.aliyundoc.com
    &<Common request parameters>

    After the configuration is complete, you receive a callback that is similar to the following example when a TS, MP4, or FLV recording is generated from the live stream aliyundoc.com/live/teststream:

    POST / HTTP/1.1
    Host: live.example.com
    User-Agent: Go-http-client/1.1
    
    {
      "domain": "aliyundoc.com",
      "app": "live",
      "stream": "teststream",
      "uri": "live/teststream/0_2017-03-08-23:09:46_2017-03-08-23:10:40.flv",
      "duration": 69.403,
      "start_time": 1488985786,
      "stop_time": 1488985840
    }
  • Query the time periods during which a live stream is recorded

    Assume that you want to query the recording content of the live stream aliyundoc.com/live/teststream from 2019-02-15 09:00:00 to 2019-02-15 21:00:00. Call the DescribeLiveStreamRecordContent operation with the following parameters:

    /?AppName=live
    &DomainName=aliyundoc.com
    &StreamName=teststream
    &StartTime=2019-02-15T01:00:00Z
    &EndTime=2019-02-15T13:00:00Z
    &<Common request parameters>
  • Generate an M3U8 index file for a specified time period

    Assume that you recorded a live stream from 2019-02-15 09:00:00 to 2019-02-15 21:00:00. If you want to generate an M3U8 index file for the recording content from 10:00 to 11:00, call the CreateLiveStreamRecordIndexFiles operation with the following parameters:

    /?AppName=live
    &DomainName=aliyundoc.com
    &StreamName=teststream
    &StartTime=2019-02-15T02:00:00Z
    &EndTime=2019-02-15T03:00:00Z
    &<Common request parameters>

    The generated M3U8 playlist is uploaded to the OSS bucket that you specify. You can call the AddLiveAppRecordConfig operation to change the storage path.

Usage notes

  • The values of the StartTime and EndTime parameters are in UTC. Remember to convert your local time to UTC.

  • The retrieval information of recording files is stored in ApsaraVideo Live for only 6 months and then deleted. However, the recording files are retained.

  • TS segments are stored in ApsaraVideo Live for only 3 months. Therefore, you can select recording files that are generated only within the last 3 months when you create an M3U8 playlist. After the TS segments expire, the retrieval information is deleted, but the TS segments are retained.