Embed: mitigate videojs not (always) sending a canplay event for live streams

This commit is contained in:
Cat 2019-11-11 11:08:27 +01:00
parent 8dd403a098
commit 63d1a61935
2 changed files with 18 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -250,6 +250,23 @@ p.prototype.build = function (MistVideo,callback) {
} }
}; };
if (MistVideo.info.type == "live") {
//for some reason, videojs doesn't always fire the canplay event ???
//mitigate by sending one when durationchange follows loadstart
var loadstart = MistUtil.event.addListener(ele,"loadstart",function(e){
MistUtil.event.removeListener(loadstart);
MistUtil.event.send("canplay",false,this);
});
var canplay = MistUtil.event.addListener(ele,"canplay",function(e){
//remove the listener
if (loadstart) { MistUtil.event.removeListener(loadstart); }
MistUtil.event.removeListener(canplay);
});
}
callback(ele); callback(ele);
} }