Player API Flow
  • 12 Feb 2024
  • 1 Minute to read
  • Dark

Player API Flow

  • Dark

Article summary

This guide is for the Dise One playout engine only. Please reference other guides for Dise Premium & Dise Lite.

Player API Flow

The Player API defines the flow of control between the player and the template, and allows for seamless orchestration of content.  In order to achieve gapless and glitchfree switches between content, the API allows the template to preload its content in the background, while the previous content is still playing.

When developing a template, one can choose to implement the Player API directly.  However, in most cases it will be easier to use the TypeScript Framework provided in this SDK. Still, an understanding of the Player API flow is vital.

As illustrated above, the event flow of the API works in the following way:

  1. The player starts to load the template and calls the "onLoad" function in the API. This function is the equivalent of the window.onload event and will be run when the template has been completely loaded. Here the template can initialize everything it needs that isn't dynamic content.

  2. When the template is done loading all it needs, it calls the function cmdReady, which tells the player that the template is ready to receive data.

  3. The player now sends in the JSON data to the template by running the onPreload function. The data object is already parsed at this point so no need to decode the JSON. The template can now load all its dynamic content from the data it has received, i.e., external images, texts, set up animations that need dynamic settings etc.

  4. When everything in the template is prepared and ready to be viewed, the template calls the preloadComplete function, letting the player know that the template is ready to be displayed.

  5. When the current item in the playlist is done playing, the player switches the template to be displayed and lets the template know by calling the onShift function. This is usually when the template starts videos and animations.

  6. When all animations in the template are done it can, optionally, call the function templateEnded to let the player know that it has finished displaying all it wanted to display and let the player know it can skip to the next media in the playlist.

API functions

When implementing a template using the API, as opposed to using the Framework, the JavaScript module "XXX.js" should be included.  The file contains documentation and examples.

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.