diff options
Diffstat (limited to 'youtube/static/js/av-merge.js')
-rw-r--r-- | youtube/static/js/av-merge.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js index f820927..1d5ada6 100644 --- a/youtube/static/js/av-merge.js +++ b/youtube/static/js/av-merge.js @@ -83,7 +83,8 @@ AVMerge.prototype.close = function() { this.audioStream.close(); this.timeUpdateEvt.remove(); this.seekingEvt.remove(); - this.mediaSource.endOfStream(); + if (this.mediaSource.readyState == 'open') + this.mediaSource.endOfStream(); } AVMerge.prototype.checkBothBuffers = function() { this.audioStream.checkBuffer(); @@ -199,9 +200,10 @@ Stream.prototype.close = function() { // Prevents appendSegment adding to buffer if request finishes // after closing this.closed = true; - this.sourceBuffer.abort(); - this.updateendEvt.remove(); + if (this.sourceBuffer.updating) + this.sourceBuffer.abort(); this.mediaSource.removeSourceBuffer(this.sourceBuffer); + this.updateendEvt.remove(); } Stream.prototype.appendSegment = function(segmentIdx, chunk) { if (this.closed) |