Skip to content

Instantly share code, notes, and snippets.

@dmlap
Created March 27, 2014 14:33
Show Gist options
  • Save dmlap/9808865 to your computer and use it in GitHub Desktop.
Save dmlap/9808865 to your computer and use it in GitHub Desktop.
Trigger `play()` based on a message from a parent page.
videojs.plugin('iframePlay', function(options) {
var player = this;
options = options || {};
window.addEventListener('message', function(event) {
if (!options.origin || options.origin === event.origin && event.data === 'play') {
player.play();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment