OnTheAir Video's REST API allows you to retrieve OTAV's status, change playlists, do controls of the playback and playing with the DGO. Also note that this REST API is not final, it's a first draft and there could be changes in the future when it is finalised.
This API is meant to be RESTful, then, using different verbs on requests leads to different behaviour on request processing. In general manner, consider theses verbs to have the described behaviour:
GET -> Retrieve data of a processable entity.
POST -> Create a new entity.
PUT -> Update a specified entity.
DELETE -> Delete an entity.
When you modify or retrieving data, be sure to handle properly the return code that is returned by the API as it indicates if the operation was successfull or not.
For POST & PUT requests you MUST supply the 'Content-Type' header with value 'application/json'.
Here is a short list common codes returned by the API:
"success": Indicates if the request was accepted and processed or not by OnTheAir Video. "error": In case of success false, indicates what was wrong when processing the request.
NOTE: OPTIONAL marked parameters indicates that these parameters can be or not be present in the response object, this is due to internal logics.
However for requests that require a body, like PUT or POST, it means that it can be passed but they are not mandatory.
Authorization
Since playlists can play sensitive content at a time, an authorization mechanism will be required if you decide to enable it in OnTheAir Video's preferences. (General -> HTTP Server -> Require Authentication).
If this feature is enabled, it implies that you have to login with one of the registred user defined in OnTheAir Video and use the token received. In case not, you can ignore this section.
Each user has an access level, it defines how much control you have. Theses are described as follows:
#
Title
Description
1
Read Only
You'll only be able to retrieve informations but not modifying it.
2
Modify Playlists
You'll only be able to modify playlists.
3
Modify And Control Playlists
You'll be able to modify playlist, control the playback and DGO.
4
Full Access
You'll be granted to execute all commands (admin privileges).
In order to make request you must first login with the following request:
{
"token": string, OPTIONAL
"error": string, OPTIONAL
"level": number
}
The token received MUST be added in the query parameter of each request you make to OTAV.
The level property is indicating the level granted to the logged user as defined in the table above.
NOTE:
The token will be invalid if you relaunch OnTheAir Video and thus you will have to remake the process again to obtain a new valid token.
In case of token invalidity, requests will send back a 401 error code
In case of not token provided, requests will send back a 403 error code
Unique id - index or display name ?
Each playlist can be addressed using either its unique_id or its index.
The unique_id of a playlist represents its display name but may be altered to ensure it is unique among other playlists opened. It will not change unless you reanme the playlist.
The index is the position of the playlist in opening order. The index '0' would represent the first playlist opened, then '1' would represent the second and so on.
Each clip can be addressed using either its unique_id, its index or eventually its display name.
The unique_id is the safest way as it will not change and remain unique, but you have to request first its value before being able to send arguments.
The index of a clip is the (zero based) position of a clip, or the order in which the playlists are displayed on screen (0 is the first playlist open, 1 is the second playlist open, etc...)
The display name is the name given to a clip inside OnTheAir Video. But pay attention that if you have mutiple clips with the same name, it will always address to the first one (in index order). Should be used as a convenience way or when you are sure the name is unique witthin the playlist.
Each action can only be addressed by its unique_id.
Getting informations about the OnTheAir Video Instance
"item_unique_id" : string, OPTIONAL *eg. "666AD1EF-54C6-4A63-A67B-501C57E6080F" or "" if not playing
"live_subtitling" : boolean, OPTIONAL *
"next_live_display_name" : string, OPTIONAL *eg. "My Live Name"
"next_live_unique_id" : string, OPTIONAL *eg. "666AD1EF-54C6-4A63-A67B-501C57E6080F" or "" if no live in currently playing playlist
"playback_status" : string, OPTIONAL *eg. "Playing", "Stopped", "Pause"
"playlist_display_name": string, OPTIONAL *Playing playlist's name
"playlist_duration" : number, OPTIONAL *eg. 233.3199
"playlist_elapsed" : number, OPTIONAL *eg. 233.3199
"playlist_index": number, OPTIONAL *Playing playlist's index (in opening order)
"playlist_remaining" : number, OPTIONAL *eg. 80.7999
"playlist_unique_id": string, OPTIONAL *Playing playlist's unique ID
"remaining_time_until_next_live" : number, OPTIONAL *eg. 233.3199
}
* Thoses fields will only appear if a playlist is playing
Get the playback status of a playlist
With the following request, you will get a few info about the status of the playlist, and more. See playlist section for more controls.
Get the playback status of a clip
With the following request, you will get a few info about the status of the clip, and more. See clips section for more controls.
GET http://localhost:8081/playlists/{n}/items/{m}/playing
Retrieve the thumbnails of the video output. Allows to have a small preview remotely.
Get thumbnail
GET http://localhost:8081/playback/thumbnail
Response: jpeg data
Playback Controls
Types of controls
You have three ways to control the playback. Depending on what you want to achieve, you can:
address "playback" and NOT specify a playlist, nor a clip. In this case, the playing playlist (or the front one if no playlist is playing) will be the one answering your requests.
specify the playlist you want to control (by using its index or unique ID), but without specifying a clip. In this case you can start the playback on a specific playlist, and the first clip (or the playing one) in the playlist will be controlled
specify both the playlist you want to control, as well as the clip (by using their index or unique ID). That's the way to start playing a specific clip in a specific playlist.
NOTE: When using playback commands (play or pause) by specifying a clip, the following parameters can be passed in the URL to set the playback's play head at a precise timecode:
"position_relative_timecode": string HH:MM:SS:FF timecode position from the clip's start
"position_media_timecode": string HH:MM:SS:FF absolute timecode in the media
"position_relative_seconds": number position after x seconds from the media's beginning
Below, you will find the 3 types of controls (generic, per playlist or per clip). Depending on the type of command, you may have just one control possible. Or in some cases, all three are possible but will produce the same result. For example, if you aska a "generic" stop, it will do a stop the same way as if you specify a clip and/or a playlist.
The basic - play/stop/pause
Play
Start playing at the beginning of the front playlist:
GET http://localhost:8081/playback/play
Start playing at the beginning of the specified playlist:
GET http://localhost:8081/playlists/{n}/play
Start playing at the the specified clip of the specified playlist (see above to also specify an offset to start the clip):
GET http://localhost:8081/playlists/{n}/items/{m}/play
If a playlist is playing or paused, the first 2 requests will control the "playing or paused" playlist: pause the playback if playing or resume it if paused.
If nothing is playing, the first request will do a pause on the front playlist, on the selected clip if any. The second request will specify on which playlist the pause should be done.
GET http://localhost:8081/playback/pause
GET http://localhost:8081/playlists/{n}/pause
Even if something is playing or paused, the following request will ask to pause the clip. Never to resume it.
GET http://localhost:8081/playlists/{n}/items/{m}/pause
If you want to clear the "Platy Next" clip that was set with the previous request, you don't need to indicate the playlist and clip. You can specify them if it's easier for your code, but they will be ignored.
GET http://localhost:8081/playback/clear_next
GET http://localhost:8081/playlists/{n}/clear_next
GET http://localhost:8081/playlists/{n}/items/{m}/clear_next
As the pause control can either do a pause or resume, if you want to be sure to do a resume, you should use this one, instead of the pause... Whatever three requests, it will do a resume of the paused clip if any, in whatever playlist.
GET http://localhost:8081/playback/resume
GET http://localhost:8081/playlists/{n}/resume
GET http://localhost:8081/playlists/{n}/items/{m}/resume
All three commands will do a skip to next on the playing playlist... Nothing will happen if nothing is played or paused.
GET http://localhost:8081/playback/skip_next
GET http://localhost:8081/playlists/{n}/skip_next
GET http://localhost:8081/playlists/{n}/items/{m}/skip_next
You can also indicate if the skip to next should only be done if the currently playing item is a live (useful to exit a live, but ignore if you are already out of the live).
GET http://localhost:8081/playback/skip_next?live_only=1
You can also indicate if the skip to next should only be done if the currently playing item is a live (useful to exit a live, but ignore if you are already out of the live).
GET http://localhost:8081/playback/skip_next?live_only=1
Response:
{
"success": boolean,
"last_position": number Indicates the elapsed time of the previously playing clip in seconds.
}
Skip to previous
All three commands will do a skip to previous on the playing playlist... Nothing will happen if nothing is played or paused.
GET http://localhost:8081/playback/skip_previous
GET http://localhost:8081/playlists/{n}/skip_previous
GET http://localhost:8081/playlists/{n}/items/{m}/skip_previous
Set which clip will play once the current one is done playing (or when doing a skip to next). This request only works when specifying a playlist and a clip.
GET http://localhost:8081/playlists/{n}/items/{i}/play_next
Emulates a "GPI input" received trigger. You must specify the input number. This will do a skip to next if a "GPI trigger" for the specified input is set on the currently playing clip (cf clip attributes inspector)
GET http://localhost:8081/playback/gpi_trigger?input=1
This feature is only available if you have the traffic option, will use the theoretical start date/time of the playlist and clip in order to start playing what was scheduled to play. The first request will do a join in progress, in the following order, on: the playing playlist; if no playlist is playing, the playlist of the day; if no playlist is playing, nor a playlist of the day is open, the front playlist
GET http://localhost:8081/playback/join_in_progress
The following two requests will do a join in progress on the specified playlist.
GET http://localhost:8081/playlists/{n}/join_in_progress
GET http://localhost:8081/playlists/{n}/items/{m}/join_in_progress
NOTE:
The "preset_duration" parameter is a theoretical value that indicates the desired duration of the playlist althougth the duration may or may not be equal to this one.
Get the list of items of a playlist
The following request will get the list of items in playlist {n}. You can use the playlist index, or a unique ID (see above)
NOTE:
Trying to delete all clips of playing playlist will return an error.
Close a playlist
Close the playlist with specified ID. Warning ! Use this command with care as some other remote user will no longer have access to the playlist after it is closed.
GET http://localhost:8081/playlists/{id}/close
Working with clips in playlists
Get the info of a specific item in a playlist
The following request will get the info of the item {m} in playlist {n}. You can use the playlist index, or a unique ID (see above), same thing for the clip, you can use either the index or the unique ID.
>,
"segment_number" : number,
"reconcile_id" : string, OPTIONAL
"isci_code" : number, OPTIONAL"url" : string, eg. "/Users/admin/Documents/MyMovie1.mov" for FILE or STREAM"video_codec" : string, eg. "H.264""audio_codec" : string, eg. "AAC""last_modification_date" : string,
"has_in_point" : boolean,
"in_point" : number, eg. 9.902 (in seconds)"has_out_point" : boolean,
"out_point" : number, eg. 59.000 (in seconds)"closed_captions" : array <string>, OPTIONAL"languages" : array <string> OPTIONAL"live_source_name": string OPTIONALeg. "Live Source 2""is_streamed": boolean, Indicates if the stream is a remote file or not.
"playback_mode" : string,
playback mode
"resize_mode": string,
resize mode
"duration" : number, eg. 679.902 (in seconds)
"duration_timecode" : string, eg. "00:11:34" HH:MM:SS
"frames_per_second" : number,
"drop_frame" : boolean,
"is_offline": boolean, will always set to false for a LIVE or STREAM clip.
"is_valid" : boolean,
"is_cued_as_next": boolean,
"validation_status" : string,
* : if the unique_id property is not present it means that the item is still in the playlist but will be further deleted and thus cannot be accessed.
NB: If 'clip_type' is a comment item, he will only have 'unique_id', 'name', 'clip_type' & 'segment_number' properties.
Get the thumbnail of a clip
The following request will get the thumbnail of the item {m} in playlist {n}. You can use the playlist index, or a unique ID (see above), same thing for the clip thumbnail, you can use either the index or the unique ID.
GET http://localhost:8081/playlists/{n}/thumbnails/{m}
The following request will validate the clips within a playlist. A validation will open the file, read the header to retrieve the codec and format. You can either ask it for the whole playlist, or for a specific clip in the playlist. You can use the playlist index, or a unique ID (see above), same thing for the clip, you can use either the index or the unique ID.
There are 2 types of check:
A "simple" validation, "check for missing clips": we will compare the modification date of the file, and what we have stored in the playlist, and only validate the clip if the 2 are different. This is mainly useful when asking a whole playlist to check if clips have been modified or became online/offline
A "forced" validation: we will not check the modification date and force to validate the clip. This is to be used with care as it uses some resources (we have to open the file to get its info).
All properties of a clip can be changed but here are the most common to be changed. WARNING: if you change some properties that doesn't appear on this list, it might lead to unwanted UI behaviour. This command will also automatically save the playlist.
PUT http://localhost:8081/playlists/{n}/items/{m}
Body:
{
"name" : string, OPTIONALeg. "MyMovie1""url" : string, OPTIONALeg. "/Volumes/Movies/MyMovie.mov" (ONLY FOR FILE or STREAM)"live_source_name" : string, OPTIONALeg. "Live Source 2" (ONLY FOR LIVE)"duration" : number, OPTIONALeg. 679.902 (in seconds) (ONLY FOR LIVE or STREAM)
"playback_mode" : string,
WARNING: You MUST send the entire items list, the content will be reflected, the additional items wil not be added nor removed. To add or delete items, please use POST/DELETE requests
If you want to create a clip at a specific index {m}, you can use the following:
POST http://localhost:8081/playlists/{n}/items/{m}
Body:
{
"clip_type" : enum <
clip_type
>, REQUIRED"url" : string, REQUIRED ONLY FOR FILE or STREAMeg. "/Volumes/Movies/MyMovie.mov""live_source_name" : string, REQUIRED ONLY FOR LIVEeg. "Live Source 2""duration" : number, REQUIRED ONLY FOR STREAM OR LIVEeg. 679.902 (in seconds)
"name" : string, OPTIONALeg. "MyMovie1"
"playback_mode" : string,
NOTE:
Trying to delete a playing clip of a playlist will return an error.
Working with the currently playing clip
To address the currently playing clip, instead of communicating "through" the playlist, you go through the "playback" command. With the currently playing item, you can do all the same requests you do to the playlist items.
Get the info of the currently playing clip
The following request will get the info of the currently playing clip.
>,
"segment_number" : number,
"reconcile_id" : string, OPTIONAL
"isci_code" : number, OPTIONAL"url" : string, eg. "/Users/admin/Documents/MyMovie1.mov" for FILE or STREAM"video_codec" : string, eg. "H.264""audio_codec" : string, eg. "AAC""last_modification_date" : string,
"has_in_point" : boolean,
"in_point" : number, eg. 9.902 (in seconds)"has_out_point" : boolean,
"out_point" : number, eg. 59.000 (in seconds)"closed_captions" : array <string>, OPTIONAL"languages" : array <string> OPTIONAL"live_source_name": string OPTIONALeg. "Live Source 2""is_streamed": boolean, Indicates if the stream is a remote file or not.
"playback_mode" : string,
playback mode
"resize_mode": string,
resize mode
"duration" : number, eg. 679.902 (in seconds)
"duration_timecode" : string, eg. "00:11:34" HH:MM:SS
"frames_per_second" : number,
"drop_frame" : boolean,
"is_offline": boolean, will always set to false for a LIVE or STREAM clip.
"is_valid" : boolean,
"is_cued_as_next": boolean,
"validation_status" : string,
* if the unique_id property is not present it means that the item is still in the playlist but will be further deleted and thus cannot be accessed.
Update/Edit the currently playing clip
All properties of a clip can be changed but here are the most common to be changed. WARNING: if you change some properties that doesn't appear on this list, it might lead to unwanted UI behaviour. This command will also automatically save the playlist.
PUT http://localhost:8081/playback/current_item/
Body:
{
"name" : string, OPTIONALeg. "MyMovie1""url" : string, OPTIONALeg. "/Volumes/Movies/MyMovie.mov" (ONLY FOR FILE or STREAM)"live_source_name" : string, OPTIONALeg. "Live Source 2" (ONLY FOR LIVE)"duration" : number, OPTIONALeg. 679.902 (in seconds) (ONLY FOR LIVE or STREAM)
"playback_mode" : string,
WARNING: There is a major change with Actions in OnTheAir Video 4.2. In previous versions, Actions were only AppleScripts. Now they can be AppleScript, or other direct actions that allow you to control various equipments. Make sure to check the changes, and when sending or receiving requests to a OnTheAir Video, check the version of the server (using GET /info), to make sure you are compatible.
Get available the list of available actions
The following request will retrieve the available actions on the server. You can use them to update your clip's available actions, and know the possible values for each.
The parameter_type set if it's a string, a number, a boolean. And is defined here:
parameter type
Get the list of actions of a playlist item
The following request will retrieve all the actions set on the item {m} of playlist {n}. You can use indexes, or unique IDs (see above).
GET http://localhost:8081/playlists/{n}/items/{m}/actions
Action response object:
{
"name" : string, The name of the type of Action to execute. eg. "Execute AppleScript"
"unique_id" : string, The unique identifier of the action. eg. "0650A319-B0B7-4B06-957C-F81B38470548"
"position" : number,position of the action in seconds. eg. 0
"position_type" : string,
position type
"position_timecode" : string, position of the action in timecode. eg. "00:00:00:00" HH:MM:SS:FF
"template_id" : string,
type of action
"parameters" : array, will depend on the selected "template_id". See below for examples
"is_outpoint_clamped" : boolean, *
"is_inpoint_clamped" : boolean, **
"is_valid" : boolean, TRUE if the action is not valid (for example outside of clip boundaries)
"is_offline": boolean, TRUE if the AppleScript action, or custom action file is not present on disk
}
* TRUE if the Action is set to be triggered juste after the out point of the clip (less than 1 second after). Therefore, we have 'clamped' it so it will be triggered at the end of the clip.
** TRUE if the Action is set to be triggered juste before the in point of the clip (less than 1 second after). Therefore, we have 'clamped' it so it will be triggered at the end of the clip.
Get the info of a specific action on a playlist item
The following request will retrieve the action {k} set on the item {m} of playlist {n}. You can use indexes, or unique IDs (see above).
GET http://localhost:8081/playlists/{n}/items/{m}/actions/{k}
Previously, you just had to set a name of the AppleScript that had to be triggered for the action. Now you need to indicate the template_id, which is the type of action to execute. Then in its parameters, you set the attributes for that action. These parameters will be different depending on the type of action selected. This is why, we give some examples of actions below.
POST http://localhost:8081/playlists/{n}/items/{m}/actions
Body:
{
"name" : string, OPTIONAL, eg. "Execute AppleScript" -> the name of the type of Action to execute
"unique_id" : string, OPTIONAL, The unique identifier of the action. eg. "0650A319-B0B7-4B06-957C-F81B38470548"
"position" : number, OPTIONAL, The position of the action in seconds. eg. 0 *
"position_timecode" : string, OPTIONAL, The position of the action in timecode in HH:MM:SS:FF *
"position_type" : string, OPTIONAL,
position type
"template_id" : string,
type of action
"parameters" : array, OPTIONAL, will depend on the selected "template_id". See below for examples
}
* When adding actions, you can specify 2 types of timing. Either using seconds (position), or using timecode (position_timecode). If you set both, it's the "position" (in seconds) that will be used.
Some examples of actions to add
As the parameter you will set will be different depending on the type of action, we are showing below some examples. But the easiest is for you to add actions in the OnTheAir Video playlist, and see the parameters that can be used.
Add an AppleScript Action
This actions will trigger an AppleScript (as the old actions). In parameters, you set the AppleScript to execute, and the "parameter" for that AppleScript (the string that can be used as a variable in the AppleScript).
POST http://localhost:8081/playlists/{n}/items/{m}/actions
"template_id": "AppleScript:Execute AppleScript"
"parameters": {
"AppleScript Name": string, The name of the AppleScript to execute
"Parameter": string, OPTIONAL, The string that will be passed to be used in the AppleScript
"After Delay (ms)": number, OPTIONAL, The delay to start the action in ms. eg. 0
}
This actions will control CG projects. The difference with the DGO control below is that when using Actions, you can set a specific time for the action to be triggered. If you want to control the status of the projects for the whole length of a clip, you may want to look below, in the section to control the DGO on a "per clip" base
POST http://localhost:8081/playlists/{n}/items/{m}/actions
"template_id": "SCTE:Send SCTE Trigger"
"parameters": {
"Splice Type": string, The type of splice to do.
splice_type
"Event ID": number, OPTIONALThe number of the Event ID to. eg. 1
"Program ID": number, OPTIONALThe number of Program ID. eg. 1
"Duration (ds)": number, OPTIONALThe duration of the event in ds. eg. 0
"After Delay (ms)": number, OPTIONALThe delay to start the action in ms. eg. 0
}
"template_id": "Routers:Videohub Switch"
"parameters": {
"IP Address": string, The IP address of the VideoHub
"Source": number, OPTIONALThe number of the source to switch to. eg. 1
"Destination": number, OPTIONALThe number of the destination to control. eg. 1
"After Delay (ms)": number, OPTIONALThe delay to start the action in ms. eg. 0
}
Once you have actions on a clip, you can use a PUT request to modify it. Just pass the keys that you want to modify. So if you need to modify the position, just pass the position key. You can usen either the index or the UID of the action. The UID is recommended so you are sure of which action you are modifying even if their order change.
PUT http://localhost:8081/playlists/{n}/items/{m}/actions/{k}
Body:
{
"name" : string, OPTIONALeg. "Display Finder Message" -> name of the AppleScript
"position" : number, OPTIONALeg. 0
"position_type" : string, OPTIONAL
"position_timecode" : string, OPTIONALeg. "00:00:00:00" HH:MM:SS:FF
"parameter" : string, OPTIONALeg. Hello
}
In this section, you will see how to control the status of the DGO projects on a "per clip" base. In the OnTheAir Video preferences, you have to set a default status of a DGO project (running or stopped), which will be used if nothing is set on the clips. So it's very easy for example to have a project running by default, but then on a specific clip, to set the project to stop. This will be done for the whole duration of the clip. If you would like the project to start, or stop (or having its values modified) at a specific time in the clip, use actions instead.
Get the DGO projects:
Here are examples of requests to get the available CG projects or a specific project designated by {n}:
Below are example of request that you can use to modify the items {i} of a DGO project {n}:
Modifying text items
PUT http://localhost:8081/playback/cg_projects/{n}/items/{i}
Body:
{
"tex t" : string, OPTIONALeg. "This is my new text"
}
Modifying rich text items
PUT http://localhost:8081/playback/cg_projects/{n}/items/{i}
Body:
{
"htmlText": "<span style='font-family:Courier; color:red; font-size: 20;'> 20px red text. </span>
<span style='font-family:Courier; color:blue; font-size: 50;'> 50px blue text.</span>"
}
Change Movies items
You can change the path of a movie item using either the full path or the relative path. When using the relative path, this means that the file used will be found relatively to the location of the project itself. This allows you then to move the project and media to another location, and this will continue to work. Of course this requires that the file be located in the same folder as the project.
PUT http://localhost:8081/playback/cg_projects/{n}/items/{i}
Body:
{
"moviePath" : url, REQUIREDeg. using full path "/Volumes/Movies/MyMovie.mov"
}
Change Images items
PUT http://localhost:8081/playback/cg_projects/{n}/items/{i}
Body:
{
"imagePath" : url, OPTIONALeg. using relative path "../MyImage.jpeg"
}
Change Audio items
PUT http://localhost:8081/playback/cg_projects/{n}/items/{i}
Body:
{
"filePath" : url, OPTIONALeg. using relative path "../MySound.AIFF"
}
Scheduler & Control
Start the schedule
GET http://localhost:8081/scheduler/start
Stop the schedule
GET http://localhost:8081/scheduler/stop
Resynchornize the schedule
This will force OTAV to go through the schedule again and start what is scheduled to be started. Note that this will interrupt playback very briefly to start a new clip.
The following request will open the playlist with specified path {path}. Once a scheduled playlist is open you can control it the way you do with opened playlists.
GET http://localhost:8081/scheduler/playlists?path={path}
The following request will close the playlist with specified ID. Warning ! Use this command with care as some other remote user may no longer have access to the playlist after its close.
GET http://localhost:8081/playlists/{id}/close
Get schedule's infos
GET http://localhost:8081/scheduler?include_items=1
You can retrieve several infos about the current scheduler. The query parameter "include_items" will allow you to get all the events of the scheduler. If you don't need them, don't pass it.
NOTE: "end_time_seconds" property override the "end_timecode" property. "start_time_seconds" property override the "start_timecode" property.
For more information
If you need more info or support about OnTheAir Video, you can find it on our support desk. And if you need additional information on the API and/or the websockets, submit a ticket and we'll be happy to guide you.