The Qumu Player API allows you to programmatically interact with the player embedded in an iframe.
You can send commands to the player, get and set properties, and bind to events from the player.
Basics
The Player API is a separate JavaScript file that sets up a cross domain communication channel with a Qumu player embedded in an iframe.
Include the Player API script in your HTML page
Replace <qumu-cloud-domain> with the URL of your Qumu Cloud instance.
Include the Player iframe
Replace <qumu-cloud-domain> with the URL of your Qumu Cloud instance.
Replace <guid-or-alias> with the guid or the alias of a Qumu Cloud presentation.
Create the API object
Initialize the API
The err parameter will be set if the initialization fails. There are currently only two possible values it can be set to:
NO_IFRAME - Used if the player iframe cannot be found. Check that you have created the Api with the correct iframe name, and that the iframe is in the page before you initialize the Api.
TIMED_OUT - Used when the Api is unable to establish a connection to the Player within the timeout period. This covers all other errors that could occur.
Bind to events, get and set properties, and send commands
Destroy the API and Player
You only need to issue the destroy command if you wish to remove the API and Player while the user is still on the page. It does NOT need to be called when the user navigates away from the page.
Methods
Constructor
This creates a new Api object for a specific Player iframe. If you have multiple Players on the page you will need to create an Api object for each one.
init
The Api must be initialized before it can be used.
command
The available commands are:
play - Start or resume playing the presentation. Note: On the iPad or iPhone this won’t have any effect until the presentation has manually been played once, this is due to deliberate iOS restrictions.
pause - Pause the presentation.
destroy - Prepare the Player for removal. This only needs to be called if you want to remove the Player before leaving the page. It ensures that view stats are sent, and that the Api is cleaned up. No more commands can be sent once this has been called. This fires a callback when the destroy function is finished, don’t remove the Player iframe from the page until this callback has executed.
bind
The available events are:
play - Fired when the presentation starts or playback is resumed.
pause - Fired when the presentation ends or playback is paused.
timeupdate - Fired when the playback position is updated. The callback parameter is the currentTime in milliseconds.
volumechange - Fired when the volume of the player changes. The callback parameter is the current volume (0 to 100).
ended - Fired when the presentation ends.
liveState - Fired when the state of a live event is updated. The callback parameter is the new state.
get
Allows you to get property values from the player. A callback is used instead of a return value as we are communicating across iframes.
The available properties to get are:
currentTime - The current time of the play head in milliseconds
volume - The current volume (0 to 100).
paused - Returns true if the player is not currently playing.
duration - Returns the duration of the presentation in milliseconds.
liveState - Returns the current live state.
liveEndTime - Returns the time when the live event ended
liveStartTime - Returns the time when the live event started
set
currentTime - Set the current time of the play head in milliseconds
volume - Set the volume (0 to 100).
unbind
Allows you to remove a specific callback bound to an event, or if no callback is given to remove all callbacks for an event.