fix(latency-controller): only sync live stream #5604
Merged
+6
−2
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.
This PR will...
maxLiveSyncPlaybackRate
should only work for live stream.I'm using same config (
{ maxLiveSyncPlaybackRate: 1.2 }
) to play normal playback and live stream.When playing playback, we hope users can change playback rate as needed. However, things work not quiet well.
When user changes playback rate to 2, the player will reset to 1 quickly.
To figure out what happen, I have debugged the
latency-controller.ts
file.It seems that we want to listen 'timeupdate' event when receive MEDIA_ATTACHED(https://github.com/video-dev/hls.js/blob/master/src/controller/latency-controller.ts#L153), and remove 'timeupdate' event when receive LEVEL_UPDATED(https://github.com/video-dev/hls.js/blob/master/src/controller/latency-controller.ts#L177).
Since the MEDIA_ATTACHED is triggered by _onMediaSourceOpen fired by
sourceopen
event, the order between MEDIA_ATTACHED and LEVEL_UPDATED cannot be guaranteed.When LEVEL_UPDATED triggered before MEDIA_ATTACHED, the latency tracer (mouted by 'timeupdate') will never get a chance to stop, making user unable to change playback rate.
Why is this Pull Request needed?
To make sure
maxLiveSyncPlaybackRate
config only work for live stream.Are there any points in the code the reviewer needs to double check?
Resolves issues:
Checklist