Created
April 28, 2014 17:51
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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