serezhka / java-airplay-server

Acts like Apple TV
MIT License
324 stars 46 forks source link

Question regarding audio #1

Closed iRayanKhan closed 4 years ago

iRayanKhan commented 4 years ago

Hello, Firstly, thank you for your work on AP2 and this project, we really appreciate it. What is needed to get audio working. I have an Air Port Express (with airplay 2), could that be used to help?

serezhka commented 4 years ago

Hi, @iRayanKhan! First, I need to understand how audio is encrypted. In java-airplay-lib I've implemented AES CBC decryption with aes key and aesIV received during pairing step. But I could not find a way to check that it's correct. Also I have no idea how to play raw AAC ELD encoded audio. I've tried to do it with fdk-aac lib but it turned out without success

iRayanKhan commented 4 years ago

Maybe the Shairport people can help. I have several AirPlay 2 devices if you need any help 1) AirPort Express 1) AirPlay 2 TV (No HomeKit) 2) HomePods 4) Apple TV 4K's And am planning to get a Sonos One SL (No Mic) w/ AirPlay 2. I can ask Mike or Erik on how to play that type of audio. I will reply back as soon as I get a reply.

spott commented 4 years ago

This might help with the audio encryption: https://emanuelecozzi.net/docs/airplay2/rtp

It appears to be ChaCha20-Poly1305 AEAD.

iRayanKhan commented 4 years ago

@spott I saw that this project works for macOS using python. I can't get it to work using docker as it is private.

https://github.com/ckdo/airplay2-receiver

serezhka commented 4 years ago

This might help with the audio encryption: https://emanuelecozzi.net/docs/airplay2/rtp

It appears to be ChaCha20-Poly1305 AEAD.

@spott it isn't. Now I can confirm that during screen mirroring audio is encrypted with AES-CBC https://youtu.be/BFuYug8MO6s

spott commented 4 years ago

@serezhka Thanks. Looks like I didn't read far enough (or the page has since been updated). It mentions that audio is encrypted with AES-CBC further down the page.