Skip to content

Instantly share code, notes, and snippets.

@jramsahai
Created June 26, 2014 18:44
Show Gist options
  • Save jramsahai/1f0be24672c0b0da558d to your computer and use it in GitHub Desktop.
Save jramsahai/1f0be24672c0b0da558d to your computer and use it in GitHub Desktop.
Pausing the player after each chapter allows you to take some kind of alternate action with the viewer in the middle of the player. Use the opportunity to hit them with a CTA of some kind (additional info, form, etc.) then start them right back on the video from where they left off. I used the player API and a new play event.
<html>
<head>
<script src="//play.vidyard.com/v0/api.js"></script>
</head>
<body>
<script type="text/javascript" id="vidyard_embed_code_hsEU_eBjTeQ1Wk1NxIF99w" src="//play.vidyard.com/hsEU_eBjTeQ1Wk1NxIF99w.js?v=3.1&type=inline"></script>
<script type="text/javascript">
var video = new Vidyard.player("hsEU_eBjTeQ1Wk1NxIF99w");
var paused = 0;
video.on("play", function() {
if (paused==1) {
video.pause();
}
paused = 0;
});
video.on("chapterComplete", function() {
paused = 1;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment