Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Fixing InvalidStateError in Win10 IE11 #1230

Merged
merged 4 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/playback-watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ export default class PlaybackWatcher {
}
this.logger_('initialize');

let canPlayHandler = () => this.monitorCurrentTime_();
let waitingHandler = () => this.techWaiting_();
let cancelTimerHandler = () => this.cancelTimer_();
let fixesBadSeeksHandler = () => this.fixesBadSeeks_();

this.tech_.on('seekablechanged', fixesBadSeeksHandler);
this.tech_.on('waiting', waitingHandler);
this.tech_.on(timerCancelEvents, cancelTimerHandler);
this.monitorCurrentTime_();
this.tech_.on('canplay', canPlayHandler);
Copy link
Contributor

@mjneil mjneil Aug 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should off the handler in the dispose method below like the other handlers
edit: resolved


// Define the dispose function to clean up our events
this.dispose = () => {
this.logger_('dispose');
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_);
}
Expand Down
4 changes: 4 additions & 0 deletions test/playback-watcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down