mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-26 17:14:59 +01:00
Handle voice broadcast deletion on listener side
This commit is contained in:
parent
2d60e49205
commit
f436de1230
@ -145,19 +145,25 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
||||
|
||||
playingState = State.BUFFERING
|
||||
|
||||
observeVoiceBroadcastLiveState(voiceBroadcast)
|
||||
observeVoiceBroadcastStateEvent(voiceBroadcast)
|
||||
fetchPlaylistAndStartPlayback(voiceBroadcast)
|
||||
}
|
||||
|
||||
private fun observeVoiceBroadcastLiveState(voiceBroadcast: VoiceBroadcast) {
|
||||
private fun observeVoiceBroadcastStateEvent(voiceBroadcast: VoiceBroadcast) {
|
||||
voiceBroadcastStateObserver = getVoiceBroadcastEventUseCase.execute(voiceBroadcast)
|
||||
.onEach {
|
||||
currentVoiceBroadcastEvent = it.getOrNull()
|
||||
updateLiveListeningMode()
|
||||
}
|
||||
.onEach { onVoiceBroadcastStateEventUpdated(it.getOrNull()) }
|
||||
.launchIn(sessionScope)
|
||||
}
|
||||
|
||||
private fun onVoiceBroadcastStateEventUpdated(event: VoiceBroadcastEvent?) {
|
||||
if (event == null) {
|
||||
stop()
|
||||
} else {
|
||||
currentVoiceBroadcastEvent = event
|
||||
updateLiveListeningMode()
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchPlaylistAndStartPlayback(voiceBroadcast: VoiceBroadcast) {
|
||||
fetchPlaylistTask = getLiveVoiceBroadcastChunksUseCase.execute(voiceBroadcast)
|
||||
.onEach {
|
||||
|
Loading…
Reference in New Issue
Block a user