You have 2 options with our APIs:
- Using the REST api: You would be regularly polling the sources to know their status. This enables you to check the signal format but for dropped frames it would be less accurate as you can only get the last warning so you could miss one in between two polls.
- Using the WebSockets: There are 2 sockets. One main containing all the changes regarding the sources and destinations, and a second one with all the information for the activity & logs.
The advantage of the WebSockets is that every update is pushed live to it so you would be notified immediately and you won't miss any update.
All the objects received from our API are in JSON.
Using the REST API
The best way to get the most up to date documentation (and the one for your specific version of MovieRecorder) for the MovieRecorder REST API is to start the MovieRecorder application on a Mac, and then simply type in a browser on that Mac:
http://localhost:8080/api.html
This will return a page with all the explanations. But just if it's easier for you, we have attached a pdf document with the different calls available at the time of writing.
Using Websockets
You can also have a look at the sample webpage that we have created (it uses websockets). On the Mac that is running MovieRecorder, you can take a look at:
http://localhost:8080/index.html
Then show the page source and check how we have done that sample page. For the websockets, take a look at
http://localhost:8080/remote.js
This is the JavaScript file that does all the work for the Web UI of MovieRecorder.
Take a look where there is this code:
var socket = new WebSocket
We declare the socket we listen on and the protocol.
This will always be /remote and one of the following protocols:
v1.1.main_update.movierecorder.softronmedia.com
v1.0.activity_update.movierecorder.softronmedia.com
- main_update concerns all the changes made to the sources, destinations, etc.
- activity_update receives all the performance values and logs
On the line just under the WebSocket creation, we register a function for the onMessage event.
On each event, MovieRecorder will push data onto the sockets and that will trigger that function.
The data is always formatted as a JSON dictionary with a dataType key (you should look for "source" on the main socket and "logs" on the activity socket) and the actual data is at the "data" key.
On the main socket, there will also be a "change" key so you know what happened (insertion, removal, update).
Please note that when you connect to main socket, all the data model of MovieRecorder is pushed onto it in its current state.
Comments
0 comments
Please sign in to leave a comment.