From 3c5739eefda51aba358cc4d115f2acf4fac0d800 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:00:31 +0100 Subject: [PATCH] fix: don't pause on partial focus loss closes #183 --- lib/screens/video_player_screen.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index e3d27b8e..86f840a3 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -185,17 +185,19 @@ class VideoPlayerScreenState extends State with WidgetsBindin switch (state) { case AppLifecycleState.inactive: - // App is inactive (Control Center, Notification Screen, etc.) - // Pause video but keep media controls for quick resume (mobile only) + // App is inactive (notification shade, split-screen, etc.) + // Don't pause - user may still be watching + break; + case AppLifecycleState.hidden: + // App is being hidden (user is switching away) + // Pause video since we don't support background playback (mobile only) if (PlatformDetector.isMobile(context)) { if (player != null && _isPlayerInitialized) { _wasPlayingBeforeInactive = player!.state.playing; if (_wasPlayingBeforeInactive) { player!.pause(); - appLogger.d('Video paused due to app becoming inactive (mobile)'); + appLogger.d('Video paused due to app being hidden (mobile)'); } - // Keep media controls active on mobile for quick resume - _updateMediaControlsPlaybackState(); } } break; @@ -235,8 +237,7 @@ class VideoPlayerScreenState extends State with WidgetsBindin } break; case AppLifecycleState.detached: - case AppLifecycleState.hidden: - // No action needed for these states + // No action needed for this state break; } }