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);