Skip to content

Commit

Permalink
Prevent immediate level switch from performing unnecessary pause and …
Browse files Browse the repository at this point in the history
…seeks as this can interfere with 3rd party application state
  • Loading branch information
Rob Walch committed Jul 24, 2020
1 parent 7d33a7f commit 2eb5f60
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controller/stream-controller.js
Expand Up @@ -571,7 +571,9 @@ class StreamController extends BaseStreamController {
let media = this.media, previouslyPaused;
if (media) {
previouslyPaused = media.paused;
media.pause();
if (!previouslyPaused) {
media.pause();
}
} else {
// don't restart playback after instant level switch in case media not attached
previouslyPaused = true;
Expand All @@ -597,7 +599,7 @@ class StreamController extends BaseStreamController {
const media = this.media;
if (media && media.buffered.length) {
this.immediateSwitch = false;
if (BufferHelper.isBuffered(media, media.currentTime)) {
if (media.currentTime > 0 && BufferHelper.isBuffered(media, media.currentTime)) {
// only nudge if currentTime is buffered
media.currentTime -= 0.0001;
}
Expand Down

0 comments on commit 2eb5f60

Please sign in to comment.