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)
|
createMediaController(onCreated)
|
||||||
|
|
||||||
rxBusSubscription += RxBus.activeServerChangingObservable.subscribe { oldServer ->
|
rxBusSubscription += RxBus.activeServerChangingObservable.subscribe { oldServer ->
|
||||||
if (oldServer != OFFLINE_DB_ID) {
|
// Even though Rx should launch on the main thread it doesn't always :(
|
||||||
// When the server changes, the playlist can retain the downloaded songs.
|
mainScope.launch {
|
||||||
// Incomplete songs should be removed as the new server won't recognise them.
|
if (oldServer != OFFLINE_DB_ID) {
|
||||||
removeIncompleteTracksFromPlaylist()
|
// When the server changes, the playlist can retain the downloaded songs.
|
||||||
DownloadService.requestStop()
|
// Incomplete songs should be removed as the new server won't recognise them.
|
||||||
}
|
removeIncompleteTracksFromPlaylist()
|
||||||
if (controller is JukeboxMediaPlayer) {
|
DownloadService.requestStop()
|
||||||
// When the server changes, the Jukebox should be released.
|
}
|
||||||
// The new server won't understand the jukebox requests of the old one.
|
if (controller is JukeboxMediaPlayer) {
|
||||||
switchToLocalPlayer()
|
// 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