Skip to content

Streams API

In the Astra interface, you can manage Stream configurations and control their status using HTTP API methods.

{
"id": "...",
"name": "...",
"type": "...",
"enable": true,
"input": [
""
]
}
  • name - stream name
  • type - stream type spts or mpts
  • enable - true if stream is enabled
  • input - list of the stream inputs
  • other options depends of the stream configuration.

Request: GET /api/stream-info/{id}

  • id - unique stream identifier

In response will be JSON with stream configuration

Request: POST /control/

{
"id": "...",
"cmd": "set-stream",
"stream": { ... }
}
  • id - unique stream identifier
  • stream - stream configuration

Turn stream on/off. Request: POST /control/

{
"cmd": "toggle-stream",
"id": "..."
}
  • id - unique stream identifier

Request: POST /control/

{
"cmd": "restart-stream",
"id": "..."
}
  • id - unique stream identifier

Choose active input. Works only for streams with next backup types: passive or disable. Request: POST /control/

{
"cmd": "set-stream-input",
"id": "...",
"input": "..."
}
  • id - unique stream identifier
  • input – input number. Numbering starts from 1. If option not defined will be started next input after the active input

Request: POST /control/

{
"cmd": "set-stream",
"id": "...",
"stream": {
"remove": true
}
}
  • id - unique stream identifier

Request: GET /api/stream-status/{id}

  • id - unique stream identifier

Optional query parameters: GET /api/stream-status/{id}?t={time}

  • time - default is 1 - statistics for last minute. 0 - statistics for last second (current stream status).

Response:

{
"timestamp": 0,
"instance": "...",
"name": "...",
"input_id": 1,
"active": true,
"onair": true,
"sessions": 0,
"bitrate": 0,
"packets": 0,
"pes_error": 0,
"sc_error": 0,
"cc_error": 0,
"video_count": 1,
"audio_count": 1
}
  • timestamp - report time, for t=0 is a current time
  • instance - instance name if defined in the Settings → General → Instance Name
  • name - stream name
  • input_id - active input identifier. for example if primary works fine will be 1. if stream switched to the backup input will be number of this input
  • active - true if stream is active, or false if stream work on demand and inactive
  • onair - true if active input works without errors
  • sessions - number of active sessions on the stream
  • bitrate - stream bitrate in Kbit/s
  • pes_error - number of invalid PES-packets packets
  • sc_error - number of scrambled TS-packets. If stream is protected with Conditional Access System (CAS) then sc_error and pes_error will be greater than 0. If stream descrambled with invalid key then sc_error will be equal to 0 and pes_error will be greater than 0
  • cc_error - CC errors counter. CC error can be caused by packets loss or excess
  • video_count - number of video streams
  • audio_count - number of audio streams