philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.43k stars 216 forks source link

Use with ESP32 #500

Closed hhemmati81 closed 7 months ago

hhemmati81 commented 8 months ago

I see that this library is what is used in Squeezelite for Airplay capability. Any pointers on how I could utilize it in my own ESP32 project?

Squeezelite is a big project and it's hard to figure out how AirConnect is used inside it.

philippe44 commented 8 months ago

Can you explain what you want to do? Because there is no direct link with Squeezelite, although I'm involved in both project, especially in SqueezeESP32.

hhemmati81 commented 8 months ago

I am working on a meditation device that is built on an ESP32-WROVER-E. Already have an app that provisions the WiFi and adds the MDNS services for our systems to communicate with it.

The device has a nice amplifier and speakers so it makes sense to expand its capabilities by adding an Airplay client so the user can use it as a music player as well.

I played around with SqueezeESP32 but that's heavily dependent on LMS and runs a webserver so it's really difficult to make that work with our tech stack.

philippe44 commented 8 months ago

So which part would like to use?

hhemmati81 commented 8 months ago

Just the airplay casting for casting music from an Apple device. I believe it's the raop in this case if I am not mistaken.

philippe44 commented 8 months ago

oh, just airplay then. Best then is to extract the airplay part of SqueezeESP32. Look in components/raop, it's reasonably independent.

hhemmati81 commented 8 months ago

Awesome, just wanted to make sure there are no dependencies beyond what's inside the raop component.

Thanks for the quick assist!

philippe44 commented 8 months ago

I can't guarantee there is none, but it should be reasonably easy to remove because it was pre-existing before SqueezeESP32. And I'll be happy to help

hhemmati81 commented 8 months ago

That would be great. As a web and mobile developer, I am completely lost looking at this stuff.

philippe44 commented 8 months ago

Basically,

The whole thing depends on the alac codec provided in codecs/ but that's the Apple original code, with a small wrapper to allow it to be called in C (as it is C++). It also depends on a mDNS broadcaster that esp-idf mdns provides. I also have an independent stack I'm maintaining but there is no need here.

It's a callback-based system where this lib will callback your system for commands it receives and also will call your function for every decoded packet of audio and you'll have to feed it to your audio backend.