Merge pull request #1107 from skoruppa/fixes-2

fix infinite buffering after audio track switch
This commit is contained in:
Nayif 2026-03-27 17:41:24 +05:30 committed by GitHub
commit a3802e2abb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,10 @@ internal fun PlayerRuntimeController.selectAudioTrack(trackIndex: Int) {
.buildUpon()
.setOverrideForType(override)
.build()
// Nudge the player to avoid infinite buffering after audio track switch
// where the new track requires a different segment.
val pos = player.currentPosition
if (pos > 0) player.seekTo((pos - 1).coerceAtLeast(0))
return
}
currentAudioIndex++