Skip to content

Instantly share code, notes, and snippets.

@dmlap
Created September 19, 2014 20:55
Show Gist options
  • Save dmlap/f8305a42549b379d8df7 to your computer and use it in GitHub Desktop.
Save dmlap/f8305a42549b379d8df7 to your computer and use it in GitHub Desktop.
Initializing a plugin by hand. If some of the information required for a plugin's configuration isn't available until the player has loaded in a page, you can delay initializing it until you're ready.
<!doctype html>
<video
data-account="1234"
data-player="5678"
data-embed="default"
class="video-js" controls></video>
<script src="//players.brightcove.net/1234/5678_default/index.min.js"></script>
<script>
var player = videojs(document.querySelector('video'));
// initialize the plugin by-hand
player.complicatedPlugin({
userAgent: window.navigator.userAgent // pass along data that is only available at runtime
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment