Live stream recording callbacks
Updated at:
Copy as MD
Configure callbacks to receive notifications when live stream recordings start, stop, or generate files.
Configuration methods
Configure recording callbacks in the ApsaraVideo Live console or by calling an API operation.
- For more information about how to configure callbacks for live stream recording in the ApsaraVideo Live console, see Configure recording callbacks.
- For more information about how to configure callbacks for live stream recording by calling an API operation, see AddLiveRecordNotifyConfig.
Sample callbacks
Recording callbacks include two types:
- Recording status callbacks: sent when recording starts or ends.
- Recording generation callbacks: sent when a recording file is generated. Contains the file name, start time, end time, and duration.
Callback content is sent as JSON in the body of an HTTP POST request to the URL specified by the NotifyUrl parameter. Parse the request body to retrieve the callback content.
-
Recording status callbacks
NoteTo enable recording status callbacks, set the NeedStatusNotify parameter to true when calling the API.
NeedStatusNotify is a request parameter of the AddLiveRecordNotifyConfig operation that enables or disables recording status callbacks.
Table 1. Parameters Parameter Description domain Streaming domain. app Application name. stream Live stream name. event Event name. Valid values: - record_started: Recording started.
- record_paused: Recording paused.
- record_resumed: Recording resumed.
Sample callback when recording starts:{ "domain": "gs_domain", "app": "gs_app", "stream": "gs_stream", "event": "record_started" } -
Recording generation callbacks
Table 2. Parameters Parameter Description domain Streaming domain. app Application name. stream Live stream name. uri Storage path of the recording in the specified Object Storage Service (OSS) bucket. duration Recording duration, in seconds. start_time Recording start time as a UNIX timestamp, in seconds. stop_time Recording end time as a UNIX timestamp, in seconds. push_args Stream ingest parameters prefixed with callback_, such as callback_arg1 and callback_myid. Note- This sample applies when no custom callback templates are configured.
- Each parameter accepts only one value. If multiple values are passed, only the first is returned. For example, if you pass value1 and then value2 to
callback_args1, the callback returns only"callback_args1": "value1".
Sample callback when a recording is generated:{ "domain": "demo.aliyundoc.com", "app": "liveApp****", "stream": "liveStream****", "uri": "liveApp****/liveStream****/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" } }
References
For more information, see Event callback.
Is this page helpful?