[vlc-commits] macosx: add support for Apple Music
Felix Paul Kühne
git at videolan.org
Wed Nov 13 07:39:20 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Nov 13 07:38:39 2019 +0100| [20bf0e212f349d9dffe61a7a34e99d15fd6d4787] | committer: Felix Paul Kühne
macosx: add support for Apple Music
This matches the previous iTunes support.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20bf0e212f349d9dffe61a7a34e99d15fd6d4787
---
.../macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m | 1 +
modules/gui/macosx/playlist/VLCPlayerController.m | 25 +++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m b/modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m
index 3083660bde..5b9505995a 100644
--- a/modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m
+++ b/modules/gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m
@@ -177,6 +177,7 @@ static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEv
[[NSBundle mainBundle] bundleIdentifier], // your app
@"com.spotify.client",
@"com.apple.iTunes",
+ @"com.apple.Music",
@"com.apple.QuickTimePlayerX",
@"com.apple.quicktimeplayer",
@"com.apple.iWork.Keynote",
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index 5d98c3cc3b..1698f9b36f 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -88,8 +88,9 @@ const CGFloat VLCVolumeDefault = 1.;
/* remote control support */
VLCRemoteControlService *_remoteControlService;
- /* iTunes/Spotify play/pause support */
+ /* iTunes/Apple Music/Spotify play/pause support */
BOOL _iTunesPlaybackWasPaused;
+ BOOL _appleMusicPlaybackWasPaused;
BOOL _SpotifyPlaybackWasPaused;
NSTimer *_playbackHasTruelyEndedTimer;
@@ -862,6 +863,17 @@ static int BossCallback(vlc_object_t *p_this,
}
}
+ if (!_appleMusicPlaybackWasPaused) {
+ iTunesApplication *iTunesApp = (iTunesApplication *) [SBApplication applicationWithBundleIdentifier:@"com.apple.Music"];
+ if (iTunesApp && [iTunesApp isRunning]) {
+ if ([iTunesApp playerState] == iTunesEPlSPlaying) {
+ msg_Dbg(p_intf, "pausing Apple Music");
+ [iTunesApp pause];
+ _appleMusicPlaybackWasPaused = YES;
+ }
+ }
+ }
+
// pause Spotify
if (!_SpotifyPlaybackWasPaused) {
SpotifyApplication *spotifyApp = (SpotifyApplication *) [SBApplication applicationWithBundleIdentifier:@"com.spotify.client"];
@@ -891,6 +903,16 @@ static int BossCallback(vlc_object_t *p_this,
}
}
+ if (_appleMusicPlaybackWasPaused) {
+ iTunesApplication *iTunesApp = (iTunesApplication *) [SBApplication applicationWithBundleIdentifier:@"com.apple.Music"];
+ if (iTunesApp && [iTunesApp isRunning]) {
+ if ([iTunesApp playerState] == iTunesEPlSPaused) {
+ msg_Dbg(p_intf, "unpausing Apple Music");
+ [iTunesApp playpause];
+ }
+ }
+ }
+
if (_SpotifyPlaybackWasPaused) {
SpotifyApplication *spotifyApp = (SpotifyApplication *) [SBApplication applicationWithBundleIdentifier:@"com.spotify.client"];
if (spotifyApp) {
@@ -905,6 +927,7 @@ static int BossCallback(vlc_object_t *p_this,
}
_iTunesPlaybackWasPaused = NO;
+ _appleMusicPlaybackWasPaused = NO;
_SpotifyPlaybackWasPaused = NO;
}
More information about the vlc-commits
mailing list