Closed fareast555 closed 2 years ago
I’m out on vacation at the moment so I can’t give you code level advice, but I think I can give you some pointers.
It’s been a while since I implemented this but UPnP works as follows:
that should get you up and running. I think the example project should give you guidance on that, although I’m not sure it compiles these days.
Hi @squarefrog Thanks for the quick reply. Appreciated!
Yeah, I did exactly that, but that only seems to work if it's a file hosted where I can just pass a url. The Media object and AVTRansport objects don't have any properties to wrap or deal with any kind of streaming data. There doesn't seem to be anything in the project that demos how one might stream a file on the local iOS device.
Ahh yes, that’s how UPnP works. You point a URL to a file and send that URL to the transport service. The renderer then fetches the data and plays it.
If you’re wanting to send a file, that’s trickier. You can use something like GCDWebServer to host the file from your phone, and send out that URL to your raspberry pi.
If it’s audio hosted in the music library itself, this is significantly more complicated and requires heavy workarounds like streaming the file to the documents directory, then serving that file up.
At that point I’d probably recommend you find an AirPlay compatible raspberry pi OS and use that as it will be significantly easier.
Yeah, the basic thing we wanted to do was take an mp3 from the apps file directory and pass it to the renderer on the pi.
Will take a look into GCDWebServer. If I can get something working, I'll give you a shout here. Thanks for the intel so far!
Yep you should be able to do that with GCDWebServer no problem at all!
One thing you may need to do is request multicast entitlements from Apple in order to discovery devices on your network, but that’s easy enough. Look at some of the other issues here and you might find a guide.
Thanks for the tip, @squarefrog!
Hi @squarefrog. OK, the GCDWebserver was a good call. I can now stream to multiple devices simultaneously when connected to the same network.
If you guys would like a write up about how to get this working in Swift, just let me know and tell me how to go about it. And I owe you a beer, bud!
Thats great news, well done! If you'd like to write a guide, feel free to on the Wiki, although theres no expectation for you to do so.
Hi all.
I'm trying to incorporate CocoaUPnP into a project that requires streaming an mp3 audio file to a Raspberry Pi media renderer. I can connect and play an mp3 file that is hosted on a remote server (See hackey code below), but I'm not seeing anything in the framework to allow me to set data to the UPPAVTransportService to stream.
Super new to all this, and there's no documentation of how to stream a file. Any suggestions?
Note that if I can get this up and running, I'd be happy to write a full set-up guide for your wiki in exchange for help getting this working and/or shout a round of beers!