Skip to content

Instantly share code, notes, and snippets.

@dmlap
Created April 28, 2014 17:51
Show Gist options
  • Save dmlap/11379155 to your computer and use it in GitHub Desktop.
Save dmlap/11379155 to your computer and use it in GitHub Desktop.
Proposed ad type parameter. Analytics plugins may wish to report the type of advertisement that is currently playing.
// when an ad is playing, ads.type would expose the type of linear ad
player.ads.type; // undefined, "preroll", "midroll", or "postroll"
// this property is somewhat duplicative of info that is already exposed by the plugin
// you could figure out the type of ad yourself something like this:
var adType = function(player) {
if (player.ads.snapshot.currentTime < 0.1) {
return "preroll";
} else if (player.ads.snapshot.currentTime < duration - 0.1) {
return "midroll";
}
return "postroll";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment