I'm currently building an electron app that has a media control feature. As an example, the touch bar on Mac is able to automatically detect what app is playing audio, and lets you play/pause, skip, and even seek through the audio. This works for Spotify, Quicktime, and even websites in your browser, like a YouTube tab on Google Chrome. Windows also has its own version of this built in to its media controls.
Is there a way for electron to access metadata about the currently playing audio track in the same manner? If not, how can I use the native API to do this? I've tried looking up how to do this in AppleScript, but couldn't find anything.