1. Home
  2. Docs
  3. HTTP API of Decoders
  4. 4 Streamer (stream service) module

4 Streamer (stream service) module

Gain the stream service publication point

API instruction

Gain the stream service publication point field

Request

  • Method: GET/POST
  • URL: streamer/list.json
  • Headers:
  • submit parameter: no

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "name": "1",
      "objPath": "/streamer/1",
      "id": "1"
    },
    {
      "name": "testpub1",
      "objPath": "/streamer/2",
      "id": "2"
    }
  ]
}
  • return instruction
field type instruction
id alphabetic string publication point ID
name alphabetic string publication point name
objPath alphabetic string publication point route

testing calling:

http://192.168.2.123/api/streamer/list.json

Increase pubilcation point

API instruction

increase pubilcation point

Request

  • Method: GET/POST
  • URL: streamer/add.json
  • Headers:
    -submit parameter:
field type instruction
name alphabetic string stream service publication point name(necessary parameter)

Response

  • Body
{    
"result": "ok"
}

test calling:

http://192.168.2.123/api/streamer/add.json?name=testpub1

Modify publication point name

API instruction

modify stream service publication point name

Request

  • Method: GET/POST
  • URL: streamer/modify.json
  • Headers:
  • submit parameter:
    | field | type | instruction |
    | —— | ——— | ——————————————— |
    | name | alphabetic string | stream service publication point name(necessary parameter) |
    | id | alphabetic string | stream service publication point ID(necessary parameter) |

Response

  • Body
{
  "result": "ok"
}

testing needed:

http://192.168.2.123/api/streamer/modify.json?name=testpub1&id=1

4.4 delete pubilcation point

API instruction

delete the related publication point

Request

  • Method: GET/POST
  • URL: streamer/remove.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)

Response

  • Body
{    "result": "ok"}

test needed:

http://192.168.2.123/api/streamer/remove.json?id=1

Gain the stream service publication point status

API instruction

gain the stream service publication point status

Request

  • Method: GET/POST
  • URL: streamer/status.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "streams": 2,
      "current_stream_name": "2377",
      "bitrate": 0,
      "total_br": "unknown",
      "current_stream": "MANUAL.7"
    }
  ]
}
  • return instruction
field type instruction
streams numerical value stream service quantity
current_stream_name alphabetic string The currently selected video stream name,for front end diaplay
current_stream alphabetic string The currently selected video stream ID,for API cooperation
bitrate numerical value current bit rate,Unit K bps
total_br alphabetic string total flow rate,not supported at the moment,default “unknown”

test calling:

http://192.168.2.123/api/streamer/status.json?id=1

Gain optional video source from the stream service publication point

API instruction

gain optional video source information from the stream service publication point,containing whether one of the video sources is selected。

Request

  • Method: GET/POST
  • URL: streamer/get_source.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "id": "MANUAL.7",
      "status": "reconnecting",
      "stream_start": true,
      "src": "srt-service:2377",
      "output_start": false,
      "live": "reconnecting",
      "bitrate": 0,
      "type": "srt",
      "name": "2377",
      "resolution": "[email protected]",
      "current": 0
    },
    {
      "id": "MANUAL.6",
      "status": "on",
      "stream_start": false,
      "src": "103.229.149.171",
      "output_start": false,
      "live": "closed",
      "bitrate": 1704,
      "type": "rtmp",
      "name": "rtmp-gopro",
      "resolution": "[email protected]",
      "current": 0
    }
  ]
}
  • return instruction
field type instruction
id alphabetic string video stream ID
name alphabetic string video stream name
status alphabetic string connect status
resolution alphabetic string video resolution
stream_start boolean value Whether to start the stream service or not,true:yes、false:no
src alphabetic string video stream source,for example:”103.229.149.171”
output_start boolean value whether to be displayed or not,true:shown、false:not shown
live alphabetic string connect status :”connected”、”reconnecting”、”closed”
bitrate numerical value current bit rate,unit K bps
type alphabetic string video streaming type:”rtmp”、”rtsp”、”srt”…
current numerical value whether the video stream is selected or not,1:selected、0:not selected

test calling:

http://192.168.2.123/api/streamer/get_source.json?id=1

Gain stream service publication point information

API instruction

gain the informatin confugured by the stream service pubilcation point

Request

  • Method: GET/POST
  • URL: streamer/list_stream.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "enable": 0,
      "stream_id": 1,
      "status": "stopped",
      "error_reason": "",
      "address": "",
      "type": "rtsp"
    },
    {
      "enable": 1,
      "stream_id": 2,
      "status": "started",
      "error_reason": "",
      "address": "rtmp://192.168.0.1/live/test",
      "type": "rtmp"
    }
  ]
}
  • return instruction
field type instruction
stream_id numerical value streaming servce ID
enable numerical value stream service startup configuration
status alphabetic string stream service working status,state range:”started”、”stopped”、”error”
error_reason alphabetic string abnormal reason,status”error”,This field returns with abnormal reason
address alphabetic string stream service address
type alphabetic string stream service type,”rtmp”、”rtsp”、”srt”…

test calling:

http://192.168.2.123/api/streamer/list_stream.json?id=2

Reset stream service publication point

API instruction

reset all stream service from the publication point,and call the ralated interface if there is an abnormal working status。

Request

  • Method: GET/POST
  • URL: streamer/reset.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)

Response

  • Body
{    "result": "ok"}

test needed:

http://192.168.2.123/api/streamer/reset.json?id=1

4.9 configure on the choice of video source

API instruction

onfigure the video source from the ralated pubilcation point

Request

  • Method: GET/POST
  • URL: streamer/select_source.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)
source_id alphabetic string video source ID(necessary paremeter),state range from the interface 4.6

Response

  • Body
{
    "result": "ok"
}

test calling:

http://192.168.2.123/api/streamer/select_source.json?id=2&source_id=MANUAL.6

Increase stream service

API instruction

increase stream service under the realted publication point

Request

  • Method: GET/POST
  • URL: streamer/add_stream.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)
type alphabetic string stream sertive type(necessary parameter),state range:”rtsp”、”rtmp”、”srt” …
address alphabetic string stream service address
enable alphabetic string whether on or not
service_port alphabetic string service port(need to configure from the service port if the type is )
user alphabetic string user parameter needed why RTMP pushing
password alphabetic string key needed why RTMP pushing

Response

  • Body
{
  "result": "ok"
}

note:There is only one RTSP service for one publication point, and it returns when the RTSP service is added for multiple times:

{
  "result": "error",
  "msg": "1408"
}

test calling :

http://192.168.2.123/api/streamer/add_stream.json?type=rtmp&address=&enable=0&password=&service_port=0&user=&id=2

Delete stream vervice

API instruction

delete stream service

Request

  • Method: GET/POST
  • URL: streamer/delete_stream.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)
stream_id alphabetic string stream service id(necessary parameter),state range is from interface 4.7

Response

  • Body
{
  "result": "ok"
}

test calling:

http://192.168.2.123/api/streamer/delete_stream.json?id=2&stream_id=2

Gain the stream service configuration

API instruction

gain the stream service configuration

Request

  • Method: GET/POST
  • URL: streamer/get_stream_config.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)
stream_id alphabetic string stream service id(necessary parameter),state range is from the interface 4.7

Response

  • Body

rtspexample of stream service return:

{
  "result": "ok",
  "data": [
    {
      "enable": true,
      "audio_port": 0,
      "user": "",
      "auth": false,
      "password": "",
      "address": "test",
      "multicast_address": "",
      "multicast_ttl": 127,
      "alter_port": 0,
      "type": "rtsp",
      "service_port": 554,
      "multicast": false,
      "video_port": 0
    }
  ]
}

rtmpexample of stream service return:

{
  "result": "ok",
  "data": [
    {
      "enable": false,
      "audio_port": 0,
      "user": "",
      "auth": false,
      "password": "",
      "address": "rtmp://192.168.3.11/live/test",
      "multicast_address": "",
      "multicast_ttl": 127,
      "alter_port": 0,
      "type": "rtmp",
      "service_port": 0,
      "multicast": false,
      "video_port": 0
    }
  ]
}

srtexample of stream service return:

{
  "result": "ok",
  "data": [
    {
      "multicast": false,
      "audio_port": 0,
      "passphrase": "1235435643654",
      "auth": false,
      "bandwidth": "25",
      "service_port": 0,
      "connectionMode": "Caller",
      "listenerPort": "1",
      "payloadSize": "1316",
      "user": "",
      "multicast_address": "",
      "multicast_ttl": 127,
      "latency": "100",
      "address": "srt://192.168.0.55:6161",
      "encryption": "AES-128",
      "password": "",
      "alter_port": 0,
      "type": "srt",
      "enable": true,
      "name": "srt1",
      "video_port": 0
    }
  ]
}
  • return instrucation
field type instruction
enable boolean value whether on or not,true:on、false:off
type alphabetic string stream service type,value:”rtsp”、”rtmp”、”srt”
address alphabetic string stream service address rtsp:publication point rtmp:rtmp address,for example:”rtmp://192.168.3.11/live/test” srt:srt address format,for example:”srt://192.168.0.55:6161”
service_port numerical value rtsp stream service port,default 554,rtsp effective ,其它类型时值为 0
user alphabetic string user name,default null alphabetic string:””
password alphabetic string stream service password,default null alphabetic string:””
multicast_address alphabetic string multicast address,default null alphabetic string:””,unused
multicast_ttl numerical value multicast ttl,default127,unused
alter_port numerical value alter_port,default 0,unused
video_port numerical value video port ,default 0,unused
audio_port numerical value audio port ,default 0,unused
auth boolean value authorized or not,default”false”,unused
connectionMode alphabetic string SRT shake mode,value range:”Caller” or “Rendezvous”
listenerPort alphabetic string SRT listen port,available when connectionMode is”Rendezvous”
latency alphabetic string SRT transmission delay,unite is ms,value range:(0~5000)
encryption alphabetic string SRTEncryMode,state range:”none”、”AES-128”、”AES-192”、”AES-256”
passphrase alphabetic string SRT encryption key,state range:10~16 characters
bandwidth alphabetic string SRT Bandwidth cost,state range:(5%~100%)
payloadSize alphabetic string SRT load ability,state range:(0~1456)

test calling:

http://192.168.2.123/api/streamer/get_stream_config.json?id=2&stream_id=6

Configure the stream service information

API instruction

configure the stream service information

Request

  • Method: GET/POST
  • URL: streamer/set_stream_config.json
  • Headers:
  • submiet parameter:
field type instruction
id alphabetic string stream service publication pointID(necessary parameter)
stream_id alphabetic string stream service id(necessary parameter),state range from interface 4.7
enable alphabetic string on/off stream service,”1”on “0”off
other parameters of stream service alphabetic string Reference Data Interface 4.12

Response

  • Body
{
  "result": "ok"
}

test calling:

http://192.168.2.123/api/streamer/set_stream_config.json?name=srt1&enable=1&connectionMode=Rendezvous&address=srt://192.168.0.55:6161&listenerPort=1111&latency=100&encryption=AES-128&passphrase=34546434534543&bandwidth=25&payloadSize=1316&id=2&stream_id=6&multicast=false&audio_port=0&auth=false&service_port=0&user=&multicast_address=&multicast_ttl=127&password=&alter_port=0&type=srt&video_port=0

Control on and off of the stream dervice

API instrucation

control on and off of the stream dervice

Request

  • Method: GET/POST
  • URL: streamer/enable_stream.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string stream service publication point ID(necessary parameter)
stream_id alphabetic string tream service id(necessary parameter),state from interface 4.7
enable alphabetic string on/off stream service(necessary parameter),”1”on “0”off

Response

  • Body
{
  "result": "ok"
}

test calling:

http://192.168.2.123/api/streamer/enable_stream.json?id=2&stream_id=6&enable=0

How can we help?