jeffvli / feishin

A modern self-hosted music player.
https://feishin.vercel.app
GNU General Public License v3.0
2.92k stars 123 forks source link

MacOS Media Player integration (media keys/playback status) #759

Open subpanic opened 2 months ago

subpanic commented 2 months ago

What do you want to be added?

Currently Feishin's playback status and controls aren't integrated with the Media Player API in MacOS. This means on devices like Macbooks the media keys cannot currently control Feishin and Feishin's playback state and status (artist/song name) don't show up in the MacOS Control Center. (Note: this is different than desktop MacOS setups with some external keyboards, playback controls can still work in some instances there when the keys aren't tied to the Media Player controls, but they are on Mac laptops)

I much prefer Feishin's app but have been forced to use alternatives on my macbook because of lack of media key control.

Additional context

No response

Is this a server-specific feature? (e.g. Jellyfin only)

jamie6king commented 2 months ago

I'm fairly certain you need to enable Feishin in Settings > Privacy & Security > Accessibility. I have a MacBook and it works perfectly (although it doesn't appear in the menubar for me).

subpanic commented 2 months ago

This is true but not the issue. This could be related to MacOS version/macbook version, I'm on 14.5 on an M1 Macbook Pro. Media keys will only trigger iTunes unless another application is running integrated with the Media Player API, it's a fairly widely documented issue. As a sidenote Feishin does have accessibility access, but the media keys will get captured by whatever application is responding to the Media Player API (which will be iTunes my default if no other running app is registered).

This was also previously an issue with the Supersonic application on certain MacOS/Mac hardware version until they added Media Player API integration.

subpanic commented 2 months ago

Follow-up, I did some further testing (removing the app, unsetting and re-setting accessibility, etc.) and was able to get media keys working. For anyone that has a similar issue where media keys are stolen by iTunes/Music app:

Leaving this open as Media Player API would still improve experience and remove/simplify this issue for people. But a maintainer can feel free to close/lmk to close if they would prefer a fresh feature ticket.

ceilingtilefan commented 2 months ago

I can't seem to get media keys working at all and I've never been able to get them working - iTunes always takes priority for some reason. Quite annoying when using AirPods while away from my computer

subpanic commented 1 month ago

@bigfloppa234 As a possible interim solution for you (not ideal but it's something) you can try noTunes (https://github.com/tombonez/noTunes)

Basically run noTunes and it'll have a little icon in your top taskbar, it prevents the Music app from ever starting/stealing keys. Then follow the steps above for re-toggling accessibility and global media hotkeys. I believe that should get it working for you (including buttons on headphones).

ceilingtilefan commented 1 month ago

@bigfloppa234 As a possible interim solution for you (not ideal but it's something) you can try noTunes (https://github.com/tombonez/noTunes)

Basically run noTunes and it'll have a little icon in your top taskbar, it prevents the Music app from ever starting/stealing keys. Then follow the steps above for re-toggling accessibility and global media hotkeys. I believe that should get it working for you (including buttons on headphones).

Odd, this doesn't work for me either. noTunes kills Music (verified by pressing play on my keyboard) but no media shortcuts work on Feishin.

Edit: Using macOS 15.1 (24B5035e)

anthonymag commented 1 month ago

Still no dice for me either unfortunately. On top of the media keys not working, the media icon in the upper taskbar doesn't show Feishin activity, and I'm fairly certain they go hand in hand with the music API.

I've seen others report they got the keys working, but that the taskbar icon still doesn't show activity, which makes me think the hotkeys solution is likely a hack/override rather than a proper use of the API.

TalhaMangarah commented 1 month ago

@ceilingtilefan @anthonymag

To get media keys to work, I had to remove Feishin from the accessibility list by selecting Feishin then clicking the '-'. To add it back, click on the '+' and add the program from the applications list. Just toggling off and on did not work for me from the accessiblity list in Privacy & Security but now it's working.

anthonymag commented 1 month ago

@TalhaMangarah you're a legend, that actually worked for me, thanks!

As I suspected above though, playback continues not showing in the media panel, so I'm pretty sure it isn't using the API properly and the key functions are an override.

subpanic commented 1 month ago

Yeah it won't show playback in the media panel. This isn't a bug, it's just not implemented. That's what this enhancement ticket was originally created for, properly implementing support for the Media Player API. Doing so would make it so that Feishin works like most other media players do on MacOS (integrated system-wide playback status/media functions).