The Omny Studio embeddable iframe player can be programmatically controlled on your own website using the player.js Javascript library. 

Player.js allows you to interface with the iframe using a set of standardized methods and events across a wide range of supported rich media players.

View demo code and example to see it working live.

Read the player.js documentation to learn how to implement player.js on your website.

Supported events

The Omny Studio embed player emits the following player.js events

  • play - when the player is played

  • pause - when the player is paused

  • ended - when the player has finished playing the clip

  • timeupdate - while the player is playing, updates the current time in seconds and the duration in seconds¬†

Supported methods

The Omny Studio embed player supports the following player.js methods

  • play() - play the player

  • pause() - pause the player

  • getPaused() - returns if the player is paused

  • setCurrentTime() - seeks to the time in seconds

  • getCurrentTime() - returns the current position in seconds

  • getDuration() - returns the duration in seconds

  • mute() - mutes the player

  • unmute() - unmutes the player

  • getMuted() - returns if the player is muted

  • getVolume() - returns the player's volume in %

  • setVolume() - sets the player's volume in %

iFrame autoplay policy

Due to recent Google Chrome's autoplay policy changes, programmatically playing the embed using player.js might be restricted by default.

You can workaround the behaviour by adding allow="autoplay" to the iframe element which will delegate the play permission to the cross-domain iframe. 

For example, your iframe code will look like

<iframe src="" allow="autoplay"></iframe>
Did this answer your question?