mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Fix background playback setting behavior across platforms
Hide the toggle on macOS, where apps are never suspended and playback always continues regardless of the setting. Pause playback on iOS when backgrounding with the setting disabled — the audio background mode previously kept mpv playing, making the off state a no-op. Move the continue-playing policy into PlayerService and make the backend's background render pause unconditional (PiP-gated only): it is a GPU optimization that should not depend on the setting. Also ungate the player sheet visibility handlers, which manage foreground mini player rendering unrelated to background playback.
This commit is contained in:
@@ -249,11 +249,12 @@ protocol PlayerBackend: AnyObject {
|
||||
// MARK: - Background Playback
|
||||
|
||||
/// Handle scene phase changes for background playback.
|
||||
/// Backends should pause rendering while the app is in the background;
|
||||
/// whether playback itself continues is decided by PlayerService.
|
||||
/// - Parameters:
|
||||
/// - phase: The new scene phase
|
||||
/// - backgroundEnabled: Whether background playback is enabled in settings
|
||||
/// - isPiPActive: Whether Picture-in-Picture is currently active
|
||||
func handleScenePhase(_ phase: ScenePhase, backgroundEnabled: Bool, isPiPActive: Bool)
|
||||
func handleScenePhase(_ phase: ScenePhase, isPiPActive: Bool)
|
||||
}
|
||||
|
||||
// MARK: - Default Implementations
|
||||
@@ -278,7 +279,7 @@ extension PlayerBackend {
|
||||
}
|
||||
|
||||
/// Default implementation does nothing.
|
||||
func handleScenePhase(_ phase: ScenePhase, backgroundEnabled: Bool, isPiPActive: Bool) {
|
||||
func handleScenePhase(_ phase: ScenePhase, isPiPActive: Bool) {
|
||||
// No-op by default
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user