jeffvli / feishin

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

Mac control center support (Fixes #549) #567

Open Explosion-Scratch opened 3 months ago

Explosion-Scratch commented 3 months ago

Currently only working in the web version

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feishin ❌ Failed (Inspect) Apr 1, 2024 3:04pm
Explosion-Scratch commented 3 months ago

@kgarner7 I've fixed 2.i and 2.ii just now (will push in a few), also mediaSession play pause seems to work fine for me. I'll push in just a sec

Explosion-Scratch commented 3 months ago

🤦🏻 Didn't even see use-center-controls.ts lol

Could it maybe not be working due to the isElectron() call?

Explosion-Scratch commented 3 months ago

The issue with electron vs web might be due to BrowserWindow instead of BrowserView: https://github.com/electron/electron/issues/31448#issuecomment-1002980034

Explosion-Scratch commented 3 months ago

Using use-center-controls isn't setting navigator.mediaSession at all =/

(I commented out my code when testing this)

kgarner7 commented 3 months ago

It does look like there is an issue where the first track doesn't get metadata, but it definitely sets it otherwise. And I having the actionHandler without isElectron() doesn't seem to help either

Explosion-Scratch commented 3 months ago

Yeah I've been looking through it - It only seems to update when you click pause and play buttons not on skipping songs. I don't have time to work on it more right now but I can later. Some improvements I want to make though:

Explosion-Scratch commented 3 months ago

@kgarner7 I found it!! I was looking through MPV to see how they did it (take it from the pros): https://github.com/mpv-player/mpv/blob/7f3ca6c524d01d92f756909ccdf877bccd627808/osdep/mac/remote_command_center.swift#L148-L158

We probably need to use this on mac: https://developer.apple.com/documentation/mediaplayer/mpnowplayinginfocenter

Could use this: https://github.com/MarshallOfSound/electron-media-service