watson / airplay-protocol

A low level protocol wrapper on top of the AirPlay HTTP API
MIT License
106 stars 12 forks source link

a note about playing audio #8

Closed derhuerst closed 6 years ago

derhuerst commented 6 years ago

I want to open this issue mainly for others who try to solve the same problem like me: Comfortably get an Apple TV to play an audio file.

Apparently, with AirPlay, audio streaming works entirely differently than video streaming. The audio is being "pushed" to the receiver using RTP & RTSP, whereas with video, you just give the receiver a URL and it will fetch the video by itself.

I wanted to use the latter, more comfortable solution, for audio as well though. I figured out, that a 3rd generation Apple TV will play a plain MP3 file (mp3 container, mp3 audio codec) just fine (displaying a video UI, but I don't care about that). So the solution is to convert the audio you want to play to MP3 (or another supported format) and just use the video API covered by this package.

If you're interested, you can have a look at the home server setup i built. It is a web server that also has a GUI, which you can use to instruct it to stream to the AirPlay receiver.