Improved seek behaviour#370
Conversation
|
I removed the Chrome workaround since it was added to video.js proper in videojs/video.js#5533. I feel that the same should be done for the IE/Edge workaround as well. |
|
Also, let me know if you think I missed any necessary tests. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
ಠ_ಠ |
|
This needs a rebase and otherwise is good to go. |
3386f66 to
4b521b7
Compare
squarebracket
left a comment
There was a problem hiding this comment.
Rebased to master. I haven't yet tested post-rebase but it's ready for review.
| // before we can download the next segment. when we're rebuffering, | ||
| // there should be a spinner over the video, but this requires a bit | ||
| // of finagling for some browsers. | ||
| if (videojs.browser.IS_EDGE || videojs.browser.IE_VERSION) { |
There was a problem hiding this comment.
IMO this should be taken care of in video.js. Thoughts?
| let buffered = this.buffered_(); | ||
|
|
||
| if (isEndOfStream || | ||
| (buffered.end(0) - this.currentTime_()) >= (this.roundTrip / 1000) + 1) { |
There was a problem hiding this comment.
Do I need to make sure buffered.length > 0 here?
|
I have run into a problem with this patch when running my "load the same live source 100 times" test. Without this patch, this is what happens when loading a live stream:
With this patch, this changes to the following:
This usually works, but sometimes http-streaming/src/master-playlist-controller.js Lines 307 to 310 in fbd615c Instead, segment I've fixed this by simply gating downswitching during seek to |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
This change requires videojs/video.js#5024, which takes care of the UI and API aspects of buffering.
SourceHandlers that use MSE have a problem: if they push a segment into a
SourceBufferand then seek close to the end, playback will stall and/or there will be a massive downswitch in quality. The general approach to fixing this that was discussed on slack was by setting the playback rate of the player to zero, buffering all that was required, and then restoring the previous playback rate. In my implementation, I've done this in the source handler.Additionally, there is a new
seekDeadlineoption for the source handler which controls how long a seek should take to resume. When seeking, the master playlist controller calculates the maximum bandwidth playlist for all requests needed to complete a full seek. The calculations are done usingmaxBandwidthForDeadlineSelector, which is essentially justminRebufferMaxBandwidthSelectorrenamed.Taken together, this makes the seeking behavior vastly improved:
currentTimeof video is updated, playback pauses, spinner appears,player.seeking()is now trueplayer.seeking()is now falsebufferLowWaterLineseconds after resuming playbackSpecific Changes proposed
seekDeadlineoption for controlling how long a seek should take to resumeseeking()is deferred from the tech to the SourceHandlersetCurrentTimestores the current playback rate and sets the tech's playback rate to zeroSegmentLoader#handleUpdateEnd_, if we have enough buffer that we can make another request in that time, firebufferedonthisMasterPlaylistControllerreceives thebufferedevent and restores the previous playback rateminRebufferMaxBandwidthSelectorhas been renamed tomaxBandwidthForDeadlineSelector, and made more genericneedsExtraRequestcallback which is used to determine whether another request must be maderebufferingImpact, it now just returnsrequestTimeEstimatemaxBandwidthForDeadlineSelector,abortRequestEarly_uses either the current calculation (when not seeking) or the time elapsed since seeking startedabortRequestEarly_is now a bit simpler because it's now using therequestTimeEstimateinstead ofrebufferingImpactfastQualityChange_andsmoothQualityChange_now accept anextPlaylistoption which will be used instead ofthis.selectPlaylist()when givenRequirements Checklist
Notes
bufferLowWaterLineseconds post-seek before an upswitch is made to the pre-seek quality. Eventually I'd like to fix this, but I think for now it's not super important.playbackRate, after the first segment is downloaded, the video frame changes to be the frame atcurrentTimewhile the second segment is downloaded. This is kinda weird from a UI point of view, but I think it's acceptable.