mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-21 09:41:23 +03:00
Fix an exception when removeIncompleteTracksFromPlaylist() could be called on the wrong thread.
This commit is contained in:
parent
7209779b64
commit
8d43b935ab
@ -182,16 +182,19 @@ class MediaPlayerManager(
|
||||
createMediaController(onCreated)
|
||||
|
||||
rxBusSubscription += RxBus.activeServerChangingObservable.subscribe { oldServer ->
|
||||
if (oldServer != OFFLINE_DB_ID) {
|
||||
// When the server changes, the playlist can retain the downloaded songs.
|
||||
// Incomplete songs should be removed as the new server won't recognise them.
|
||||
removeIncompleteTracksFromPlaylist()
|
||||
DownloadService.requestStop()
|
||||
}
|
||||
if (controller is JukeboxMediaPlayer) {
|
||||
// When the server changes, the Jukebox should be released.
|
||||
// The new server won't understand the jukebox requests of the old one.
|
||||
switchToLocalPlayer()
|
||||
// Even though Rx should launch on the main thread it doesn't always :(
|
||||
mainScope.launch {
|
||||
if (oldServer != OFFLINE_DB_ID) {
|
||||
// When the server changes, the playlist can retain the downloaded songs.
|
||||
// Incomplete songs should be removed as the new server won't recognise them.
|
||||
removeIncompleteTracksFromPlaylist()
|
||||
DownloadService.requestStop()
|
||||
}
|
||||
if (controller is JukeboxMediaPlayer) {
|
||||
// When the server changes, the Jukebox should be released.
|
||||
// The new server won't understand the jukebox requests of the old one.
|
||||
switchToLocalPlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user