Skip to content

Instantly share code, notes, and snippets.

@jramsahai
Last active June 23, 2016 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jramsahai/65bd7599c9403a15fb56 to your computer and use it in GitHub Desktop.
Save jramsahai/65bd7599c9403a15fb56 to your computer and use it in GitHub Desktop.
The Vidyard Progress Events Framework will allow you to execute arbitrary javascript at fixed intervals during the playback of the video. This basic example will write view data to the browser console.
<!--
Include this script below: Google Analytics, Player Embed(s), and Vidyard API
Example Customer Implementations:
VidyardProgressEvents(function (result){console.log(result.event)});
VidyardProgressEvents(function (result){console.log(result.event)}, [1,10,20,30,40,50,60,70,80,90]);
// Returns:
// result.event as integer
// result.chapter as integer
// result.player as a Vidyard player object
-->
<html>
<head>
</head>
<body>
<script type='text/javascript' id='vidyard_embed_code_HFgE1I16PiLBqKUNqHz73A' src='//play.vidyard.com/HFgE1I16PiLBqKUNqHz73A.js?v=3.1.1&type=inline'></script>
<script type='text/javascript' src="//play.vidyard.com/v0/api.js"></script>
<script type='text/javascript' src="//play.vidyard.com/v1/progress-events.js"></script>
<script type='text/javascript'>
var c = new Vidyard.player("");
VidyardProgressEvents(function (result){
console.log(`${result.player.metadata.chapters_attributes[result.chapter].video_attributes.name}: ${result.event}%.`);
}, [1,25,50,75,100]);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment