diff --git a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m index 3a2d941047..2512043f7f 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m +++ b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m @@ -26,6 +26,8 @@ #import "extensions/NSString+Helpers.h" #import "main/VLCMain.h" #import "playlist/VLCPlaylistController.h" +#import "playlist/VLCPlaylistItem.h" +#import "playlist/VLCPlaylistModel.h" #import "playlist/VLCPlayerController.h" #import "library/VLCInputItem.h" @@ -423,7 +425,20 @@ - (void)updateCurrentItemDisplayControls:(NSNotification *)aNotification { - VLCInputItem * const inputItem = _playerController.currentMedia; + // If we use the playlist's currentPlayingItem we will get the same item we had before. + // Let's instead grab the playlist item from the playlist model, as we know this is + // updated before the VLCPlaylistCurrentItemChanged notification is sent out + const size_t currentPlaylistIndex = _playlistController.currentPlaylistIndex; + if (currentPlaylistIndex < 0) { + return; + } + + VLCPlaylistItem * const currentPlayingItem = [_playlistController.playlistModel playlistItemAtIndex:currentPlaylistIndex]; + if (!currentPlayingItem) { + return; + } + + VLCInputItem * const inputItem = currentPlayingItem.inputItem; if (!inputItem) { return; } diff --git a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m index e6bc541a36..5a78aa377b 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m +++ b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m @@ -33,6 +33,8 @@ #import "main/VLCMain.h" #import "playlist/VLCPlaylistController.h" +#import "playlist/VLCPlaylistItem.h" +#import "playlist/VLCPlaylistModel.h" #import "playlist/VLCPlayerController.h" #import "views/VLCTimeField.h" @@ -196,7 +198,20 @@ { [super updateCurrentItemDisplayControls:aNotification]; - VLCInputItem * const inputItem = _playerController.currentMedia; + // If we use the playlist's currentPlayingItem we will get the same item we had before. + // Let's instead grab the playlist item from the playlist model, as we know this is + // updated before the VLCPlaylistCurrentItemChanged notification is sent out + const size_t currentPlaylistIndex = _playlistController.currentPlaylistIndex; + if (currentPlaylistIndex < 0) { + return; + } + + VLCPlaylistItem * const currentPlayingItem = [_playlistController.playlistModel playlistItemAtIndex:currentPlaylistIndex]; + if (!currentPlayingItem) { + return; + } + + VLCInputItem * const inputItem = currentPlayingItem.inputItem; if (!inputItem) { return; }