avmerge: Fix errors if close is called twice
This can happen if the quality is changed from an avmerge source to an integrated source, and then changed back to an avmerge source Close is called the first change, but on the last change, it's called again because the avMerge object is still present, resulting in InvalidStateError Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
parent
70eb5cc94f
commit
5ff216d1ba
@ -37,6 +37,7 @@ function AVMerge(video, srcPair, startTime){
|
||||
this.startTime = startTime;
|
||||
this.video = video;
|
||||
this.mediaSource = null;
|
||||
this.closed = false;
|
||||
this.setup();
|
||||
}
|
||||
AVMerge.prototype.setup = function() {
|
||||
@ -67,6 +68,9 @@ AVMerge.prototype.sourceOpen = function(_) {
|
||||
//this.video.onseeked = function() {console.log('seeked')};
|
||||
}
|
||||
AVMerge.prototype.close = function() {
|
||||
if (this.closed)
|
||||
return;
|
||||
this.closed = true;
|
||||
this.videoStream.close();
|
||||
this.audioStream.close();
|
||||
this.timeUpdateEvt.remove();
|
||||
|
Loading…
x
Reference in New Issue
Block a user