diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-08-25 14:29:40 -0700 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-08-29 21:03:36 -0500 |
commit | 5ff216d1ba30e80859cd9d02b50671d31e1678bb (patch) | |
tree | 420409436fbc89da0b97ebdaed77daaf1746d8ae /youtube | |
parent | 70eb5cc94fbfd9cd27b2b72dc01e68351a204e26 (diff) | |
download | yt-local-5ff216d1ba30e80859cd9d02b50671d31e1678bb.tar.lz yt-local-5ff216d1ba30e80859cd9d02b50671d31e1678bb.tar.xz yt-local-5ff216d1ba30e80859cd9d02b50671d31e1678bb.zip |
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>
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/static/js/av-merge.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js index d05d2c1..13551fb 100644 --- a/youtube/static/js/av-merge.js +++ b/youtube/static/js/av-merge.js @@ -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(); |