Added checks in video player methods which may get executed after the player has been destroyed.

This commit is contained in:
Usman Khalid
2016-04-14 14:12:36 +05:00
parent 9cbfea2edd
commit 7bb96f6685
3 changed files with 10 additions and 2 deletions

View File

@@ -70,7 +70,10 @@ function (HTML5Video, Resizer) {
function _makeFunctionsPublic(state) {
var debouncedF = _.debounce(
function (params) {
return onSeek.call(this, params);
// Can't cancel a queued debounced function on destroy
if (state.videoPlayer) {
return onSeek.call(this, params);
}
}.bind(state),
300
);

View File

@@ -49,6 +49,9 @@ function () {
});
this.el.off('controls:show');
if (this.controlHideTimeout) {
clearTimeout(this.controlHideTimeout);
}
delete this.videoControl;
}

View File

@@ -86,7 +86,9 @@ define('video/09_bumper.js',[], function () {
if (this.doNotShowAgain) {
_.extend(info, {bumper_do_not_show_again: true});
}
this.state.videoSaveStatePlugin.saveState(true, info);
if (this.state.videoSaveStatePlugin) {
this.state.videoSaveStatePlugin.saveState(true, info);
}
},
destroy: function () {