Player API
The player provides the following API methods to allow a layout to interact with the player on which it is being displayed. All methods should be called on the playerApi object.
.previous() – Navigate to the previous item in the current playlist.
.next() – Navigate to the next item in the current playlist.
.pause() – Pause the current playlist.
.resume() – Resume playback of the playlist if it has been paused.
.resumeNext() – Resume playback of the playlist if it has been paused and immediately play the next slide.
.getHeaders() or .headers() – Return the headers needed for authentication when making web service calls.
.webService() – Return the base address of the web services.
.loginDetails() – Returns information about the player’s login. The following fields are available:
- accessToken
- id
- name
- type
- webService.onMessage
.onMessage(string, callback) – Used to subscribe to messages sent to the player over the network. To send a message, you would access the player via http://[player]:65001/player/[string]. The callback gets a parameter with any GET variables passed along with the URL. See below for an example.
.playerMetaData() – Returns an object with a variety of player metadata. The following fields are available (note: an additional 20 custom metadata fields are available for the customer to define and use)
- player_name
- street
- city
- state
- country
- floor
- room
- notes
- zip
- latitude
- longitude
- orientation
- Custom Metadata fields 1-20
Player API Example
Display different elements based on a player’s zip code.
var zip = playerApi.playerMetaData().zip;
if(zip.indexOf(‘75075’) > -1){
$(‘#element_0_0’).hide();
$(‘#element_0_1’).show();
}
Modify content based on an HTTP message sent across the network
//assuming a request to http://myplayer:65001/player/message?title=Hello&body=I see you’re looking at my signage.
playerApi.onMessage(‘message’, function(args){
$(‘#0_0’).text(args.title);
$(‘#0_1’).text(args.body);
});
Media Player API Calls via Korbyt Services API
Player
GET
Get player details or enumerate players
POST
Create/Update a media file and play it on a player
PUT
Play existing media file on player
DELETE
Delete existing push or play request
PUT
Trigger player action
Player Group
GET
Get player details from player group or enumerate groups
POST
Create/Update a media file and play it across a player group
PUT
Play existing media file across player group
DELETE
Delete existing push or play request (group)
PUT
Trigger players action by group
Playlist
GET
Get playlist details or enumerate playlists
PUT
Update dynamic playlist – Set tags and force associated player checkins
POST
Create new clever playlist with static content
POST
Update static or clever playlist and force associated player checkins
Scriptlets
GET
Get scriptlet details or enumerate scriptlets
PUT
Install scriptlet
DELETE
Uninstall scriptlet