All Products
Search
Document Center

On-demand recording

Last Updated: Aug 14, 2018

Description

After you complete recording configuration, you can choose whether to record videos on demand.

Currently, you can record videos on demand in two ways:

  • Streaming parameters (Currently not support)

  • HTTP callback

    HTTP callback indicates that you specify a callback URL, and configure a domain-level, app-level or stream-level recording as on-demand recording. If recording service receives a live stream which matches the domain name, app name or stream name of the live stream you have configured, recording service sends a request (including 5 parameters) to your callback URL to request whether you want to record the stream.

Request parameters

Parameters Type Description
domain String Domain name.
app String The name of the App.
stream String The name of the stream.
codec String Coding method.
Value: h264, h265.
If the parameter is left blank, the default value is h264.
vbitrate String The biterate of the video.
Unit: Kbps.
For example, 2000 indicates 2M Kbps.

Response parameters

Parameters Type Required or not Description
ApiVersion String No API version.
Default value: Version 1.0.
NeedRecord Bool Yes Whether recording is required.
Interval Json Object No Recording cycle variation of a specific format.
Value range: 5-21600.
Unit: s.
Format Array No Recording format, support MP4, FLV and M3U8.

Example

Request example

  1. GET /?app=seq_all&domain=qt01.alivecdn.com&stream=ondemand8&vbitrate=2000&codec=h264 HTTP/1.1
  2. Host: live.abc.com
  3. User-Agent: Go-http-client/1.1
  4. Accept-Encoding: gzip

Response example

  1. {
  2. "ApiVersion" : "1.0",
  3. "NeedRecord" : true,
  4. "Interval" : {
  5. "Mp4": 300,
  6. "Flv": 120,
  7. "M3U8": 180
  8. },
  9. "Format" : ["mp4","flv"]
  10. }

Response parameters processing

Recording service overwrites parameters returned by user as well as existing parameters. For example, if you enter the Interval parameter, the Interval you configured overwrites the Interval of the recording configured in database. And for the Format, recording service adopts the intersection of the Format you configured and the Format configured in database. If the Format you specify is not within the existing configuration of the database, the live stream is not recorded.

Note:

  • All the http status codes that are not 200 are regarded as failure of invoking user interface.

  • The body length is restricted to 2048 characters. If the body length exceeds 2048 characters, the body is cut short to avoid vicious attacks.