mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 10:25:02 +00:00
Expose Background Playback toggle on tvOS, default off
Surfaces the existing iOS/macOS Background Playback setting in the tvOS Playback settings, defaulting to off so audio stops when the user leaves the app via the TV button. Pauses playback on .background/.inactive when the toggle is off, regardless of audio route — the user's setting wins over AirPlay/HomePod handoff. Also auto-shows the tvOS player controls when returning to foreground so the paused state is immediately visible and actionable.
This commit is contained in:
@@ -650,6 +650,15 @@ final class PlayerService {
|
||||
#else
|
||||
let isPiPActive = false
|
||||
#endif
|
||||
|
||||
#if os(tvOS)
|
||||
LoggingService.shared.debug("PlayerService[tvOS-bg]: phase=\(phase) bgEnabled=\(backgroundEnabled) playbackState=\(state.playbackState)", category: .player)
|
||||
if (phase == .background || phase == .inactive), !backgroundEnabled, state.playbackState == .playing {
|
||||
LoggingService.shared.debug("PlayerService[tvOS-bg]: pausing playback (phase=\(phase), backgroundPlaybackEnabled=false)", category: .player)
|
||||
pause()
|
||||
}
|
||||
#endif
|
||||
|
||||
currentBackend?.handleScenePhase(phase, backgroundEnabled: backgroundEnabled, isPiPActive: isPiPActive)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user