Improve playing state updates

This commit is contained in:
Florian Renaud 2022-11-04 23:20:54 +01:00
parent 266236c1e5
commit a47e3c1233

View File

@ -74,10 +74,12 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
override var playingState = State.IDLE
@MainThread
set(value) {
if (field != value) {
Timber.w("## VoiceBroadcastPlayer state: $field -> $value")
field = value
onPlayingStateChanged(value)
}
}
/** Map voiceBroadcastId to listeners.*/
private val listeners: MutableMap<String, CopyOnWriteArrayList<Listener>> = mutableMapOf()
@ -299,6 +301,7 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
playlist.currentSequence = playlist.currentSequence?.inc()
currentMediaPlayer = mp
nextMediaPlayer = null
playingState = State.PLAYING
prepareNextMediaPlayer()
}
}