From ba22dca9e518c4f7a103f822a857684a9198a20f Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Mon, 15 Jun 2026 13:28:10 +0200 Subject: [PATCH] fix(platform): gate audio passthrough support --- lib/utils/platform_detector.dart | 5 +++++ test/services/settings_service_test.dart | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/utils/platform_detector.dart b/lib/utils/platform_detector.dart index 7d5547d1..4a19da65 100644 --- a/lib/utils/platform_detector.dart +++ b/lib/utils/platform_detector.dart @@ -210,6 +210,11 @@ class PlatformDetector { return Platform.isAndroid || Platform.isIOS || Platform.isMacOS || Platform.isLinux || Platform.isWindows; } + static bool supportsAudioPassthrough() { + if (TvDetectionService._tvosBuild || isAppleTV()) return false; + return isDesktopOS() || (Platform.isAndroid && isTV()); + } + static bool supportsPictureInPicture() { return !TvDetectionService._tvosBuild && !isTV() && (Platform.isAndroid || Platform.isIOS || Platform.isMacOS); } diff --git a/test/services/settings_service_test.dart b/test/services/settings_service_test.dart index 2829c2a8..fa299a59 100644 --- a/test/services/settings_service_test.dart +++ b/test/services/settings_service_test.dart @@ -88,6 +88,14 @@ void main() { }); group('SettingsService platform gates', () { + test('audio passthrough stays available on desktop but not Apple TV', () { + expect(PlatformDetector.supportsAudioPassthrough(), isTrue); + + TvDetectionService.debugSetAppleTVOverride(true); + + expect(PlatformDetector.supportsAudioPassthrough(), isFalse); + }); + test('forces external player off on Apple TV even when stored enabled', () async { final settings = await SettingsService.getInstance(); await settings.write(SettingsService.useExternalPlayer, true);