-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Prevent exceptions from being thrown by the MediaSource #389
Conversation
try { | ||
this.mediaSource.duration = newDuration; | ||
} catch (e) { | ||
videojs.log.warn('Failed to set media source duration', e); |
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 tried for a long time to determine the cause of this, it almost seems like a bug in firefox. Originally I thought it was due to updating
sourceBuffers or the media source not being open
but that is not the case.
76bc2da
to
7f4c552
Compare
return; | ||
} | ||
|
||
// on chrome calling endOfStream can sometimes cause an exception, |
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.
Chrome can sometimes throw a DOM exception here when endOfStream
is called. It seems like it almost always happens when:
sourceBuffers
are still updating- The
mediaSource
is no longeropen
It does seem to happen at other times though. So I think we just need to wrap this in a try catch here.
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.
Changes look good to me.
See code comments