Streams API
In the Astra interface, you can manage Stream configurations and control their status using HTTP API methods.
Configurable parameters are similar to those used in the Astra interface configuration, you can read more on the relevant articles about configuring these parameters. Read more
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.
Version: 2021-04-12 or later
Request: GET /api/stream-info/{id}
id - unique stream identifier
In response will be JSON with stream configuration
Request: POST /control/
id - unique stream identifier
stream - stream configuration
Turn stream on/off. Request: POST /control/
id - unique stream identifier
Request: POST /control/
id - unique stream identifier
Choose active input. Works only for streams with next backup types: passive or disable. Request: POST /control/
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/
id - unique stream identifier
Version: 2021-04-12 or later
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 - 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;
sc_error - percent of scrambled TS-packets;
cc_error - CC errors counter;
pes_error - percent of invalid PES-packets packets.
Configurable parameters are similar to those used in the Astra interface configuration, you can read more on the relevant articles about configuring these parameters. Read more
Stream configuration
{
"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.
Obtain Stream configuration
Version: 2021-04-12 or later
Request: GET /api/stream-info/{id}
id - unique stream identifier
In response will be JSON with stream configuration
Modify Stream configuration
Request: POST /control/
{
"id": "...",
"cmd": "set-stream",
"stream": { ... }
}
id - unique stream identifier
stream - stream configuration
Toggle Stream
Turn stream on/off. Request: POST /control/
{
"cmd": "toggle-stream",
"id": "..."
}
id - unique stream identifier
Restart Stream
Request: POST /control/
{
"cmd": "restart-stream",
"id": "..."
}
id - unique stream identifier
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 identifier
input – input number. Numbering starts from 1. If option not defined will be started next input after the active input
Remove Stream
Request: POST /control/
{
"cmd": "set-stream",
"id": "...",
"stream": {
"remove": true
}
}
id - unique stream identifier
Obtain Stream Status
Version: 2021-04-12 or later
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,
"sc_error": 0,
"cc_error": 0,
"pes_error": 0
}
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;
sc_error - percent of scrambled TS-packets;
cc_error - CC errors counter;
pes_error - percent of invalid PES-packets packets.
Updated on: 17/04/2023
Thank you!