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 Jun 29, 2016
1 parent 91c001d commit 8ca82e7
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 @@ -489,8 +489,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 8ca82e7

Please sign in to comment.