seekBy always jumps to position 0 when the duration is unknown #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
PlayerController.seekBy()(PlayerController.kt:160-163) clamps the target position:Player.getDuration()returnsC.TIME_UNSET— a large negativeLong— whenever the duration is not (yet) known.TIME_UNSET.coerceAtLeast(0)is0, so the range collapses to0..0and every seek resolves toseekTo(0), regardless of direction or current position.Failure scenario
Playback of anything whose duration has not resolved yet (right after
prepare(), or a live source that never reports one) whileisCurrentMediaItemSeekableis true: the user presses right to skip forward and the stream jumps to the very beginning instead. Pressing left does the same.Suggested fix
Skip the upper clamp when the duration is unknown:
Found by multi-agent code review; verified against current
PlayerController.kt.Fixed in
dd612fc, shipped in v0.9.0.seekBy()no longer clamps against an unknown duration:With
C.TIME_UNSETthe upper bound is simply not applied, so a forward seek moves forward instead of collapsing to position 0.