Skip to content

Instantly share code, notes, and snippets.

@zoharbabin
Last active April 8, 2019 10:02
Show Gist options
  • Save zoharbabin/0487fd21f4822c3a7fac31130e980811 to your computer and use it in GitHub Desktop.
Save zoharbabin/0487fd21f4822c3a7fac31130e980811 to your computer and use it in GitHub Desktop.
//reset these with every player load/playback session
var PLAY_REACHED_25_PERCENT = false;
var PLAY_REACHED_50_PERCENT = false;
var PLAY_REACHED_75_PERCENT = false;
var PLAY_REACHED_100_PERCENT = false;
kalturaPlayer.addEventListener(kalturaPlayer.Event.Core.TIME_UPDATE, function (event) {
var progpercent = kalturaPlayer.currentTime / kalturaPlayer.duration;
if (!PLAY_REACHED_25_PERCENT && progpercent >= 0.25) {
PLAY_REACHED_25_PERCENT = true;
console.log("25%");
}
if (!PLAY_REACHED_50_PERCENT && progpercent >= 0.5) {
PLAY_REACHED_50_PERCENT = true;
console.log("50%");
}
if (!PLAY_REACHED_75_PERCENT && progpercent >= 0.75) {
PLAY_REACHED_75_PERCENT = true;
console.log("75%");
}
if (!PLAY_REACHED_100_PERCENT && progpercent === 1) {
PLAY_REACHED_100_PERCENT = true;
console.log("100%");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment