Hey Swift community!
I'm exploring building a macOS app that needs to monitor what's currently playing in music apps like Spotify and Apple Music (track info, playback position, play/pause state). I'm trying to figure out the most efficient architecture before diving in.
The Goal:
Monitor playback state across multiple music players to react to changes in real-time, ideally with minimal CPU overhead since this would run continuously in the background.
Approaches I'm Considering
AppleScript / ScriptingBridge
Distributed Notifications
Native Frameworks (Apple Music only)
What's the recommended way to do this on macOS?
Are distributed notifications reliable enough to avoid polling entirely?
Is there a performance difference between AppleScript and ScriptingBridge for IPC?
For Apple Music specifically, should I use MusicKit, MediaPlayer, or stick with AppleScript?
Are there other approaches I'm missing?
Topic:
App & System Services
SubTopic:
Automation & Scripting