Skip to content

Commit

Permalink
stream-controller: protect immediateLevelSwitch() against undefined e…
Browse files Browse the repository at this point in the history
  • Loading branch information
mangui committed Jul 4, 2016
1 parent ecb284a commit 5ddffac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,15 @@ class StreamController extends EventHandler {
logger.log('immediateLevelSwitch');
if (!this.immediateSwitch) {
this.immediateSwitch = true;
this.previouslyPaused = this.media.paused;
this.media.pause();
let media = this.media, previouslyPaused;
if (media) {
previouslyPaused = media.paused;
media.pause();
} else {
// don't restart playback after instant level switch in case media not attached
previouslyPaused = true;
}
this.previouslyPaused = previouslyPaused;
}
var fragCurrent = this.fragCurrent;
if (fragCurrent && fragCurrent.loader) {
Expand Down

0 comments on commit 5ddffac

Please sign in to comment.