[vlc-commits] [Git][videolan/vlc][master] macosx: Fix menubar playback status icon
Marvin Scholz (@ePirat)
gitlab at videolan.org
Fri Jul 11 18:10:18 UTC 2025
Marvin Scholz pushed to branch master at VideoLAN / VLC
Commits:
ab6896be by Bob Moriasi at 2025-07-11T17:53:46+00:00
macosx: Fix menubar playback status icon
- - - - -
1 changed file:
- modules/gui/macosx/menus/VLCStatusBarIcon.m
Changes:
=====================================
modules/gui/macosx/menus/VLCStatusBarIcon.m
=====================================
@@ -127,7 +127,10 @@
selector:@selector(hasNextChanged:)
name:VLCPlaybackHasNextChanged
object:nil];
-
+ [notificationCenter addObserver:self
+ selector:@selector(playerStateChanged:)
+ name:VLCPlayerStateChanged
+ object:nil];
[notificationCenter addObserver:self
selector:@selector(configurationChanged:)
name:VLCConfigurationChangedNotification
@@ -258,12 +261,10 @@
[totalField setStringValue:[NSString stringWithTimeFromTicks:duration]];
}
- [self setStoppedStatus:NO];
} else {
/* Nothing playing */
[progressField setStringValue:@"--:--"];
[totalField setStringValue:@"--:--"];
- [self setStoppedStatus:YES];
}
}
@@ -290,43 +291,51 @@
forwardButton.enabled = VLCMain.sharedInstance.playQueueController.hasNextPlayQueueItem;
}
-/* Updates the Metadata for the currently
- * playing item or resets it if nothing is playing
- */
-- (void)inputItemChanged:(NSNotification *)aNotification
+- (void)playerStateChanged:(NSNotification *)aNotification
{
- NSImage *coverArtImage;
- NSString *title;
- NSString *nowPlaying;
- NSString *artist;
- NSString *album;
-
VLCPlayerController *playerController = aNotification.object;
enum vlc_player_state playerState = playerController.playerState;
VLCInputItem *inputItem = playerController.currentMedia;
switch (playerState) {
case VLC_PLAYER_STATE_PLAYING:
- [self setStoppedStatus:NO];
+ [playPauseButton setState:NSControlStateValueOn];
+ [self setProgressTimeEnabled:YES];
+ [pathActionItem setEnabled:YES];
+ [self updateCachedURLOfCurrentMedia:inputItem];
+ break;
+ case VLC_PLAYER_STATE_PAUSED:
+ [playPauseButton setState:NSControlStateValueOff];
[self setProgressTimeEnabled:YES];
[pathActionItem setEnabled:YES];
[self updateCachedURLOfCurrentMedia:inputItem];
break;
case VLC_PLAYER_STATE_STOPPED:
- [self setStoppedStatus:YES];
+ [playPauseButton setState:NSControlStateValueOff];
[self setProgressTimeEnabled:NO];
[pathActionItem setEnabled:NO];
_currentPlaybackUrl = nil;
break;
- case VLC_PLAYER_STATE_PAUSED:
- [self setStoppedStatus:NO];
- [self setProgressTimeEnabled:YES];
- [pathActionItem setEnabled:YES];
- [self updateCachedURLOfCurrentMedia:inputItem];
- [playPauseButton setState:NSOffState];
default:
break;
}
+}
+
+/* Updates the Metadata for the currently
+ * playing item or resets it if nothing is playing
+ */
+- (void)inputItemChanged:(NSNotification *)aNotification
+{
+ NSImage *coverArtImage;
+ NSString *title;
+ NSString *nowPlaying;
+ NSString *artist;
+ NSString *album;
+
+ VLCPlayerController *playerController = aNotification.object;
+ VLCInputItem *inputItem = playerController.currentMedia;
+
+ [self updateCachedURLOfCurrentMedia:inputItem];
if (inputItem) {
coverArtImage = [[NSImage alloc] initWithContentsOfURL:inputItem.artworkURL];
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ab6896be27e998df9ae983d48a28a9cdcc65ea35
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ab6896be27e998df9ae983d48a28a9cdcc65ea35
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