Skip to content

media_change event not firing #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wzxu opened this issue Apr 3, 2025 · 10 comments
Open

media_change event not firing #708

wzxu opened this issue Apr 3, 2025 · 10 comments
Labels
macOS version specific Problems that arise on certain macOS versions but not others

Comments

@wzxu
Copy link

wzxu commented Apr 3, 2025

Not 100% sure it's OS upgrade related since I'm changing my config quite a lot in the past few days and I can't remember when my nowplaying widget stopped to show, but I think it is caused by my upgrading to latest macOS Sequoia 15.4.

Now media_change no longer triggers (I test this by echo-ing date and $INFO into a log file in the script and play/pause a few times, but I would only see one line outputted by the initialization). Tried rebooting and with Spotify, Music, browsers etc. and none worked.

@MrJarnould
Copy link

The cause of this is due to updating to macOS Sequoia 15.4. Others are also facing this issue. I do not know how to resolve this.

kirtan-shah/nowplaying-cli#28

TheBoredTeam/boring.notch#417

https://community.folivora.ai/t/mediaplay-cannot-be-detected-by-btt/42910

https://forum.keyboardmaestro.com/t/beware-upgrading-to-macos-15-4-if-you-need-now-playing-data/40285

@wzxu
Copy link
Author

wzxu commented Apr 4, 2025

Thanks. The boring.notch thread has more info and it seems they have to find a workaround since the original method is now restricted by Apple. TheBoredTeam/boring.notch#417 (comment)

@Silibop
Copy link

Silibop commented Apr 4, 2025

Unfortunately the solution they found (manually controlling individual music players) doesn’t support arbitrary media_change events from the entire OS, so while a solution, it’s definitely not perfect.

@AIboy996
Copy link

AIboy996 commented Apr 8, 2025

Same Issue

@wzxu
Copy link
Author

wzxu commented Apr 8, 2025

NotchNook updated and now only supports Apple Music and Spotify too, so I suspect they do the same as boring.notch.
I'm afraid there won't be "perfect" solution onwards since Apple deliberately blocked the API for security.
As long as it can be made to work with Apple Music / Spotify I'm good.

@philikarus
Copy link

Same issue. media_change event can not be triggered since Mac OS has been updated to 15.4

@wzxu
Copy link
Author

wzxu commented Apr 23, 2025

In the meantime, I made a workaround with AppleScript to watch for Spotify change every 2 seconds and then trigger a custom sketchybar event spotify_change if things change. Obviously polling like this is not as elegant, but it works great for me and the CPU/battery usage is basically negligible, so I thought I'd share parts of it as sample in case anyone wants it.

https://gist.github.com/wzxu/ef964559bbad2a6525a2b16a465ab5f0

  • AppleScript spotify_change.scpt to start just one process which lives in the background to check with Spotify every 2 seconds.
  • In sketchybarrc, start spotify_change.scpt automatically (change path to where you put it), add a now playing item, subscribe to spotify_change event and prepare a script nowplaying.sh to handle it.
  • In nowplaying.sh, you get environment variables $STATE (playing/paused), $ARTIST, $TITLE, and $ARTWORK_URL. In my example, I download the thumbnail image to /tmp so I can show it on the bar.

@FelixKratz
Copy link
Owner

For spotify there is a Notification that used to work just fine when registering for it like shown here:
https://github.com/nicolas-martin/awesome-sketchybar/blob/master/plugins/Spotify-Player-Controls.md

@wzxu
Copy link
Author

wzxu commented Apr 25, 2025

For spotify there is a Notification that used to work just fine when registering for it like shown here: https://github.com/nicolas-martin/awesome-sketchybar/blob/master/plugins/Spotify-Player-Controls.md

Wow so Spotify does this by itself? That's cool. Will surely make use of that. Thanks!

EDIT: Totally works. Now it's perfectly event-based again and no more polling. To be honest I only use media_change for Spotify so I'm happy now.

@LukasSefcik
Copy link

Same problem here. I am using Apple Music and media_change is not firing.

@FelixKratz FelixKratz added the macOS version specific Problems that arise on certain macOS versions but not others label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS version specific Problems that arise on certain macOS versions but not others
Projects
None yet
Development

No branches or pull requests

7 participants