FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

Feature Request: Streaming other media #94

Closed Uldgiw closed 2 years ago

Uldgiw commented 2 years ago

I'm really impressed by the functionality that UxPlay offers at the moment, however i would be really cool if you could also stream other web content, like youtube, for example.

In my understanding this isn't possible right now, because in that case the airplay server doesn't get the content from the airplay client itself, but instead stream the content directly from the web. So in this case the airplay client merely makes a request for the selected content to be play, but isn't involved in the actual playback.

My actual question is: is it possible to grab that request, for example the relevant youtube link, and let the server play that video back via some other mean, for example mpv (which would also work on the framebuffer)?

I would be glad to know, if it would be possible to implement something like that (or any other way to stream web-video content)?

fduncanh commented 2 years ago

Since you mention framebuffer, I'm guessing you are using UxPlay on the Raspberry Pi with Video4Linux2 GPU decoding?

It seems to be working well now (after a little detour into GStreamer development issues, and the patches). If you are a Pi user, how is it working for you?

You are right that airplay with a real AppleTV hands off the streaming to the AppleTV, cutting out the path from source to TV via the iOS client.

If the source was directly available on the internet, one could just use a web browser on the server to see it.

If it is more restricted content, like AppleTV-the app (not the box) It will be encrypted.

Short answer: I am not aware that the Apple protocol for this extra functionality has been discovered.

Long answer: Uxplay is only possible because of James Laird's hardware AirPlay key hack in 2011, and Esteban Kubata's "Playfair" reverse engineering of Apples Fairplay encryption scheme in 2015. Juvoh had created shairplay and then added Playfair to it for AirPlay1 audio. Then the chinese hacker dsafa22 found a commercial Xiaomi(?) android server where some of the source code can be extracted from the package and adapted Shairplay to also do AirPlay Mirror (see https://github.com/FDH2/UxPlay/wiki/AirPlay2 for dsafa's analysis of code that can be extracted and read from https://aapks.com/apk/happycast/version/35810679/dl/ : I dont know if any extra functionality that was not used by dsafa22 could be found in that code).

Also See Florian Draschbacher's notes on AirPlay history attached to the end of the UxPlay README.

All we really understand is a "legacy" version of the airplay RAOP protocol for an iOS device to pair with an AirPlay server, exchange cryptographic keys, and stream encrypted h264 video and encrypted audio(ALAC or AAC-ELD) that the server has been given the decryption keys for.

Significant research (Wireshark etc) on Apple TV boxes or Smart TV's with AirPlay functionality etc would be needed to try to understand what the extra functionality is doing

Uldgiw commented 2 years ago

If you are a Pi user, how is it working for you?

Yes i am using RaspberryPi4 4gb, as far as i can tell, it works very well (after patching gstreamer), for sound over hdmi to work i also had to install pulseaudio. Even over WiFi the latency is perfectly usable for my purposes. I really appreciate the effort that has gone into this project.

Short answer: I am not aware that the Apple protocol for this extra functionality has been discovered.

Well that's a shame, however my technical knowledge isn't remotely advanced enough to look closer into that protocol. Guess i'll just bodge my own solution together, via ios-autiomation, ssh and mpv.