diff --git a/changelog.d/7961.bugfix b/changelog.d/7961.bugfix new file mode 100644 index 0000000000..86c53b46bb --- /dev/null +++ b/changelog.d/7961.bugfix @@ -0,0 +1 @@ + Voice Broadcast - Fix playback scrubbing not working if the playback is in a stopped state diff --git a/vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt b/vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt index 2e1600e4e2..d18638fc28 100644 --- a/vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt +++ b/vector/src/main/java/im/vector/app/features/voicebroadcast/listening/VoiceBroadcastPlayerImpl.kt @@ -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