From 17aa723cd0c33e33ccf2986f6c59e3e49230415a Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 18 Sep 2026 23:59:49 +0200 Subject: [PATCH] Prefer the active instance when selecting a playback instance --- Yattee/Core/InstancesManager.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Yattee/Core/InstancesManager.swift b/Yattee/Core/InstancesManager.swift index f2afecdf..14490379 100644 --- a/Yattee/Core/InstancesManager.swift +++ b/Yattee/Core/InstancesManager.swift @@ -299,9 +299,19 @@ final class InstancesManager { // Extracted content requires Yattee Server (yt-dlp) return yatteeServerInstances.first case .global, .federated: - // YouTube content - prefer Yattee Server, fall back to other YouTube-capable instances - return enabledYatteeServerInstances.first - ?? enabledInstances.first(where: \.isYouTubeInstance) + // YouTube content - prefer Yattee Server (the active one if it is one), + // then the active instance, then any other YouTube-capable instance + let active = activeInstance + if let active, active.isYatteeServerInstance { + return active + } + if let yatteeServer = enabledYatteeServerInstances.first { + return yatteeServer + } + if let active, active.isYouTubeInstance { + return active + } + return enabledInstances.first(where: \.isYouTubeInstance) } }