sonsongithub / HomeConMenu

Menu Bar Extra to control HomeKit Devices
MIT License
47 stars 5 forks source link

[FEATURE REQUEST] Control HomePod playback #16

Open Rastafabisch opened 2 months ago

Rastafabisch commented 2 months ago
Feature Request MockUp
Thank you so much for providing this great peace of software!

I was wondering whether it would be possible to add HomePod playback control to HomeConMenu. As providing a simple previous, play/pause, next interface. And it would also be nice if, whenever the HomePod is playing the keyboard media keys could be forwarded to control the playback.

I made a little mockup to illustrate how I imagine it.
HomePod-Control_MockUp
sonsongithub commented 1 month ago

Thank you for your localization and new ideas!

I have not found the way to control HomePods.... If you have any good ideas, let me know.....

Rastafabisch commented 1 month ago

There could be some kind of API within the Music App, as it does allow to control the HomePods Playback from within macOS. Playing and Pausing audio as well as adjusting the loudness (to some extend) is available via Shortcuts (App) from macOS - So I think it should be controllable via the AppIntends API.

sonsongithub commented 1 month ago

I found DAAP that is used by Apple's Remote.app to control macOS Music.app from iPhone. But, DAAP is not an open protocol. I can not find the way to access Music.app.....

sonsongithub commented 1 month ago

Finally, AppleScript is the only way to do it...?

Rastafabisch commented 1 month ago

This might be of some help.

sonsongithub commented 1 month ago

We could not use DAAP in order to control iTunes(Music).app. Apple added authentication procedures to DAAP.

https://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol

Rastafabisch commented 2 weeks ago

Could this be an option? I just incorporated this into a little tool I ported from iTunes.

sonsongithub commented 2 weeks ago

It looks nice. I've already started to use this framework. https://github.com/sonsongithub/AppleScriptBridge

Now, I'm wondering whether to use ScriptingBridge or not.

Rastafabisch commented 2 weeks ago

I just checked the framework. It appears to use the exact same (generated) Music.h file. Can't speak for the bridge part though.

sonsongithub commented 2 weeks ago

Yes, you are right. In addition, I created a converter from Obj-C header file to Swift interface.

Rastafabisch commented 2 weeks ago

Great work! I'm looking forward to try the new feature, when it is ready.


Looking at you AppleScriptingBridge repository it might be a helpful information, that for SystemEvents permission allowances I needed to modify the applications Info.plist. This one took me some time to figure out, why it didn't work at first.

sonsongithub commented 1 week ago

I built an experimental application. Next, I plan to integrate this into HomeConMenu.

https://github.com/sonsongithub/MusicConMenu