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 nametype
- stream type spts
or mpts
enable
- true
if stream is enabledinput
- list of the stream inputsRequest: GET /api/stream-info/{id}
id
- unique stream identifierIn response will be JSON with stream configuration
Request: POST /control/
{
"id": "...",
"cmd": "set-stream",
"stream": { ... }
}
id
- unique stream identifierstream
- stream configurationTurn stream on/off. Request: POST /control/
{
"cmd": "toggle-stream",
"id": "..."
}
id
- unique stream identifiercurl \
-X POST \
-user login \
-d '{"cmd":"toggle-stream", "id":"a001"}' \
http://server:8000/control/
on successful Astra returns:{ "toggle-stream": "ok" }
Request: POST /control/
{
"cmd": "restart-stream",
"id": "..."
}
id
- unique stream identifiercurl \
-X POST \
-user login \
-d '{"cmd":"restart-stream", "id":"a001"}' \
http://server:8000/control/
on successful Astra returns:{ "restart-stream": "ok" }
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 inputcurl \
-X POST \
-user login \
-d '{"cmd":"set-stream-input", "id":"a001", "input": 2}' \
http://server:8000/control/
on successful Astra returns:{ "set-stream-input": "ok" }
Request: POST /control/
{
"cmd": "set-stream",
"id": "...",
"stream": {
"remove": true
}
}
id
- unique stream identifierRequest: GET /api/stream-status/{id}
id
- unique stream identifierOptional 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 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
- true
if stream is active, or false
if stream work on demand and inactiveonair
- true
if 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) 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 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