Ensure main thread usage in Rx subscription.
This commit is contained in:
parent
7ba599f58c
commit
9cdba9a27a
|
@ -393,14 +393,19 @@ class PlayerFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observe playlist changes and update the UI
|
// Observe playlist changes and update the UI
|
||||||
// FIXME
|
|
||||||
rxBusSubscription += RxBus.playlistObservable.subscribe {
|
rxBusSubscription += RxBus.playlistObservable.subscribe {
|
||||||
|
// Use launch to ensure running it in the main thread
|
||||||
|
launch {
|
||||||
onPlaylistChanged()
|
onPlaylistChanged()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rxBusSubscription += RxBus.playerStateObservable.subscribe {
|
rxBusSubscription += RxBus.playerStateObservable.subscribe {
|
||||||
|
// Use launch to ensure running it in the main thread
|
||||||
|
launch {
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mediaPlayerController.controller?.addListener(object : Player.Listener {
|
mediaPlayerController.controller?.addListener(object : Player.Listener {
|
||||||
override fun onTimelineChanged(timeline: Timeline, reason: Int) {
|
override fun onTimelineChanged(timeline: Timeline, reason: Int) {
|
||||||
|
|
Loading…
Reference in New Issue