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,9 +74,11 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
override var playingState = State.IDLE
@MainThread
set(value) {
Timber.w("## VoiceBroadcastPlayer state: $field -> $value")
field = value
onPlayingStateChanged(value)
if (field != value) {
Timber.w("## VoiceBroadcastPlayer state: $field -> $value")
field = value
onPlayingStateChanged(value)
}
}
/** Map voiceBroadcastId to listeners.*/
@ -299,6 +301,7 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
playlist.currentSequence = playlist.currentSequence?.inc()
currentMediaPlayer = mp
nextMediaPlayer = null
playingState = State.PLAYING
prepareNextMediaPlayer()
}
}