1

I am currently trying to write a music visualizer of sorts, but I am running into a small issue.

I am familiar with the scripting bridge and being able to get various information from iTunes regarding the current track but I wanted to add support for other media players such as Spotify.

Since the Pause/Play, Next track, and Previous track buttons on the built in keyboard automatically direct the corresponding commands to the last used media player, I was assuming that there is a single library that I can call against to get this information, regardless of which music player is playing music.

Chase Walden
  • 1,252
  • 1
  • 14
  • 31

1 Answers1

1

Since the Pause/Play, Next track, and Previous track buttons on the built in keyboard automatically direct the corresponding commands to the last used media player, I was assuming that there is a single library that I can call against to get this information, regardless of which music player is playing music.

Unfortunately, this is a false assumption.

The media keys on the keyboard are weird. They are (unfortunately!) not part of any larger media API; the fact that they even work at all for programs other than iTunes has taken some significant effort by developers.

iTunes publishes some information on the current track through a distributed notification. You can also get the name of the current track through AppleScript. This isn't part of any larger standard, though; other audio player applications may or may not do anything similar.

Community
  • 1
  • 1
  • Thank you for helping correct that assumption :) This will, at the very least, point me in the right direction if I want to make this work. Fingers crossed – Chase Walden Jan 11 '17 at 07:46