mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-20 09:11:24 +03:00
Apply 1 suggestion(s) to 1 file(s)
This commit is contained in:
parent
8d43b935ab
commit
eab55a7837
@ -181,22 +181,23 @@ class MediaPlayerManager(
|
|||||||
|
|
||||||
createMediaController(onCreated)
|
createMediaController(onCreated)
|
||||||
|
|
||||||
rxBusSubscription += RxBus.activeServerChangingObservable.subscribe { oldServer ->
|
rxBusSubscription +=
|
||||||
// Even though Rx should launch on the main thread it doesn't always :(
|
RxBus
|
||||||
mainScope.launch {
|
.activeServerChangingObservable
|
||||||
if (oldServer != OFFLINE_DB_ID) {
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
// When the server changes, the playlist can retain the downloaded songs.
|
.subscribe { oldServer ->
|
||||||
// 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()
|
||||||
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rxBusSubscription += RxBus.activeServerChangedObservable.subscribe {
|
rxBusSubscription += RxBus.activeServerChangedObservable.subscribe {
|
||||||
val jukebox = activeServerProvider.getActiveServer().jukeboxByDefault
|
val jukebox = activeServerProvider.getActiveServer().jukeboxByDefault
|
||||||
|
Loading…
x
Reference in New Issue
Block a user