fix: disable ambient lighting in picture-in-picture mode

closes #528
This commit is contained in:
edde746
2026-02-24 17:05:41 +01:00
parent d40890c344
commit 2f488bd395
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -1154,7 +1154,13 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
final isInPip = _videoPIPManager!.isPipActive.value;
// Only handle exit - entry is handled by onBeforeEnterPip callback
if (!isInPip) {
final restoreAmbient = _videoFilterManager!.hadAmbientLightingBeforePip;
_videoFilterManager!.exitPipMode();
// Restore ambient lighting if it was active before PiP
if (restoreAmbient) {
_videoFilterManager!.clearPipAmbientLightingFlag();
_restoreAmbientLighting();
}
}
}
+16
View File
@@ -26,6 +26,9 @@ class VideoFilterManager {
/// Store the boxFitMode before entering PiP so it can be restored
int? _prePipBoxFitMode;
/// Store whether ambient lighting was active before entering PiP
bool? _prePipAmbientLighting;
/// Ambient lighting service reference - when active, video-aspect-override is managed by ambient lighting
AmbientLightingService? ambientLightingService;
@@ -75,6 +78,11 @@ class VideoFilterManager {
/// Force contain mode for PiP (no cropping/stretching)
void enterPipMode() {
// Disable ambient lighting for PiP — it wastes space on blurred borders
if (ambientLightingService?.isEnabled == true) {
_prePipAmbientLighting = true;
ambientLightingService!.disable();
}
if (_boxFitMode != 0) {
_prePipBoxFitMode = _boxFitMode;
_boxFitMode = 0; // Contain mode
@@ -91,6 +99,14 @@ class VideoFilterManager {
}
}
/// Whether ambient lighting was active before entering PiP
bool get hadAmbientLightingBeforePip => _prePipAmbientLighting == true;
/// Clear the pre-PiP ambient lighting flag after restore
void clearPipAmbientLightingFlag() {
_prePipAmbientLighting = null;
}
/// Update player size when layout changes
void updatePlayerSize(Size size) {
// Check if size actually changed to avoid unnecessary updates