ApsaraVideo Live allows you to configure recording event callbacks by using the console or by calling the AddLiveRecordNotifyConfig operation. This topic describes the format of recording event callbacks and provides examples of these callbacks.

Callbacks for the generation of recordings

The following sample callback notification indicates that the specified recording was generated:
{
  "domain": "qt01.alivecdn.com",
  "app": "mp4flvtest_flv",
  "stream": "callback_test",
  "uri": "mp4flvtest_flv/callback_test/0_2017-03-08-23:09:46_2017-03-08-23:10:40.flv",
  "duration": 69.403,
  "start_time": 1488985786,
  "stop_time": 1488985840,
  "push_args": {
    "callback_args1": "value1",
    "callback_myid": "1231389741"
  }
}
                

In the preceding code, the domain, app, and stream parameters indicate the main streaming domain, application, and stream that are used to generate the recording. The uri parameter indicates the path in the Object Storage Service (OSS) bucket where the recording is stored. The duration, start_time, and stop_time parameters indicate the length of the recording, the time when the system started the recording operation, and the time when the system stopped the recording operation, in seconds. The push_args parameter contains all stream ingest parameters that are prefixed with callback_.

Note
  • The preceding sample callback notification is applicable if you have no custom callback templates.
  • Each parameter supports only one value. If you pass multiple values to a parameter, the callback returns only the first value that is passed to the parameter. For example, if you pass value1 and then value2 to the callback_args1 parameter, the callback returns only "callback_args1": "value1".

Callbacks for recording status (with the NeedStatusNotify parameter set to true)

The NeedStatusNotify parameter is an input parameter of the AddLiveRecordNotifyConfig operation. This parameter specifies whether to enable callbacks for recording status.

  1. The following sample callback notification indicates that the system started the recording operation:
    {
    "domain": "gs_domain",
    "app": "gs_app",
    "stream": "gs_stream",
    "event": "record_started"
    }
                        

    In the preceding code, the domain, app, and stream parameters indicate the main streaming domain, application, and stream that are used to generate the recording. The event parameter indicates the event name, which may be record_started, record_paused, or record_resumed.

  2. The following sample callback notification indicates that the system paused the recording operation:
    {
    "domain": "gs_domain",
    "app": "gs_app",
    "stream": "gs_stream",
    "event": "record_paused"
    }
                        
  3. The following sample callback notification indicates that the system resumed the recording operation:
    {
    "domain": "gs_domain",
    "app": "gs_app",
    "stream": "gs_stream",
    "event": "record_resumed"
    }