b416adc6 by Gary Katsevman

add a cancelKeyXhr akin to cancelSegmentXhr

1 parent 0154b51f
......@@ -138,8 +138,7 @@ videojs.Hls.prototype.handleSourceOpen = function() {
this.playlists.on('mediachange', videojs.bind(this, function() {
// abort outstanding key requests and check if new keys need to be retrieved
if (keyXhr) {
keyXhr.abort();
keyXhr = null;
this.cancelKeyXhr();
this.fetchKeys(this.playlists.media(), this.mediaIndex);
}
......@@ -200,8 +199,7 @@ videojs.Hls.prototype.setCurrentTime = function(currentTime) {
// fetch new encryption keys, if necessary
if (keyXhr) {
keyXhr.aborted = true;
keyXhr.abort();
keyXhr = null;
this.cancelKeyXhr();
this.fetchKeys(this.playlists.media(), this.mediaIndex);
}
......@@ -241,15 +239,19 @@ videojs.Hls.prototype.updateDuration = function(playlist) {
*/
videojs.Hls.prototype.resetSrc_ = function() {
this.cancelSegmentXhr();
this.cancelKeyXhr();
if (this.sourceBuffer) {
this.sourceBuffer.abort();
}
};
videojs.Hls.prototype.cancelKeyXhr = function() {
if (keyXhr) {
keyXhr.onreadystatechange = null;
keyXhr.abort();
keyXhr = null;
}
if (this.sourceBuffer) {
this.sourceBuffer.abort();
}
};
videojs.Hls.prototype.cancelSegmentXhr = function() {
......