diff --git a/modules/gui/macosx/windows/video/VLCMainVideoViewController.h b/modules/gui/macosx/windows/video/VLCMainVideoViewController.h index e93dd4d171..169b02d8b6 100644 --- a/modules/gui/macosx/windows/video/VLCMainVideoViewController.h +++ b/modules/gui/macosx/windows/video/VLCMainVideoViewController.h @@ -66,6 +66,7 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly) BOOL pipIsActive; @property (readonly) VLCPlaybackEndViewController *playbackEndViewController; +@property (readwrite) void (^endViewDismissHandler)(void); - (void)showControls; - (void)hideControls; diff --git a/modules/gui/macosx/windows/video/VLCMainVideoViewController.m b/modules/gui/macosx/windows/video/VLCMainVideoViewController.m index db911c8fbe..0230acdc9a 100644 --- a/modules/gui/macosx/windows/video/VLCMainVideoViewController.m +++ b/modules/gui/macosx/windows/video/VLCMainVideoViewController.m @@ -608,12 +608,17 @@ - (void)playbackEndViewReturnToLibrary:(NSNotification *)notification { - [self returnToLibrary:self]; + if (self.endViewDismissHandler) + self.endViewDismissHandler(); + else + [self returnToLibrary:self]; } - (void)playbackEndViewHide:(NSNotification *)notification { [self.playbackEndViewController.view removeFromSuperview]; + if (self.endViewDismissHandler) + self.endViewDismissHandler(); } #pragma mark - PIPViewControllerDelegate diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m index e530055361..38e867c625 100644 --- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m +++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m @@ -531,16 +531,22 @@ static int WindowFloatOnTop(vlc_object_t *obj, const BOOL endOfPlaybackScreenEnabled = [NSUserDefaults.standardUserDefaults boolForKey:VLCPlaybackEndViewEnabledKey]; - // we need to check that the player itself is in a stopped state. Removal of the active video - // can be triggered by more than just end of playback (e.g. disabling the video track). - if (!decorativeViewVisible && endOfPlaybackScreenEnabled && playerController.playerState == VLC_PLAYER_STATE_STOPPED) { - [videoWindow.videoViewController displayPlaybackEndView]; - } else if (!decorativeViewVisible) { + + void (^windowVideoDismissProcedure)(void) = ^{ if (videoWindow.class == VLCLibraryWindow.class && !videoWindow.videoViewController.view.hidden) { [(VLCLibraryWindow *)videoWindow disableVideoPlaybackAppearance]; } else { [videoWindow close]; } + }; + + // we need to check that the player itself is in a stopped state. Removal of the active video + // can be triggered by more than just end of playback (e.g. disabling the video track). + if (!decorativeViewVisible && endOfPlaybackScreenEnabled && playerController.playerState == VLC_PLAYER_STATE_STOPPED) { + [videoWindow.videoViewController displayPlaybackEndView]; + videoWindow.videoViewController.endViewDismissHandler = windowVideoDismissProcedure; + } else if (!decorativeViewVisible) { + windowVideoDismissProcedure(); } [NSAnimationContext endGrouping];