av-merge: Fix error when switching qualities after endOfStream
After the video has been buffered to the end and mediaSource.endOfStream() has been called, the close function would perform some closing operations on the sourceBuffers that gave InvalidStateError Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
parent
77fffee34f
commit
92bdbf072e
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user