fix(platform): gate audio passthrough support

This commit is contained in:
edde746
2026-06-15 13:28:10 +02:00
parent b5a9f09f12
commit ba22dca9e5
2 changed files with 13 additions and 0 deletions
+5
View File
@@ -210,6 +210,11 @@ class PlatformDetector {
return Platform.isAndroid || Platform.isIOS || Platform.isMacOS || Platform.isLinux || Platform.isWindows; 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() { static bool supportsPictureInPicture() {
return !TvDetectionService._tvosBuild && !isTV() && (Platform.isAndroid || Platform.isIOS || Platform.isMacOS); return !TvDetectionService._tvosBuild && !isTV() && (Platform.isAndroid || Platform.isIOS || Platform.isMacOS);
} }
+8
View File
@@ -88,6 +88,14 @@ void main() {
}); });
group('SettingsService platform gates', () { 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 { test('forces external player off on Apple TV even when stored enabled', () async {
final settings = await SettingsService.getInstance(); final settings = await SettingsService.getInstance();
await settings.write(SettingsService.useExternalPlayer, true); await settings.write(SettingsService.useExternalPlayer, true);