openairplay/airplay2-receiver

Can't connect to receiver

Opened this issue · 0 comments

Originally: ckdo#5

@spitfire commented Jul 19, 2020

Neither my iPhone (running iOS 14b2), nor MacBook (macOS 10.15.5) can connect to the receiver.
Tried to set it up both on my MacBook and a Raspberry Pi, the results are the same:

python ap2-receiver.py -m MMBP2 -n en11 -nv

Interface: en11
IPv4: 10.100.0.173
IPv6: fe80::d2:4bf4:204c:2461

mDNS service registered
Starting RSTP server, press Ctrl-C to exit...
serving at port 7000
Got connection with 10.100.0.173:59792
X-Apple-ProtocolVersion: 1
Content-Length: 70
Content-Type: application/x-apple-binary-plist
CSeq: 0
DACP-ID: 71DBFEDB9947497B
Active-Remote: 4016793210
User-Agent: AirPlay/420.45

GET /info
{'qualifier': ['txtAirPlay']}
Sending:
{'audioLatencies': [{'inputLatencyMicros': 0,
'outputLatencyMicros': 400000,
'type': 100},
{'audioType': 'default',
'inputLatencyMicros': 0,
'outputLatencyMicros': 400000,
'type': 100},
{'audioType': 'media',
'inputLatencyMicros': 0,
'outputLatencyMicros': 400000,
'type': 100},
{'audioType': 'media',
'inputLatencyMicros': 0,
'outputLatencyMicros': 400000,
'type': 102}],
'deviceID': '64:4b:f0:01:f9:90',
'features': 2255099430177280,
'keepAliveLowPower': True,
'keepAliveSendStatsAsBody': True,
'manufacturer': 'Sonos',
'model': 'One',
'name': 'Camera da letto',
'nameIsFactoryDefault': False,
'pi': 'ba5cb8df-7f14-4249-901a-5e748ce57a93',
'protocolVersion': '1.1',
'sdk': 'AirPlay;2.0.2',
'sourceVersion': '366.0',
'statusFlags': 4}

@ckdo commented Jul 19, 2020 •

Hello @spitfire,

Thanks for trying it 👍
Actually it is due to advertised features, latest versions of Airplay do not support anymore the trick that was used in this receiver to bypass auth & encryption.
I leave it like this for my convenience, but this receiver also support Fairplay v3 auth & HKP4, so it should work once enabled for you.
I'll make a minor change to enable both HKP and Fairplayv3 by default, and let me the ability to alter features with an argument.

About RPi support, you can try but sound on my Rpi3 is for now awful. As far i have seen, it is due to PyAudio lib so I intend to switch to sounddevice lib which seems to solve that troubles for RPi users

@ckdo commented Jul 19, 2020

@spitfire,

Fix published on 68a089f

@iRayanKhan commented Jul 21, 2020 •

So I can connect and everything, audio playback is choppy but works, but Connecting the speaker to HomeKit fails due to "Network error". Do I have to enable the flag or is it already enabled?

Edit: For clarity, yes I know about the RPI audio issue.

@spitfire commented Jul 22, 2020

Thanks for fixing it up @ckdo, it works for me now! I have noticed a few issues, and I'm not sure whether it would be useful for you if I filed them as issues (since this is not supposed to be a production-like-app:
Volume management is disabled when using docker.
I can't seem to be a le to connect to the server after I disconnect a device from it
Audio is desynchronized (I know this is in the list of known issues)
Sometimes I could hear audio stuttering
There is no way to select a sound card (or is there?), so I had to mess with modprobe.d options to reorder the sound cards

Thanks @spitfire,

No prod app you're right, but I intend all pieces of the puzzle to be there, so that anyone may implement/contribute to any other ap2 project (I'm also trying to contribute to https://openairplay.github.io/airplay-spec/ )
About you're issues... a few questions/remark:

Which iOS/Airplay version did you use ? It would be great to know which latest iOS pairs successfully, I'll document that.
How much is it unsync ? I started to implement that but there's still missing big pieces like PTP so... on my side sometimes it's pretty much ok, sometimes i can feel unsync but may be up to 0.3-0.5 second, not more. You can try to forward within the timeline as well, it's surprinsing but it improves sync.
For volume management, yep it is disabled for now on docker since it is os dependent. For a ap2 prototype like this one, it is actually not required since volume management did not change actually, it was managed in the same way with raop/ap1.
For sound card... yep no way to select that. I initialy wanted to switch to pulseaudio usage but it seems not doable with python. But I'll check that point with alsa when I'll switch to sounddevice.

@spitfire commented Aug 7, 2020 •

In my first comment I said I was using "iPhone (running iOS 14b2)[and] MacBook (macOS 10.15.5)", I think/hope it was using Airplay 2, as there is no way for iPhone to stream sound to more than one speaker at a time.

Probably between 300-800ms - not too terrible but definitely audible

Not sure about how it worked, but I used to be able to change volume from my Mac/Phone when using Shairport-sync - I did not have to do it on a speaker level

Like I said - while it's not easy you can work around that using kernel module parameters/alsa, but it's definitely not optimal