Merge pull request #7806 from vector-im/yostyle/update_live_status
[Voice Broadcast] Update live indicator color
This commit is contained in:
commit
14290abfcf
@ -93,7 +93,7 @@ abstract class MessageVoiceBroadcastListeningItem : AbsMessageVoiceBroadcastItem
|
|||||||
override fun renderLiveIndicator(holder: Holder) {
|
override fun renderLiveIndicator(holder: Holder) {
|
||||||
when {
|
when {
|
||||||
voiceBroadcastState == null || voiceBroadcastState == VoiceBroadcastState.STOPPED -> renderNoLiveIndicator(holder)
|
voiceBroadcastState == null || voiceBroadcastState == VoiceBroadcastState.STOPPED -> renderNoLiveIndicator(holder)
|
||||||
voiceBroadcastState == VoiceBroadcastState.PAUSED || !player.isLiveListening -> renderPausedLiveIndicator(holder)
|
voiceBroadcastState == VoiceBroadcastState.PAUSED -> renderPausedLiveIndicator(holder)
|
||||||
else -> renderPlayingLiveIndicator(holder)
|
else -> renderPlayingLiveIndicator(holder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
|||||||
listeners[voiceBroadcast.voiceBroadcastId] = CopyOnWriteArrayList<Listener>().apply { add(listener) }
|
listeners[voiceBroadcast.voiceBroadcastId] = CopyOnWriteArrayList<Listener>().apply { add(listener) }
|
||||||
}
|
}
|
||||||
listener.onPlayingStateChanged(if (voiceBroadcast == currentVoiceBroadcast) playingState else State.IDLE)
|
listener.onPlayingStateChanged(if (voiceBroadcast == currentVoiceBroadcast) playingState else State.IDLE)
|
||||||
listener.onLiveModeChanged(voiceBroadcast == currentVoiceBroadcast && isLiveListening)
|
listener.onLiveModeChanged(voiceBroadcast == currentVoiceBroadcast)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removeListener(voiceBroadcast: VoiceBroadcast, listener: Listener) {
|
override fun removeListener(voiceBroadcast: VoiceBroadcast, listener: Listener) {
|
||||||
@ -373,11 +373,6 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onLiveListeningChanged(isLiveListening: Boolean) {
|
private fun onLiveListeningChanged(isLiveListening: Boolean) {
|
||||||
currentVoiceBroadcast?.voiceBroadcastId?.let { voiceBroadcastId ->
|
|
||||||
// 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
|
// Live has ended and last chunk has been reached, we can stop the playback
|
||||||
if (!isLiveListening && playingState == State.BUFFERING && playlist.currentSequence == mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence) {
|
if (!isLiveListening && playingState == State.BUFFERING && playlist.currentSequence == mostRecentVoiceBroadcastEvent?.content?.lastChunkSequence) {
|
||||||
stop()
|
stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user