Skip to content
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: stutter after fast quality change in IE/Edge #213

Merged
merged 9 commits into from
Sep 21, 2018

Conversation

alex-barstow
Copy link
Contributor

Description

This tweaks the changes in #113 to fix a stutter in IE/Edge after the buffer is cleared. In the initial PR, seeking in place was sufficient to address this issue in Chrome, but we need to seek further behind/ahead of the current time in order to also fix the issue in IE/Edge.

Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

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

Might be good to have a test for the amount of time seeked.


if (media === this.masterPlaylistLoader_.media()) {
return;
}

this.tech_.pause();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary for us to pause? I think that may have inadvertent side effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The rendition switch occurs without a stutter even without pausing/playing, but for some reason timeupdate events continue to fire even while playback has stopped and the loading spinner isn't shown. This only happens in IE/Edge.

Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to look into that further. I'm hesitant for us to initiate a pause, as it could have inadvertent behavior with user integrations. For instance, if someone is listening to paused events to display an overlay or make another action happen, then this will cause that behavior to trigger.

this.mainSegmentLoader_.resetEverything(() => {
// Since this is not a typical seek, we avoid the seekTo method which can cause
// segments from the previously enabled rendition to load before the new playlist
// has finished loading
this.tech_.setCurrentTime(this.tech_.currentTime());
this.tech_.setCurrentTime(this.tech_.currentTime() + .04);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be seeking forwards for all browsers, or just those that are problematic?

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 was on the fence about whether it's better to minimize the scope of the forward seeking, or to omit any user agent checks and have uniform quality switch behavior across browsers. I'll defer to your judgement on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be interested to hear others' thoughts as well, but I think minimizing the scope may be better, just to limit potential impact, especially when it's only one set of browsers (IE/Edge).

@alex-barstow
Copy link
Contributor Author

Added the IE/Edge browser checks, removed the pause/play, and added additional tests

};

// makes sure the resetEverything callback is queued when sourceUpdater_.remove() gets called
this.masterPlaylistController.mainSegmentLoader_.sourceUpdater_.processedAppend_ = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

For this and below, instead of calling into private properties, would it make sense to append a segment first in the test. This might also reflect real-world usage better, as I don't believe we will switch renditions until we are in "walking forwards" mode after a segment download.


this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend');

assert.equal(this.player.currentTime(), timeBeforeSwitch, 'seeks in place on fast quality switch');
Copy link
Contributor

Choose a reason for hiding this comment

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

Although this verifies the time, I don't believe a seek is verified to have happened.


const timeBeforeSwitch = this.player.currentTime();

this.masterPlaylistController.fastQualityChange_();

this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this responding to an actual "append?" I think if the fastQualityChange happened, there would still have to be a segment request before an append would happen.


const timeBeforeSwitch = this.player.currentTime();

videojs.browser.IE_VERSION = null;
videojs.browser.IS_EDGE = true;

this.masterPlaylistController.fastQualityChange_();

this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.


const timeBeforeSwitch = this.player.currentTime();

videojs.browser.IE_VERSION = 11;
videojs.browser.IS_EDGE = false;

this.masterPlaylistController.fastQualityChange_();

this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@forbesjo forbesjo self-assigned this Sep 21, 2018
@forbesjo forbesjo merged commit 2c0d9b2 into videojs:master Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants