[vlc-commits] [Git][videolan/vlc][master] macosx: Fix Picture-in-Picture enablement in macOS 26

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Mar 12 15:30:39 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
362c190d by Claudio Cambra at 2026-03-12T15:04:36+01:00
macosx: Fix Picture-in-Picture enablement in macOS 26

Now we need to manually invoke presentViewControllerAsPictureInPicture

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


1 changed file:

- modules/gui/macosx/windows/video/VLCMainVideoViewController.m


Changes:

=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -644,23 +644,27 @@ NSString * const VLCUseClassicVideoPlayerLayoutKey = @"VLCUseClassicVideoPlayerL
     _pipViewController.title = window.title;
     
     __weak typeof(self) weakSelf = self;
-    
-    if (controller.currentMediaIsAudioOnly) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            typeof(self) strongSelf = weakSelf;
-            if (strongSelf && strongSelf->_voutViewController.presentingViewController == nil) {
-                [strongSelf->_pipViewController presentViewControllerAsPictureInPicture:strongSelf->_voutViewController];
-            }
-        });
-    } else {
-        _voutViewController.boundsChangeHandler = ^{
-            typeof(self) strongSelf = weakSelf;
-            if (strongSelf && strongSelf->_voutViewController.presentingViewController == nil) {
-                [strongSelf->_pipViewController presentViewControllerAsPictureInPicture:strongSelf->_voutViewController];
-            }
-        };
+
+    void (^presentVcAsPip)(void) = ^() {
+        typeof(self) strongSelf = weakSelf;
+        if (strongSelf && strongSelf->_voutViewController.presentingViewController == nil) {
+            [strongSelf->_pipViewController presentViewControllerAsPictureInPicture:strongSelf->_voutViewController];
+        }
+    };
+
+    if (!controller.currentMediaIsAudioOnly) {
+        _voutViewController.boundsChangeHandler = presentVcAsPip;
     }
-    
+
+    // Present PiP asynchronously. Previously the video path waited for
+    // PIPVoutViewController's viewDidLayout to fire via boundsChangeHandler, but
+    // on macOS 26 Tahoe the detached view never receives a layout pass, so the
+    // handler never fired. The acquired view already has valid bounds so we can
+    // present immediately on the next run-loop cycle for both paths.
+    dispatch_async(dispatch_get_main_queue(), ^{
+        presentVcAsPip();
+    });
+
     if ([window isKindOfClass:VLCLibraryWindow.class]) {
         [self returnToLibrary:self];
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/362c190d32c9a6755af4baf0772947aed4013303

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/362c190d32c9a6755af4baf0772947aed4013303
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list