-
Notifications
You must be signed in to change notification settings - Fork 425
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
forbesjo
merged 9 commits into
videojs:master
from
alex-barstow:fix-fastqualityChange-IE
Sep 21, 2018
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5076ee2
fix fastQualityChange on IE/Edge
alex-barstow 062e9cd
seek ahead .04
alex-barstow 1854fe8
linting
alex-barstow 265c0b9
add test for forward seek
alex-barstow cdc4608
remove play/pause, add browser checks, add new tests
alex-barstow e9a61c2
remove unused variable
alex-barstow 399ad49
improve tests
alex-barstow 408e41b
add more comments to tests
alex-barstow 01b16cf
reset browser property values at end of tests
alex-barstow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,6 +375,105 @@ QUnit.test('resets everything for a fast quality change', function(assert) { | |
assert.deepEqual(removeFuncArgs, {start: 0, end: 60}, 'remove() called with correct arguments if media is changed'); | ||
}); | ||
|
||
QUnit.test('seeks in place for fast quality switch on non-IE/Edge browsers', function(assert) { | ||
let seeks = 0; | ||
|
||
this.masterPlaylistController.mediaSource.trigger('sourceopen'); | ||
// master | ||
this.standardXHRResponse(this.requests.shift()); | ||
// media | ||
this.standardXHRResponse(this.requests.shift()); | ||
// segment | ||
this.standardXHRResponse(this.requests.shift()); | ||
this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend'); | ||
|
||
// media is changed | ||
this.masterPlaylistController.selectPlaylist = () => { | ||
return this.masterPlaylistController.master().playlists[0]; | ||
}; | ||
|
||
this.player.tech_.on('seeking', function() { | ||
seeks++; | ||
}); | ||
|
||
const timeBeforeSwitch = this.player.currentTime(); | ||
|
||
this.masterPlaylistController.fastQualityChange_(); | ||
this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend'); | ||
this.clock.tick(1); | ||
|
||
assert.equal(this.player.currentTime(), timeBeforeSwitch, 'current time remains the same on fast quality switch'); | ||
assert.equal(seeks, 1, 'seek event occurs on fast quality switch'); | ||
}); | ||
|
||
QUnit.test('seeks forward 0.04 sec for fast quality switch on Edge', function(assert) { | ||
let seeks = 0; | ||
|
||
this.masterPlaylistController.mediaSource.trigger('sourceopen'); | ||
// master | ||
this.standardXHRResponse(this.requests.shift()); | ||
// media | ||
this.standardXHRResponse(this.requests.shift()); | ||
// segment | ||
this.standardXHRResponse(this.requests.shift()); | ||
this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend'); | ||
|
||
// media is changed | ||
this.masterPlaylistController.selectPlaylist = () => { | ||
return this.masterPlaylistController.master().playlists[0]; | ||
}; | ||
|
||
this.player.tech_.on('seeking', function() { | ||
seeks++; | ||
}); | ||
|
||
const timeBeforeSwitch = this.player.currentTime(); | ||
|
||
videojs.browser.IE_VERSION = null; | ||
gesinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
videojs.browser.IS_EDGE = true; | ||
|
||
this.masterPlaylistController.fastQualityChange_(); | ||
this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
this.clock.tick(1); | ||
|
||
assert.equal(this.player.currentTime(), timeBeforeSwitch + 0.04, 'seeks forward on fast quality switch'); | ||
assert.equal(seeks, 1, 'seek event occurs on fast quality switch'); | ||
}); | ||
|
||
QUnit.test('seeks forward 0.04 sec for fast quality switch on IE', function(assert) { | ||
let seeks = 0; | ||
|
||
this.masterPlaylistController.mediaSource.trigger('sourceopen'); | ||
// master | ||
this.standardXHRResponse(this.requests.shift()); | ||
// media | ||
this.standardXHRResponse(this.requests.shift()); | ||
// segment | ||
this.standardXHRResponse(this.requests.shift()); | ||
this.masterPlaylistController.mediaSource.sourceBuffers[0].trigger('updateend'); | ||
|
||
// media is changed | ||
this.masterPlaylistController.selectPlaylist = () => { | ||
return this.masterPlaylistController.master().playlists[0]; | ||
}; | ||
|
||
this.player.tech_.on('seeking', function() { | ||
seeks++; | ||
}); | ||
|
||
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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
this.clock.tick(1); | ||
|
||
assert.equal(this.player.currentTime(), timeBeforeSwitch + 0.04, 'seeks forward on fast quality switch'); | ||
assert.equal(seeks, 1, 'seek event occurs on fast quality switch'); | ||
}); | ||
|
||
QUnit.test('audio segment loader is reset on audio track change', function(assert) { | ||
this.requests.length = 0; | ||
this.player = createPlayer(); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.