[vlc-commits] [Git][videolan/vlc][master] macos: fix media playback

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Feb 8 08:42:02 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
62f11751 by Maxime Chapelet at 2025-02-08T05:53:36+00:00
macos: fix media playback

Given playback was stopped, many issues happened when the playback
was resumed from the main controls bar.

The media time/progress slider wasn't visible anymore and app
crashed unexpectdly when picture in picture was activated.

This was caused by the `_currentMedia` var that was set to `nil`
when playback is stopped but never reassigned when playback was
resumed.

This change will reassign the var with the current played back input
item from the vlc player when the `currentMedia` getter is called.

- - - - -


1 changed file:

- modules/gui/macosx/playqueue/VLCPlayerController.m


Changes:

=====================================
modules/gui/macosx/playqueue/VLCPlayerController.m
=====================================
@@ -103,6 +103,7 @@ const CGFloat VLCVolumeDefault = 1.;
     BOOL _spotifyPlaybackWasPaused;
 
     NSTimer *_playbackHasTruelyEndedTimer;
+    VLCInputItem *_currentMedia;
 }
 
 @property (readwrite, atomic) iTunesApplication *appleMusicApp;
@@ -680,6 +681,18 @@ static int BossCallback(vlc_object_t *p_this,
     [_defaultNotificationCenter removeObserver:self];
 }
 
+- (VLCInputItem *)currentMedia {
+    if (_currentMedia)
+        return _currentMedia;
+    vlc_player_Lock(_p_player);
+    input_item_t *vlcInputItem = vlc_player_GetCurrentMedia(_p_player);
+    if (vlcInputItem) {
+        _currentMedia = [[VLCInputItem alloc] initWithInputItem:vlcInputItem];
+    }
+    vlc_player_Unlock(_p_player);
+    return _currentMedia;
+}
+
 #pragma mark - playback control methods
 
 - (int)start



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/62f11751edf76573dd77deaefeefdd795baa865e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/62f11751edf76573dd77deaefeefdd795baa865e
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