diff --git a/lib/screens/video_player/parts/companion_remote.dart b/lib/screens/video_player/parts/companion_remote.dart index 7b614823..ccd393cc 100644 --- a/lib/screens/video_player/parts/companion_remote.dart +++ b/lib/screens/video_player/parts/companion_remote.dart @@ -102,7 +102,7 @@ extension _VideoPlayerCompanionRemoteMethods on VideoPlayerScreenState { void _cycleAudioTrack() => _trackManager?.cycleAudioTrack(); Future _toggleFullscreen() async { - if (PlatformDetector.isMobile(context)) return; + if (!PlatformDetector.isDesktopOS()) return; await FullscreenStateManager().toggleFullscreen(); } } diff --git a/lib/services/fullscreen_state_manager.dart b/lib/services/fullscreen_state_manager.dart index e1a36567..72c708c2 100644 --- a/lib/services/fullscreen_state_manager.dart +++ b/lib/services/fullscreen_state_manager.dart @@ -28,6 +28,8 @@ class FullscreenStateManager extends ChangeNotifier with WindowListener { /// Toggle fullscreen state, handling maximized-to-fullscreen transition on Windows/Linux Future toggleFullscreen() async { + if (!PlatformDetector.isDesktopOS()) return; + if (Platform.isMacOS) { final isCurrentlyFullscreen = await MacOSWindowService.isFullscreen(); if (isCurrentlyFullscreen) { @@ -62,6 +64,8 @@ class FullscreenStateManager extends ChangeNotifier with WindowListener { /// Enter fullscreen, preserving maximized state on Windows/Linux for restoration on exit. Future enterFullscreen() async { + if (!PlatformDetector.isDesktopOS()) return; + if (Platform.isMacOS) { await MacOSWindowService.enterFullscreen(); } else if (Platform.isWindows) { @@ -77,6 +81,8 @@ class FullscreenStateManager extends ChangeNotifier with WindowListener { /// Exit fullscreen, restoring maximized state if needed Future exitFullscreen() async { + if (!PlatformDetector.isDesktopOS()) return; + if (Platform.isMacOS) { await MacOSWindowService.exitFullscreen(); } else if (Platform.isWindows) { diff --git a/lib/widgets/video_controls/parts/visibility.dart b/lib/widgets/video_controls/parts/visibility.dart index 662959d4..d979937b 100644 --- a/lib/widgets/video_controls/parts/visibility.dart +++ b/lib/widgets/video_controls/parts/visibility.dart @@ -293,14 +293,14 @@ extension _PlexVideoControlsVisibilityMethods on _PlexVideoControlsState { } Future _toggleFullscreen() async { - if (!PlatformDetector.isMobile(context)) { - await FullscreenStateManager().toggleFullscreen(); - } + if (!PlatformDetector.isDesktopOS()) return; + await FullscreenStateManager().toggleFullscreen(); } /// Exit fullscreen if the window is actually fullscreen (async check). /// Used by ESC handler on Windows/Linux to avoid relying on _isFullscreen flag. Future _exitFullscreenIfNeeded() async { + if (!Platform.isWindows && !Platform.isLinux) return; if (await windowManager.isFullScreen()) { await FullscreenStateManager().exitFullscreen(); } @@ -318,14 +318,14 @@ extension _PlexVideoControlsVisibilityMethods on _PlexVideoControlsState { /// Toggle always-on-top window mode (desktop only) Future _toggleAlwaysOnTop() async { - if (!PlatformDetector.isMobile(context)) { - final newValue = !_isAlwaysOnTop; - await windowManager.setAlwaysOnTop(newValue); - if (!mounted) return; - _setControlsState(() { - _isAlwaysOnTop = newValue; - }); - } + if (!PlatformDetector.isDesktopOS()) return; + + final newValue = !_isAlwaysOnTop; + await windowManager.setAlwaysOnTop(newValue); + if (!mounted) return; + _setControlsState(() { + _isAlwaysOnTop = newValue; + }); } /// Show controls and optionally focus play/pause on keyboard input (desktop only)