Communication protocol between Editor and Video switcher backend. - rtmp-switcher/backend GitHub Wiki
Editor <-> Video switcher backend communication protocol API
Editor sends HTTP(S) GET and POST requests to the backend.
- GET requests are sent to read the data from the backend.
- POST requests are sent to send the data to the backend and to control the backend (e.g., request the channels to be connected/disconnected).
The data is JSON-encoded. The names of the fields match the names of the columns in the database tables
The following methods are defined:
getChannels
GET method.
Returns JSON-encoded array of (enabled) defined channels. The following fields are returned for every channel: id, name, url, chan_type, last_url. The first three fields are taken from the channels database table. The field chan_type can take the following values:
- RTMP_IN Incoming RTMP channel
- RTMP_OUT Outgoing RTMP channel
The last field (last_url) is taken from the channel_details table and is empty if there is no row in channel_details for corresponding channel id.
Example:
[{"id":"1","name":"operator1","uri":"http:\/\/www.ustream.tv\/op1","chan_type":"RTMP_IN","last_url":"rtmp:\/\/\/last@59014"},{"id":"2","name":"operator2","uri":"http:\/\/www.ustream.tv\/channel\/opp","chan_type":"RTMP_IN","last_url":"rtmp:\/\/last:1935\/ustreamVideo\/reams\/live_1"},{"id":"5","name":"Tst out","uri":"http://outchan","chan_type":"RTMP_OUT","last_url":"rtmp:\/\/1.1"}]
getChannelsVideo
GET method.
Returns the HTML page which contains embedded HTML code for all the channels of type RTMP IN.
channelDetails
POST method.
Sends the JSON-encoded list of the channels data for specific channel. The following fields are transmitted: channel, app, playPath, flashVer, swfUrl, url, pageUrl, tcUrl. These are the fields of the channel_details database table.
The following keys should be defined:
- dataType should be set to channelDetails
- data should be set to JSON-encoded array of the channel details.