Retrieve Playback Metadata
Efficient retrieval of active media playback metadata;
No (runtime) dependencies and no process spawning.
Currently only supports macOS, more platforms planned and coming soon.
Installation
To install the package from the npm registry:
npm i now-playing-meta
If you're using macOS and encounter node-gyp
build errors during installation,
ensure you have Xcode command line tools installed.
Implementation Details
macOS
A native node plugin is used to interface with the following macOS APIs.
This is the most efficient approach and does not involve invoking any additional
binaries/shell commands.
MediaRemote.framework
Retrieve metadata of the highest priority media session system-wide. This includes
playback originating from any app which implements the macOS media session API.
Use this if you'd like to retrieve metadata of any media playback on the system,
of which some examples include:
- Browsers
- Apple Music/TV
- Spotify
- etc.
Note that this method only returns metadata corresponding to the session with the
highest priority, decided based on system heuristics. This means that the metadata
need not necessarily always be that of a single application and may change based on
the active media sessions at the moment.
ScriptingBridge
Retrieves metadata of media playback in Apple Music via its Scripting Bridge
interface.
Note: This provider only supports Apple Music as of yet.