VoiceBroadcastPlayer - Filter live broadcast state listening on the referenced eventId

This commit is contained in:
Florian Renaud 2022-10-20 13:18:46 +02:00
parent 6d6b4e5208
commit 94390697ae
1 changed files with 5 additions and 1 deletions

View File

@ -179,7 +179,11 @@ class VoiceBroadcastPlayer @Inject constructor(
room.flow()
.liveStateEvent(VoiceBroadcastConstants.STATE_ROOM_VOICE_BROADCAST_INFO, QueryStringValue.Equals(voiceBroadcastEvent.root.stateKey!!))
.unwrap()
.mapNotNull { it.asVoiceBroadcastEvent()?.content?.voiceBroadcastState }
.mapNotNull { event ->
event.asVoiceBroadcastEvent()
?.takeIf { it.reference?.eventId == eventId }
?.content?.voiceBroadcastState
}
.onEach { state ->
when (state) {
VoiceBroadcastState.STARTED,