-
Notifications
You must be signed in to change notification settings - Fork 793
Fixing InvalidStateError in Win10 IE11 #1230
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could use unit tests.
src/playback-watcher.js
Outdated
@@ -51,7 +51,9 @@ export default class PlaybackWatcher { | |||
this.tech_.on('seekablechanged', fixesBadSeeksHandler); | |||
this.tech_.on('waiting', waitingHandler); | |||
this.tech_.on(timerCancelEvents, cancelTimerHandler); | |||
this.monitorCurrentTime_(); | |||
if (this.tech_.hasStarted_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the player has not started yet, but starts later, will PlaybackWatcher end up running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. I think we would have to wait for either the ready
or canplay
event from the tech
src/playback-watcher.js
Outdated
@@ -51,7 +51,9 @@ export default class PlaybackWatcher { | |||
this.tech_.on('seekablechanged', fixesBadSeeksHandler); | |||
this.tech_.on('waiting', waitingHandler); | |||
this.tech_.on(timerCancelEvents, cancelTimerHandler); | |||
this.monitorCurrentTime_(); | |||
if (this.tech_.hasStarted_ || this.tech_.isReady_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the tech is not ready by the time this constructor runs, this will continue to be broken. You should setup an event listener for the ready
event instead of checking the private variables on the tech. The tech has a this.tech_.ready()
function that will either setup a listener for when the ready
event will be fired, or will run your callback immediately if the tech is already ready
.
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); |
There was a problem hiding this comment.
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
Description
Fixing InvalidStateError logged on console in Windows 10, IE11
Specific Changes proposed
Please list the specific changes involved in this pull request.
Requirements Checklist