Stop playback if live broadcast has ended and there is no more chunk to listen

This commit is contained in:
Florian Renaud 2022-11-24 18:10:36 +01:00
parent 4be954eeeb
commit c2d5908542

View file

@ -376,6 +376,11 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
// Notify live mode change to all the listeners attached to the current voice broadcast id
listeners[voiceBroadcastId]?.forEach { listener -> listener.onLiveModeChanged(isLiveListening) }
}
// Live has ended and last chunk has been reached, we can stop the playback
if (!isLiveListening && playingState == State.BUFFERING && playlist.currentSequence == mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence) {
stop()
}
}
private fun onNextMediaPlayerStarted(mp: MediaPlayer) {