Open
Conversation
CranberrySoup
commented
Apr 7, 2026
| ) { | ||
| // We want to be PREFERRED_LIVE_OFFSET ms after the latest update, but we cannot be ahead of the middle point. | ||
| // If we are ahead of the middle point we will reach the end before the new chunk is expected to be released. | ||
| val targetPosition = maxOf(0,minOf( |
Contributor
Author
There was a problem hiding this comment.
This could be calculated using an average of several chunks. It would increase accuracy by a bit but increase complexity.
2 tasks
fire-light42
reviewed
Apr 8, 2026
|
|
||
| object LiveHelper { | ||
| private val liveManagers = WeakHashMap<Player, LiveManager>() | ||
| private val listeners = WeakHashMap<Player, Player.Listener>() |
Collaborator
There was a problem hiding this comment.
I think this would make more sense as a Pair, to make them synced.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Knowing when the user is live is actually difficult, because most livestreams are only a sliding window of 10-30 second media segments. I therefore have to calculate where the optimal player point is based on new video chunks and their durations.
From my testing it works well on all livestreams, with the caveat of the seekbar not being very useful in short live streams due to the auto-seek. I did not see a good way to circumvent this, and the seekbar is currently useless in short live streams regardless.
This could potentially fail on specially crafted live streams, but it would at worst make the video unseekable.