Browse Source

Fixing InvalidStateError in Win10 IE11 (#1230)

pull/6/head
shahlabs 8 years ago
committed by Matthew Neil
parent
commit
c07e224436
  1. 4
      src/playback-watcher.js
  2. 4
      test/playback-watcher.test.js

4
src/playback-watcher.js

@ -44,6 +44,7 @@ export default class PlaybackWatcher {
}
this.logger_('initialize');
let canPlayHandler = () => this.monitorCurrentTime_();
let waitingHandler = () => this.techWaiting_();
let cancelTimerHandler = () => this.cancelTimer_();
let fixesBadSeeksHandler = () => this.fixesBadSeeks_();
@ -51,7 +52,7 @@ export default class PlaybackWatcher {
this.tech_.on('seekablechanged', fixesBadSeeksHandler);
this.tech_.on('waiting', waitingHandler);
this.tech_.on(timerCancelEvents, cancelTimerHandler);
this.monitorCurrentTime_();
this.tech_.on('canplay', canPlayHandler);
// Define the dispose function to clean up our events
this.dispose = () => {
@ -59,6 +60,7 @@ export default class PlaybackWatcher {
this.tech_.off('seekablechanged', fixesBadSeeksHandler);
this.tech_.off('waiting', waitingHandler);
this.tech_.off(timerCancelEvents, cancelTimerHandler);
this.tech_.off('canplay', canPlayHandler);
if (this.checkCurrentTimeTimeout_) {
window.clearTimeout(this.checkCurrentTimeTimeout_);
}

4
test/playback-watcher.test.js

@ -58,6 +58,7 @@ QUnit.test('skips over gap in firefox with waiting event', function(assert) {
this.clock.tick(1);
standardXHRResponse(this.requests.shift());
openMediaSource(this.player, this.clock);
this.player.tech_.trigger('canplay');
this.player.tech_.trigger('play');
this.player.tech_.trigger('playing');
this.clock.tick(1);
@ -101,6 +102,7 @@ QUnit.test('skips over gap in chrome without waiting event', function(assert) {
this.clock.tick(1);
standardXHRResponse(this.requests.shift());
openMediaSource(this.player, this.clock);
this.player.tech_.trigger('canplay');
this.player.tech_.trigger('play');
this.player.tech_.trigger('playing');
this.clock.tick(1);
@ -217,6 +219,7 @@ QUnit.test('seeks to current time when stuck inside buffered region', function(a
this.clock.tick(1);
standardXHRResponse(this.requests.shift());
openMediaSource(this.player, this.clock);
this.player.tech_.trigger('canplay');
this.player.tech_.trigger('play');
this.player.tech_.trigger('playing');
this.clock.tick(1);
@ -304,6 +307,7 @@ QUnit.test('does not seek to current time when stuck near edge of buffered regio
this.clock.tick(1);
standardXHRResponse(this.requests.shift());
openMediaSource(this.player, this.clock);
this.player.tech_.trigger('canplay');
this.player.tech_.trigger('play');
this.player.tech_.trigger('playing');
this.clock.tick(1);

Loading…
Cancel
Save