Fix server config not factored in determining active session

This commit is contained in:
ronaldheft
2022-08-23 18:56:08 -04:00
parent 2a2ebefeb9
commit 10ddc1c911
3 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -38,7 +38,9 @@ public class AbsAudioPlayer: CAPPlugin {
do {
// Fetch the most recent active session
let activeSession = try await Realm().objects(PlaybackSession.self).where({ $0.isActiveSession == true }).last?.freeze()
let activeSession = try await Realm().objects(PlaybackSession.self).where({
$0.isActiveSession == true && $0.serverConnectionConfigId == Store.serverConfig?.id
}).last?.freeze()
if let activeSession = activeSession {
await PlayerProgress.shared.syncFromServer()
try self.startPlaybackSession(activeSession, playWhenReady: false, playbackRate: PlayerSettings.main().playbackRate)