Streams API
In the Astra interface, you can manage Stream configurations and control their status using HTTP API methods.
Stream configuration
Section titled “Stream configuration”{ "id": "...", "name": "...", "type": "...", "enable": true, "input": [ "" ]}name- stream nametype- stream typesptsormptsenable-trueif stream is enabledinput- list of the stream inputs- other options depends of the stream configuration.
Get Stream configuration
Section titled “Get Stream configuration”Request: GET /api/stream-info/{id}
id- unique stream identifier
In response will be JSON with stream configuration
Modify Stream configuration
Section titled “Modify Stream configuration”Request: POST /control/
{ "id": "...", "cmd": "set-stream", "stream": { ... }}id- unique stream identifierstream- stream configuration
Toggle Stream
Section titled “Toggle Stream”Turn stream on/off. Request: POST /control/
{ "cmd": "toggle-stream", "id": "..."}id- unique stream identifier
Restart Stream
Section titled “Restart Stream”Request: POST /control/
{ "cmd": "restart-stream", "id": "..."}id- unique stream identifier
Switch active input
Section titled “Switch active input”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 identifierinput– input number. Numbering starts from 1. If option not defined will be started next input after the active input
Delete Stream
Section titled “Delete Stream”Request: POST /control/
{ "cmd": "set-stream", "id": "...", "stream": { "remove": true }}id- unique stream identifier
Get Stream Status
Section titled “Get Stream Status”Request: GET /api/stream-status/{id}
id- unique stream identifier
Optional query parameters: GET /api/stream-status/{id}?t={time}
time- default is1- 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, fort=0is a current timeinstance- instance name if defined in the Settings → General → Instance Namename- stream nameinput_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 inputactive-trueif stream is active, orfalseif stream work on demand and inactiveonair-trueif active input works without errorssessions- number of active sessions on the streambitrate- stream bitrate in Kbit/spes_error- number of invalid PES-packets packetssc_error- number of scrambled TS-packets. If stream is protected with Conditional Access System (CAS) thensc_errorandpes_errorwill be greater than 0. If stream descrambled with invalid key thensc_errorwill be equal to 0 andpes_errorwill be greater than 0cc_error- CC errors counter. CC error can be caused by packets loss or excessvideo_count- number of video streamsaudio_count- number of audio streams