mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Merge pull request #7963 from vector-im/bugfix/fre/fix_vb_scrubbing
Voice Broadcast - Fix playback scrubbing not working if playback is stopped
This commit is contained in:
commit
f498fe6fd9
2 changed files with 11 additions and 9 deletions
1
changelog.d/7961.bugfix
Normal file
1
changelog.d/7961.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Voice Broadcast - Fix playback scrubbing not working if the playback is in a stopped state
|
|
@ -182,15 +182,16 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
State.Buffering -> {
|
||||
val nextItem = if (isLiveListening && playlist.currentSequence == null) {
|
||||
// live listening, jump to the last item if playback has not started
|
||||
playlist.lastOrNull()
|
||||
} else {
|
||||
// not live or playback already started, request next item
|
||||
playlist.getNextItem()
|
||||
}
|
||||
if (nextItem != null) {
|
||||
startPlayback(nextItem.startTime)
|
||||
val savedPosition = currentVoiceBroadcast?.voiceBroadcastId?.let { playbackTracker.getPlaybackTime(it) }
|
||||
when {
|
||||
// resume playback from the next sequence item
|
||||
playlist.currentSequence != null -> playlist.getNextItem()?.let { startPlayback(it.startTime) }
|
||||
// resume playback from the saved position, if any
|
||||
savedPosition != null -> startPlayback(savedPosition)
|
||||
// live listening, jump to the last item
|
||||
isLiveListening -> playlist.lastOrNull()?.let { startPlayback(it.startTime) }
|
||||
// start playback from the beginning
|
||||
else -> startPlayback(0)
|
||||
}
|
||||
}
|
||||
is State.Error -> Unit
|
||||
|
|
Loading…
Reference in a new issue