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

fix InvalidStateError for live playback in IE11 #1266

Merged
merged 3 commits into from
Oct 10, 2017

Conversation

mjneil
Copy link
Contributor

@mjneil mjneil commented Sep 29, 2017

Live streams in IE11 throw an InvalidStateError for trying to set the currentTime while the readyState is 0.

// in buffer seeks
const isFlash =
(this.mode_ === 'flash') ||
(this.mode_ === 'auto' && !videojs.MediaSource.supportsNativeMediaSources());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I snuck this change into this PR because the mode can only be flash or html5, so checking for the case of auto is unnecessary.

this.hasPlayed_ = () => true;
});
} else {
setHasPlayed = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this set here, and not where hasPlayed_ is set? You could move this into the loadedmetadata function above, and set it on line 733 as well.

I'm mostly suggesting this because I think it will be easier from a maintenance standpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow. This function setupFirstPlay is called when play is triggered until this.hasPlayed_() returns true. Currently, with a VOD, we update hasPlayed_ to return true the first time we get a play call and we've loaded the media. Currently in a live stream, we update hasPlayed_ to true the first time we get a play call, we've loaded the media, and have calculated seekable, so that we can seek to the live point and that segmentloader knows it can start filling the buffer. Since now we have to wait for loadedmetadata from the tech in IE11 before we can seek, we wait to update hasPlayed_ until we've gotten loadedmetadata which happens after we append the first bytes to the source buffer. Since this is asynchronous, this local var setHasPlayed is used to know if we can set hasPlayed_ to true yet. Does this answer your question?

@mjneil mjneil merged commit 98c1857 into videojs:master Oct 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants