Embed: bugfix on "stop videojs freaking out when a live stream has ended"

This commit is contained in:
Cat 2019-03-28 10:05:33 +01:00
parent e858982f36
commit 503ffbc248
2 changed files with 6 additions and 4 deletions

View file

@ -81,12 +81,15 @@ p.prototype.build = function (MistVideo,callback) {
});
me.api.unload = function(){
videojs(ele).dispose();
if (me.videojs) {
videojs(ele).dispose();
me.videojs = false;
}
};
//because video reloads the m3u8 when the stream stops, creating all sorts of problems
MistUtil.event.addListener(MistVideo.options.target,"error",function(e){
if (e.message == "Stream is shutting down") {
if (e.message == "Stream is offline") {
me.api.unload();
}
});
@ -132,7 +135,6 @@ p.prototype.build = function (MistVideo,callback) {
var HLSlatency = 90; //best guess..
overrides.get.duration = function(){
return (MistVideo.info.lastms + (new Date()).getTime() - MistVideo.info.updated.getTime())*1e-3;
if (MistVideo.info) {
return (MistVideo.info.lastms + (new Date()).getTime() - MistVideo.info.updated.getTime())*1e-3;
}