Code Monkey home page Code Monkey logo

airplay2-receiver's Introduction

Experimental

Somewhat comprehensive python implementation of AP2 receiver using some multi-room features. For now it implements:

  • HomeKit transient pairing (SRP/Curve25519/ChaCha20-Poly1305) - bit flag 48
  • HomeKit non-transient pairing
  • Some refinements for HomeKit interaction (e.g. managed/active flags)
  • Persist device name and some HomeKit properties across restarts (just use the -m flag again to set the device name anew)
  • FairPlay (v3) authentication and decryption of AES keys - the first and only Python implementation. Credit to @systemcrash for implementation.
  • Receiving of both REALTIME and BUFFERED Airplay2 audio streams
  • Airplay2 Service publication
  • Decoding of all Airplay2 supported CODECs: ALAC, AAC, OPUS, PCM. Ref: here and here
  • Output latency compensation for sync with other Airplay receivers
  • ANNOUNCE and RSA AES for unbuffered streaming from iTunes/Windows
  • Spotify (via AirPlay2) and other live media streams with AES keys.
  • RTCP
  • RFC2198 RTP Redundancy handling (basic); enable bit flag 61
  • streamConnections; enable bit flag 59

For now it does not implement:

  • FairPlay v2
  • Accurate audio sync (with help of PTP and/or NTP)

It may never implement:

  • MFi Authentication (requires MFi hardware module)

This code is experimental, yet fully functional. It can act as a real receiver but does not implement all airplay protocols and related pairing/authentication methods.

Next steps:

  • PTP (Precision Time Protocol)
  • Remove all os specific code (Soft Volume management)
  • Sender (branch-sender) - Implementation
  • Raspbian package
  • DACP/(+MRP?) Support
  • FairPlay v2 Support

Multiple Connections

Since multithreading is now enabled, this allows multiple concurrent connections. There are no safeguards built to prevent you playing multiple streams. Python multiprocessing makes this "DJ" mode a possibility but makes stream management and session management (global state data) nigh impossible. So threading is the right approach in the receiver.

HomeKit and other AP senders can now connect concurrently to the receiver and perform operations. This opens the path to Remote Control functionality.

mDNS/ZeroConf

If you encounter strange errors like NonUniqueNameException, or Address already in use, and you run on macOS, you may have noticed that macOS and this app both try to send updates. Here is a possible workaround.

Raspberry Pi 4

Install docker and then build the image:

docker build -f docker/Dockerfile -t ap2-receiver .

To run the receiver:

docker run -it --rm --device /dev/snd --net host --volume `pwd`/pairings/:/airplay2/pairings/ ap2-receiver

Default network device is wlan0, you can change this with AP2IFACE env variable:

docker run -it --rm --device /dev/snd --env AP2IFACE=eth0 --net host ap2-receiver

Docker Compose

Example Docker Compose

docker-compose -f docker/docker-compose.yaml up

Debian

sudo apt install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev portaudio19-dev python3 python3-pip python3-pyaudio build-essential pkg-config git alsa-utils
git clone https://github.com/openairplay/airplay2-receiver.git
cd airplay2-receiver/
pip3 install virtualenv
virtualenv airplay2-receiver
cd airplay2-receiver/
pip3 install -r requirements.txt
pip3 install pyaudio

macOS Catalina

To run the receiver please use Python 3 and do the following:

  • Run the following commands
brew install python3
brew install portaudio
virtualenv -p /usr/local/bin/python3 proto
source proto/bin/activate
pip install -r requirements.txt
pip install --global-option=build_ext --global-option="-I/usr/local/Cellar/portaudio/19.6.0/include" --global-option="-L/usr/local/Cellar/portaudio/19.6.0/lib" pyaudio


python ap2-receiver.py -m myap2 --netiface=en0

Note: in recent macOS versions (e.g. Ventura), you must disable AirPlay Receiver: System Settings -> AirDrop & Handoff -> AirPlay Receiver: disable.

Windows

To run the receiver please use Python 3 and do the following:

  • Run the following commands
cd [WHERE_YOU_CLONED_AIRPLAY2_RECEIVER]
virtualenv ap2env
.\ap2env\Scripts\activate
pip install -r requirements.txt
pip install pipwin pycaw
pipwin install pyaudio

python ap2-receiver.py -m myap2 -n [YOUR_INTERFACE_GUID] (looks like this for instance {02681AC0-AD52-4E15-9BD6-8C6A08C4F836} )
  • the AirPlay 2 receiver is announced as myap2.

Tested on Python 3.7.5 / macOS 10.15.2 with iPhone X 13.3 and Raspberry Pi 4

Protocol notes

https://emanuelecozzi.net/docs/airplay2

airplay2-receiver's People

Contributors

argyropus avatar ckdo avatar eliseomartelli avatar glmnet avatar invano avatar jacobericson avatar lorilandly avatar m3brown avatar neustradamus avatar paulwieland avatar systemcrash avatar thespookycat avatar vincentschmid avatar xxr3376 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

airplay2-receiver's Issues

Interesting data point

Originally: ckdo#15

@systemcrash commented Mar 17, 2021 •

Mac (also running the local copy of receiver):

'osBuildVersion': '19H524',
'osName': 'Mac OS X',
'osVersion': '10.15.7',

iOS:

'osBuildVersion': '18D61',
'osName': 'iPhone OS',
'osVersion': '14.4.1',
'senderSupportsRelay': True,
'sourceVersion': '535.3',

Summary: perhaps macOS requires a different feature bitmask?

When the first device connecting after startup is my mac I get all kinds of weird hangups and even:

{'streams': [{'audioFormat': 262144,
'audioMode': 'default',
'controlPort': 63126,
'ct': 2,
'isMedia': True,
'latencyMax': 88200,
'latencyMin': 11025,
'spf': 352,
'streamConnectionID': 8502940700034419006,
'supportsDynamicStreamID': True,
'type': 96}]}
Sending CONTROL/DATA:

Exception happened during processing of request from ('192.168.19.118', 58615)
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/server.py", line 429, in handle
self.handle_one_request()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "ap2-receiver.py", line 294, in do_SETUP
stream = Stream(plist["streams"][0])
File "/Users/paul/git/airplay2-receiver/ap2/connections/stream.py", line 14, in init
self.session_key = stream["shk"]
KeyError: 'shk'

Sometimes it makes it all the way to

Now plaing DAAP info. (need a daap parser here)
Content-Length: 128
Content-Type: application/x-apple-binary-plist
CSeq: 14
DACP-ID: B845E79B45E42834
Active-Remote: 462096351
User-Agent: AirPlay/425.1

POST /command
{'params': {'mrSupportedCommandsFromSender': []},
'type': 'updateMRSupportedCommands'}

and just sits there. No error message from macos, but macos has no connection to airplay device either. Remains on speaker output.

Still occasionally gets stuck at the below, on successive connect attempts, even with PR #11

POST /pair-setup
00000000: 00 01 00 06 01 01 13 01 10 .........
----- Pair-Setup [1/2]
00000000: 07 E9 C1 08 F4 37 5A F2 1F 24 81 09 01 96 BB 63 .....7Z..$.....c
00000010: 01 B3 D4 EA 75 4D DC 27 41 CC E4 45 33 A8 8A 15 ....uM.'A..E3...
00000020: 46 ED B8 24 9E C5 4E 17 36 BE 5A 03 70 A1 A5 16 F..$..N.6.Z.p...
00000030: 1A E7 0B B7 67 29 44 23 FA 1E 73 14 BC E9 4D C5 ....g)D#..s...M.
----- ENCRYPTED CHANNEL -----

My iOS Music player will connect, often fine. Only after my iOS device has connected and disconnected, then my local mac has no problem connecting. Seems some object state left over from the previous connection helps. Could not get any supported audio media types to play from my mac, however. Logs just repeat this:

Content-Length: 1225
Content-Type: application/x-apple-binary-plist
CSeq: 153
DACP-ID: 714F31E66394D075
Active-Remote: 826932078
User-Agent: AirPlay/425.1

POST /command
{'params': {'mrSupportedCommandsFromSender': [{'kCommandInfoCommandKey': 0,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 9,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 1,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 10,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 19,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 2,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 11,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 24,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 3,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 8,
'kCommandInfoEnabledKey': True}]},
'type': 'updateMRSupportedCommands'}
Content-Length: 1225
Content-Type: application/x-apple-binary-plist
CSeq: 154
DACP-ID: 714F31E66394D075
Active-Remote: 826932078
User-Agent: AirPlay/425.1

POST /command
{'params': {'mrSupportedCommandsFromSender': [{'kCommandInfoCommandKey': 0,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 9,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 1,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 10,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 19,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 2,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 11,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 24,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 3,
'kCommandInfoEnabledKey': True},
{'kCommandInfoCommandKey': 8,
'kCommandInfoEnabledKey': True}]},
'type': 'updateMRSupportedCommands'}

I do note that after iOS has connected (remote device) - when my local mac connects, I no longer see the loopback IP so much in the logs - only its 192.168 IP. I propose a fix for this, will make a PR.

Tried playing some 5.1 media via VLC, which played (tho output was silent), but nothing was in the logs. VLC hung on exit XD

iOS plays fine. If I team it up with e.g. Sonos speakers, there's a bit of delay/difference from this receiver, i.e. the receiver is ~100msec behind Sonos speakers. I guess synch leaves a little something to be desired.

Anyway, good work 👍

@PaulWieland commented Mar 17, 2021

If I team it up with e.g. Sonos speakers, there's a bit of delay/difference from this receiver, i.e. the receiver is ~100msec behind Sonos speakers. I guess synch leaves a little something to be desired.

Audio Sync isn't implemented at all, so that's totally to be expected.

@systemcrash commented Mar 17, 2021 •

See ckdo#16 - this PR cleans up lots of weird startup/connect behaviour (for me, at least).

@systemcrash commented Mar 17, 2021

See here for IPv6 problems.... prometheus/client_python#567

Question: what does extradata do?

When selecting ALAC, does this extradata that goes to ffmpeg 'prime the pump' so to speak? Some ALAC header which determines incoming stream formatting?

extradata = bytes([
# Offset 0x00000000 to 0x00000035
0x00, 0x00, 0x00, 0x24, 0x61, 0x6c, 0x61, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x60, 0x00, 0x10, 0x28, 0x0a, 0x0e, 0x02, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x44
])

It's undocumented in PyAu. I suspected it was something to do with this

Erractic start

Originally: ckdo#3

@ckdo commented Jul 1, 2020 •

Erractic start - Sometimes the playing starts, sometimes it doesn't

Analyse : Due to the way TCP port are reserved (reserved -> freed -> reservered) between SETUP phase and the actual start.

ckdo@5b6f163

Debian installation

Originally: ckdo#9

@noelhibbard commented Jan 18, 2021 •

Here are the steps I did to get this running on Debian in case anyone is interested:

sudo apt install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev portaudio19-dev python3 python3-pip python3-pyaudio build-essential pkg-config git alsa-utils
git clone https://github.com/ckdo/airplay2-receiver.git
cd airplay2-receiver/
pip3 install virtualenv
virtualenv airplay2-receiver
cd airplay2-receiver/
pip3 install -r ../requirements.txt
pip3 install pyaudio

Streaming & Pairing Timing Out

Running iOS 15 Public Beta 3 (iPhone 11)

Current -> 265f050
Streaming times out & HomeKit pairing shows "Unable to Add Accessory" instantly
4f4ac82
Stream times out & HomeKit pairing sits at "Connecting to Speaker" before it times out.

Wasn't actually able to find the last functioning commit, though I didn't try them all as I have limited time.

Not sure what's happened. Will edit / comment with any information as I find it.

Not compatible with this version of iTunes

Originally: ckdo#2

@joerg-krause commented Jun 22, 2020

The FairPlay authentification works fine with iOS, but fails with iTunes: The AirPlay device "myap2" is not compatible with this version of iTunes.

Something i noticed: iTunes sends an OPTION request with an "Apple-Challenge".

@ckdo commented Jun 22, 2020

@joerg-krause Which version iTunes do you use ? Apple-Challenge refers to RSA Authentication, which is not allowed for AP2

@joerg-krause commented Jun 22, 2020

iTunes version is 12.10.7.3. This is the log:

$ python ap2-receiver.py -m myap2 -n wlp5s0
Interface: wlp5s0
IPv4: 192.168.178.118
IPv6: fd00::89a1:4d7b:fa87:7be0

mDNS service registered
Starting RSTP server, press Ctrl-C to exit...
serving at port 7000
Got connection with 192.168.178.33:49339
CSeq: 1
User-Agent: iTunes/12.10.7 (Windows; Microsoft Windows 7 Service Pack 1 x64 Professional Edition (Build 7601); x64) (dt:2)
Client-Instance: 8E6AFF7283B34602
DACP-ID: 8E6AFF7283B34602
Active-Remote: 222309246
Apple-Challenge: 3zeVCckh56X+LikSee2wQg

@ckdo commented Jun 22, 2020

Thanks @joerg-krause , Windows version of iTunes does not support FairPlay authentication.
It either uses RSA authentication (regular raop devices) or MFi authentication with AP2 devices.
I don't know if windows version of iTunes can accept RSA authentication for AP2 (mac version/ios devices does not), and I was actually interested in checking that (branch-RSA..) but it is still pending work.

@joerg-krause commented Jun 22, 2020 •

Thanks @ckdo for sharing the RSA branch. Actually, iTunes on Windows does support FairPlay v2 authentication. I've tested in by advertising the AP2 device as an AP1 device using only the _raop._tcp service. However, if I re-enable the _airplay._tcp service, iTunes sends the "Apple-Challenge" in the OPTIONS request stead of sending an fp-setup request.

@ckdo commented Jun 23, 2020 •

@joerg-krause RSA branch is updated to compute Apple-Response correctly. Apple-Response is accepted for _raop._tcp service, but for _airplay._tcp the dialog is stopping, so I guess RSA auth cannot be used on AP2 devices.
In addition, windows version does not seems to support real Airplay2, protocol used is raop (ANNOUNCE for instance does not exist anymore with AP2 protocol) with previous MFi authentication.

@joerg-krause commented Jun 24, 2020

Thanks @ckdo ! I wonder, why iTunes on Windows sends the Apple-Challenge. What authentication algorithm does it expect, if not RSA? Looks like an unsolved mystery for now...

@joerg-krause commented Jul 3, 2020 •

@ckdo I managed to get iTunes on Windows to try to connect with the AirPlay 2 receiver using FairPlay v2. The features needs to be set to 0x3004A5D5A00 (The magic bit in the features is bit 25). iTunes needs several seconds before it sends the fp-setup request (so I guess some settings are not optimal yet):

Got connection with 192.168.178.136:49791
CSeq: 1
Content-Type: application/octet-stream
Content-Length: 16
User-Agent: iTunes/12.10.7 (Windows; Microsoft Windows 10 x64 Professional Edition (Build 19041); x64) (dt:2)
Client-Instance: 61A9F4C15E5B4DD7
DACP-ID: 61A9F4C15E5B4DD7
Active-Remote: 616789066

POST /fp-setup
00000000: 46 50 4C 59 02 01 01 00 00 00 00 04 02 00 00 BB FPLY............

As you can see, the fifth byte send in the request is 02, which is FairPlay v2. As the current code only implements FairPlay v3, further processing fails with an exception...

@ckdo commented Jul 3, 2020 •

Interesting findings !
Once authenticated, unfortunately it will not use Airplay2 protocol:
192.168.128.227 - - [03/Jul/2020 15:58:49] code 501, message Unsupported method ('ANNOUNCE')

Like said in this case ANNOUNCE method is used, so it means raop/ap1. But... it can be interesting to know that for instance to ensure backward compatibility with ap1 with a device publishing only a _airplay._tcp service.

@joerg-krause commented Jul 5, 2020

The ANNOUNCE method is advertised as supported method in the OPTIONS request even in AP2 devices. What makes you think the ANNOUNCE is an AP1 method?

@ckdo commented Jul 5, 2020

Yes so that AP2 devices ensure AP1 backward compatibility since there is one single enpoint for both protocols.
Invano documented the methods used for AP2 here:
https://emanuelecozzi.net/docs/airplay2/protocols

You can also quite easily check rtsp streams with a tcpdump since for iTunes/Windows they are not encrypted.

@joerg-krause commented Jul 6, 2020 •

I see!

As I am far more experienced with C than with Python, I fiddled around with the FairPlay v2 feature using shairplay. This is my experimental FP2 branch: https://github.com/joerg-krause/shairplay/tree/fairplay_v2.

iTunes on Windows successfully connects to the AirPlay device, but shairport aborts, while buffering. Something is wrong with the audio decryption. Maybe the audio is not encrypted using AES 128 CBC?

I hope, that adding FairPlay v2 support can be used as a backward compatibility for iTunes on Windows...

@ckdo commented Jul 6, 2020 •

Nice work I will check that... about encryption with Fairplayv2 I don't know but with MFi auth there's no particular change with encryption.
Actually my initial goal for this project is to understand the "player" part of AP2... to implement in pulseaudio ( https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/194 ), with all benefits of AP2 and not only in AP1 compatibility mode as this MR does.
So having "C" contributions is very welcome :)

@ckdo commented Jul 6, 2020 •

Is your latest code pushed onto shairplay branch ? There are several points I don't understand (only fply_2 is used, fply_header and payload are not used in response)

@joerg-krause commented Jul 6, 2020

The branch is named fairplay_v2. It is a single commit joerg-krause/shairplay@d5f0953. fply_header and fply_2 are used in fairplay_setup().

@ckdo commented Jul 6, 2020 •

Yes, but I mean there https://github.com/joerg-krause/shairplay/blob/d5f0953d2380502366592e30a0a59fe3879f3c59/src/lib/fairplay_playfair.c#L93-L97 : res only rely on fply_2, which does not use neither fply_header nor payload . Is it normal ?

@joerg-krause commented Jul 10, 2020

You're right! The reply needs to be distinguished whether by the request data. Depending on one byte set in the request, the header and payload data are needed for the response. That part is missing. I will add it soon, right now I am quite busy. Thanks for looking into it!

@joerg-krause commented Jul 20, 2020 •

Update: The missing part is not relevant for the fairplay v2 handshake. The main problem seems to be the decryption. I guess, there is a difference between v2 and v3 decryption.

I think the best approach is to use legacy RSA, for iTunes on Windows.

EDIT: RSA is only working when using the _raop._tcp bonjour service. When using the _airplay,_tcp service, it fails. However, if I first use the _raop._tcp service to connect iTunes on Windows with the AP device and then restart AP with the _airplay._tcp service instead of _raop._tcp, the authentification works, too.

RPI4 - Bullseye 64bit Issue or Container Issue (ver: Master)

The problem

So having done a fresh clone/build with buildah using the Dockerfile on bullseye 64-bit (light) - I get the below error. After a bit of googling, there seems to be some major breakage in raspian between buster and bullseye releases which might be the issue? At any rate, I wanted to raise the issue in case someone else stumbles across it - if I get some time I might dig deeper.

What commit exhibits the issue?

master

Was there a last known working commit?

nope

What type of installation are you running?

Docker

With which python3 version do you run Receiver?

Docker version

OS the receiver runs on

bullseye

OS the sender runs

OSX

Which sender client was used

Photos

Command invocation

same as README.md

Please include --debug output which helps to illustrate the problem

[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
[Receiver]: Name: ap2
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
amixer: Mixer attach default error: No such file or directory
Traceback (most recent call last):
  File "ap2-receiver.py", line 1426, in <module>
    setup_global_structs(args, isDebug=DEBUG)
  File "ap2-receiver.py", line 202, in setup_global_structs
    volume = get_volume()
  File "/airplay2/ap2/utils.py", line 224, in get_volume
    line_pct = subprocess.check_output(["amixer", "get", "PCM"]).splitlines()[-1]
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['amixer', 'get', 'PCM']' returned non-zero exit status 1.

Additional information

No response

Issue when running code?

I wanna preface by saying I know absolutely nothing about coding or installing shit, but I've gotten this far and received a syntax error when trying to run ap2-receiver.py.

I type in:

python ap2-receiver.py -m myap2 --netiface=en0"

It spits out:

File "ap2-receiver.py", line 326
"features": f"{hex(FEATURES & 0xffffffff)},{hex(FEATURES >> 32 & 0xffffffff)}",

SyntaxError: invalid syntax

(it had a carat pointing to the last double-quote (after the curly bracket))

I hope this helps maybe?? I don't know if it would be helpful to put some more info like what I'm running on or what.

Pair Setup fails - 'Hap' object has no attribute 'getDevicePassword'

The problem

attempting to connect iPhone 13 to airplay2-receiver running on Mac - just testing to see if I can create a viable home-amplifier setup with this software.

[HAP]: -----	Pair-Setup [1/2]
----------------------------------------
Exception occurred during processing of request from ('192.168.50.62', 52271)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Users/kevin/work/airplay2-receiver/ap2-receiver.py", line 341, in __init__
    http.server.BaseHTTPRequestHandler.__init__(self, socket, client_address, server)
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in __init__
    self.handle()
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 413, in handle_one_request
    method()
  File "/Users/kevin/work/airplay2-receiver/ap2-receiver.py", line 487, in do_POST
    self.dispatch()
  File "/Users/kevin/work/airplay2-receiver/ap2-receiver.py", line 359, in dispatch
    getattr(self, self.HANDLERS[self.command][path])()
  File "/Users/kevin/work/airplay2-receiver/ap2-receiver.py", line 978, in handle_pair_setup
    self.handle_pair_SV('setup')
  File "/Users/kevin/work/airplay2-receiver/ap2-receiver.py", line 991, in handle_pair_SV
    res = self.hap.pair_setup(body)
  File "/Users/kevin/work/airplay2-receiver/ap2/pairing/hap.py", line 534, in pair_setup
    res = self.pair_setup_m1_m2()
  File "/Users/kevin/work/airplay2-receiver/ap2/pairing/hap.py", line 908, in pair_setup_m1_m2
    pin = self.getDevicePassword()
AttributeError: 'Hap' object has no attribute 'getDevicePassword'

What commit exhibits the issue?

504614f

Was there a last known working commit?

No response

What type of installation are you running?

direct (via python3)

With which python3 version do you run Receiver?

3.9.12

OS the receiver runs on

macOS

OS the sender runs

monterey

Which sender client was used

iPhone - just connecting from control center

Command invocation

python ap2-receiver.py -m myap2 --netiface=en0 --debug

Please include --debug output which helps to illustrate the problem

[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: {'qualifier': ['txtAirPlay']}
[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: Sending our device info
[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: {'audioLatencies': [{'inputLatencyMicros': 0, 'outputLatencyMicros': 400000}],
 'deviceID': 'f4:d4:88:87:c7:6b',
 'features': 495880824111616,
 'keepAliveLowPower': True,
 'keepAliveSendStatsAsBody': True,
 'manufacturer': 'OpenAirplay',
 'model': 'Receiver',
 'name': None,
 'nameIsFactoryDefault': False,
 'pi': 'aa5cb8df-7f14-4249-901a-5e748ce57a93',
 'protocolVersion': '1.1',
 'sdk': 'AirPlay;2.0.2',
 'sourceVersion': '366.0',
 'statusFlags': '0x4'}
[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: POST: /pair-setup
[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: 
[AP2Handler: 192.168.50.216:7000<=>192.168.50.62:52288; Thread-2]: X-Apple-AbsoluteTime: 671507131
X-Apple-HKP: 4
X-Apple-Client-Name: The Remote
Content-Length: 9
Content-Type: application/x-apple-binary-plist
CSeq: 1
User-Agent: AirPlay/610.19.1


[HAP] logging level: DEBUG

Additional information

No response

Connection can't get past POST/command on MacOS 10.15

Originally: ckdo#8

@jdtsmith commented Oct 2, 2020

On MacOS I had to add -n en0 to get it running, but otherwise seems to start fine. Endpoint appears in Airplay List from iPhone, but when attempting to join, it doesn't seem to get past the POST /command section. So authentication apparently works (!), but then the RTSP stream has a TEARDOWN, and the connection is rejected. airplay2-receiver keeps running after this, but doing nothing, and CPU usage spikes. A further attempt to connect while still running doesn't get as far (to ----- ENCRYPTED CHANNEL -----), and CPU usage spikes even more.

You can see the output here. Thanks for working on this.
https://pastebin.com/raw/p4jcRZgY

@danielhelmstedt commented Oct 9, 2020

yep, same here

@jdtsmith commented Dec 13, 2020

One conjecture from ckdo is this relates to the Airplay version the sending device attempts to use. I tried (iPhone iOS 14.2):

User-Agent: AirPlay/525.38.2

which fails, but he has tested primarily with older senders. In fact with an older MacOS running iTunes (User-Agent: AirPlay/387.2), I can connect and playback works! Newer versions of the MacOS Music app running AirPlay/425.1 also fail to connect.

He thinks perhaps a PTP check is made that does not get a response from the server.

@PaulWieland commented Mar 17, 2021

@jdtsmith Try again with the latest version. I believe this is fixed and can be closed.

@jdtsmith commented Mar 18, 2021

Yep been fixed for a while, thanks for the reminder.

Prep work for PTP

@glmnet @LewdNeko

First question: what happens on your systems when you run PTP on port 319+320?

Do you need root privileges/run sudo? Or does it work OK to say, bind to '0.0.0.0' / '::'

I've not found a way that airplay sends PTP to any other port. I think the ports are baked in.

[Windows] Worked a couple times, now repeats error

The problem

Everything seems to launch fine and then once I actually try to start the stream I keep getting some kind of MAC value error like this
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')

Is the best way to try to get it working again blow away the repo or is there some easier fix here that I just dont get?

What commit exhibits the issue?

9b37407

Was there a last known working commit?

9b37407

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

3.9.6

OS the receiver runs on

Windows 11

OS the sender runs

Monterey 12.4

Which sender client was used

youtube (from chrome or opera gx same issue)

Command invocation

python ap2-receiver.py -m myap2 -n "{261386AF-A4C2-40D4-9FAB-90956F2AEEFC}"

Please include --debug output which helps to illustrate the problem

stdout.txt

Additional information

No response

Distorted Audio iPhone to macOS

The problem

Hello openairplay community,

I'm trying to run airplay2-receiver on macOS 12.2.1.
Installed it like this:

brew install python3
brew install portaudio
virtualenv -p /usr/local/bin/python3 proto
source proto/bin/activate
pip install -r requirements.txt
pip install --global-option=build_ext --global-option="-I/usr/local/Cellar/portaudio/19.6.0/include" --global-option="-L/usr/local/Cellar/portaudio/19.6.0/lib" pyaudio

python ap2-receiver.py -m myap2 --netiface=en0

Managed to get it running, name shows up as "none" on my iPhone which seems weird but works.
Audio playback is distorted and jagged and breaks down after around 30s.

Any Ideas?

Thank you very much

Tiziano

[Receiver]: Name: None
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
[Receiver]: Interface: en0
[Receiver]: Mac: 24:4f:27:5c:8b:b2
[Receiver]: IPv4: 192.168.178.20
[Receiver]: IPv6: fe70::1c23:b1e4:3b9f:611d
[Receiver]:
[asyncio]: Using selector: KqueueSelector
[Receiver]: mDNS: service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[Receiver]: serving on 192.168.178.20:7000
[AP2Server: 192.168.178.20:7000]: Opened connection from 192.168.178.21:50315
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: {'qualifier': ['txtAirPlay']}
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: Sending our device info
[AP2Server: 192.168.178.20:7000]: Thread-2: Opened HAPSocket from 192.168.178.21:50315
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SETUP: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]:
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: GET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: GET_PARAMETER: b'volume'
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: RECORD: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SETPEERS: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: ['192.168.178.20', '192.168.178.21', 'fe80::85f:6486:795a:c12b']
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SETUP: rtsp://192.168.178.20/6306729490375921051
[utils] removing StreamHandler from Audio.debug file logger
[Audio.debug] file logging level: DEBUG
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]:
[asyncio]: Using selector: KqueueSelector
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: b'progress' => b' 633735024/650449316/647859945'
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: FLUSH: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: DMAP:
dmap.persistentid: 0x49922e063b9651f0
daap.songalbum: Lonerism
daap.songartist: Tame Impala
dmap.itemname: Sun's Coming Up

[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: DMAP:
dmap.persistentid: 0x49922e063b9651f0
daap.songalbum: Lonerism
daap.songartist: Tame Impala
dmap.itemname: Sun's Coming Up
dacp.playerstate: Playing

[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: b'progress' => b' 637874142/650455300/651999063'
[AudioRealtime]: audioDevicelatency (sec): 0.00108
[AudioRealtime]: pyAudioDelay (sec): 0.00447
[AudioRealtime]: Total sample_delay (sec): 0.00755
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: b'volume' => b' -15.075000'
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: b'volume' => b' -16.950001'
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: rtsp://192.168.178.20/6306729490375921051
[AP2Handler: 192.168.178.20:7000<=>192.168.178.21:50315; Thread-2]: SET_PARAMETER: b'volume' => b' -18.825001'
[AudioRealtime]: requesting resend of sequence_no 47621; amt 7
[AudioRealtime]: requesting resend of sequence_no 47635; amt 7

[AudioRealtime]: requesting resend of sequence_no 49789; amt 2
Exception in thread Thread-2: (relative to self)
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/Users/tiziano/Downloads/airplay2-receiver-master/ap2/connections/audio.py", line 738, in play
pkt = RTP_REALTIME(data)
File "/Users/tiziano/Downloads/airplay2-receiver-master/ap2/connections/audio.py", line 123, in init
fbit = extra_hdr[0] & 0b10000000
IndexError: index out of range
[AudioRealtime]: requesting resend of sequence_no 49798; amt 1
[AudioRealtime]: requesting resend of sequence_no 49807; amt 7

What commit exhibits the issue?

master

Was there a last known working commit?

No response

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

python3

OS the receiver runs on

macOS 12.2.1

OS the sender runs

iPhone iOS 13

Which sender client was used

Spotify

Command invocation

python ap2-receiver.py -m myap2 --netiface=en0

Please include --debug output which helps to illustrate the problem

No response

Additional information

No response

Homekit pairing failed

Originally: ckdo#6

@yuhengqiu commented Aug 1, 2020 •

Hi guys, when I tried to pair to HomeKit, I got "Coundn't add Accessory" error and failed.
Actually it was stucked at:

POST /pair-add Not implemented!
10.0.0.71 -- [01/Aug/2020 17:27:31] code 404, message Not Found

If I implements pair-add in hap.py, then it added pair, but got stucked at:

Exception happened during processing of request from ('10.0.0.71', 51700)
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock
self.process_request(request, client_address)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socketserver.py", line 347, in process_request
self.finish_request(request, client_address)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socketserver.py", line 720, in init
self.handle()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/server.py", line 428, in handle
self.handle_one_request()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/server.py", line 394, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/Volumes/Workspace/App/airplay2-receiver/ap2/pairing/hap.py", line 348, in recv_into
data = self.recv(nbytes, flags)
File "/Volumes/Workspace/App/airplay2-receiver/ap2/pairing/hap.py", line 366, in recv
block_length_bytes = self.socket.recv(self.LENGTH_LENGTH)
File "/Volumes/Workspace/App/airplay2-receiver/ap2/pairing/hap.py", line 357, in recv
assert not flags and buflen > self.LENGTH_LENGTH
AssertionError

Anyone has succeed in pairing to HomeKit? Did I miss something? Cheers

Starting but not discovered on network

Hi,
I am trying to use it, i got to the part:

mDNS service registered
Starting RSTP server, press Ctrl-C to exit...
serving at port 7000

But i cannot find it on my phone
I am using IOS 14.4, raspberry pi zero with wlan0 interface.
Maybe i need to install some other dependecy?!
Thank you.

No such file or directory: './pairings/accessory-secret'

Hello,

when i run the docker container on rpi 4 :

[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemo[.ok
Traceback (most recent call last):
��File "ap2-receiver.py", line 190, in
��LTPK = LTPK()
��File "ap2-receiver.py", line 164, in init
��announce_id, self.ltpk = Hap(PI).configure()
��File "/airplay2/ap2/pairing/hap.py", line 170, in init
����with open("./pairings/accessory-secret", "wb") as secret_file:
FileNotFoundError: [Errno 2] No such file or directory: './pairings/accessory-secret'

Not Working on AppleTV ?

Hi, everything works great when using with my phone, but when i try on my ATV 4K it tries to connect but then it just disappear no logs on my computer (running windows 10 btw)
does anybody know about this ? is this a limitation or just a weird glitch ?
thanks !

Unable to start stream with youtube app on linux

I was unable to get this working on linux by installing requirements.txt and using the wifi interface wlp1s0
If there is anything I can do to test or to send more info (please say what) let me know

Also I meant to ask this but do you guys have a way to communicate like discord? I wanted to contribute to this project but dont know where to start

ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
TEARDOWN rtsp://192.168.1.16/2078644956552382407
Content-Length: 84
Content-Type: application/x-apple-binary-plist
CSeq: 13
DACP-ID: BB392EBCC141E777
Active-Remote: 1447734394
User-Agent: AirPlay/521.1.3```

Music playing can work!

Here are some great and positive views on this project and your work:

So I've been following this topic for a long long time, I quite never managed to make anything turn my iMac into a legitimate AirPlay 2 device - however, this Project kept me interested in it. Many things & tools out there are told to deliver but honestly no one does ..... but today a strange combo did it and enabled an outstanding sound-sync / seamless streaming music & video on the Mac (... simultaneously with 2 HomePods + AirPort Express) 😍😍

I don't see any reason why such a good working receiver needs to hide behind real devices if the outcome is equally well. I'm not sure if you removed Sync on purpose because it is kinda experimental or just didn't get to that; however it is working perfectly and very impressive.

Great job and patience, I just got lucky and it turned out working, now I can finally check it off my list 😎 If this is interesting for others I'll sure share it with you guys but right now I'm just cheering

The len() of class av.audio.frame.AudioFrame

The problem

I create a new Anaconda environment with python3.7, and install the dependencies following the guidance.
But as pipwin has the SSL problem, I install the pyaudio by conda rather than the pipwin in the guidance.
And run this to start the service:

python .\ap2-receiver.py -m "myap2" -n "{C7454699-5CBC-436B-9279-71EE595128A0}"

Before the client start playing, everything is fine. But once audio streaming start, this exception is raised:

[AudioRealtime]: TypeError("object of type 'av.audio.frame.AudioFrame' has no len()")

And I try to locate it, the detail of the exception is:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Users\hra20\Anaconda3\envs\airplay\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\hra20\Anaconda3\envs\airplay\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\hra20\Downloads\airplay2-receiver-master\ap2\connections\audio.py", line 795, in play
    raise e
  File "C:\Users\hra20\Downloads\airplay2-receiver-master\ap2\connections\audio.py", line 777, in play
    audio = self.process(rtp)
  File "C:\Users\hra20\Downloads\airplay2-receiver-master\ap2\connections\audio.py", line 572, in process
    if len(frame) == 1:  # if no resampling was needed, resample returns [frame]
TypeError: object of type 'av.audio.frame.AudioFrame' has no len()

I view the latest commit of ap2/connections/audio.py and find a new commit(2af912c) just to change the line 572-574, and I simply comment these lines below:

572 | if len(frame) == 1:  # if no resampling was needed, resample returns [frame]
573 |     frame = frame[0]

and it works.
Maybe it is just not working propery on Windows.

What commit exhibits the issue?

07195c5

Was there a last known working commit?

6f3c1ce

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

Python 3.7.15

OS the receiver runs on

Windows 11 21H2(22000.1455)

OS the sender runs

iPadOS 15.5

Which sender client was used

NetEase Cloud Music

Command invocation

python .\ap2-receiver.py -m "myap2" -n "{C7454699-5CBC-436B-9279-71EE595128A0}"

Please include --debug output which helps to illustrate the problem

log.txt
This log is from the original project codes.

Additional information

No response

Unable to install within a python environment

The problem

I am unable to install the software when trying to install on a windows system with the virtual environment.

What commit exhibits the issue?

Head

Was there a last known working commit?

No response

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

Python 3.8.5

OS the receiver runs on

Windows

OS the sender runs

IOS

Which sender client was used

No response

Command invocation

pip install -r requirements.txt

Please include --debug output which helps to illustrate the problem

Microsoft Windows [Version 10.0.22621.963]
(c) Microsoft Corporation. All rights reserved.

C:\Users\blake\Documents\GitHub\airplay2-receiver>virtualenv ap2env
c:\users\blake\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
created virtual environment CPython3.8.5.final.0-32 in 495ms
creator CPython3Windows(dest=C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\blake\AppData\Local\pypa\virtualenv)
added seed packages: pip==22.3.1, setuptools==50.3.2, wheel==0.38.4
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

C:\Users\blake\Documents\GitHub\airplay2-receiver>.\ap2env\Scripts\activate

(ap2env) C:\Users\blake\Documents\GitHub\airplay2-receiver>pip install -r requirements.txt
Collecting netifaces
Using cached netifaces-0.11.0-cp38-cp38-win32.whl (15 kB)
Collecting zeroconf==0.38.3
Using cached zeroconf-0.38.3-py3-none-any.whl (106 kB)
Collecting biplist
Using cached biplist-1.0.3.tar.gz (21 kB)
Preparing metadata (setup.py) ... done
Collecting pycryptodome
Using cached pycryptodome-3.16.0-cp35-abi3-win32.whl (1.7 MB)
Collecting hexdump
Using cached hexdump-3.3.zip (12 kB)
Preparing metadata (setup.py) ... done
Collecting srptools
Using cached srptools-1.0.1-py2.py3-none-any.whl (13 kB)
Collecting hkdf
Using cached hkdf-0.0.3.tar.gz (4.0 kB)
Preparing metadata (setup.py) ... done
Collecting cryptography
Using cached cryptography-38.0.4-cp36-abi3-win32.whl (2.1 MB)
Collecting requests
Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting av==8.1.0
Using cached av-8.1.0.tar.gz (2.4 MB)
Preparing metadata (setup.py) ... done
Collecting ifaddr>=0.1.7
Using cached ifaddr-0.2.0-py3-none-any.whl (12 kB)
Collecting six
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cffi>=1.12
Using cached cffi-1.15.1-cp38-cp38-win32.whl (170 kB)
Collecting charset-normalizer<3,>=2
Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting pycparser
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: av, biplist, hexdump, hkdf
Building wheel for av (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\av
copying av\datasets.py -> build\lib.win32-3.8\av
copying av\deprecation.py -> build\lib.win32-3.8\av
copying av_init_.py -> build\lib.win32-3.8\av
copying av_main_.py -> build\lib.win32-3.8\av
creating build\lib.win32-3.8\av\audio
copying av\audio_init_.py -> build\lib.win32-3.8\av\audio
creating build\lib.win32-3.8\av\codec
copying av\codec_init_.py -> build\lib.win32-3.8\av\codec
creating build\lib.win32-3.8\av\container
copying av\container_init_.py -> build\lib.win32-3.8\av\container
creating build\lib.win32-3.8\av\data
copying av\data_init_.py -> build\lib.win32-3.8\av\data
creating build\lib.win32-3.8\av\filter
copying av\filter_init_.py -> build\lib.win32-3.8\av\filter
creating build\lib.win32-3.8\av\sidedata
copying av\sidedata_init_.py -> build\lib.win32-3.8\av\sidedata
creating build\lib.win32-3.8\av\subtitles
copying av\subtitles_init_.py -> build\lib.win32-3.8\av\subtitles
creating build\lib.win32-3.8\av\video
copying av\video_init_.py -> build\lib.win32-3.8\av\video
running build_ext
running config
writing build\temp.win32-3.8\Release\include\pyav\config.h
running cythonize
building 'av.buffer' extension
creating build\temp.win32-3.8\Release\src
creating build\temp.win32-3.8\Release\src\av
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\include -Iinclude -Ibuild\temp.win32-3.8\Release\include -Ic:\users\blake\appdata\local\programs\python\python38-32\include -IC:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\include -Ic:\users\blake\appdata\local\programs\python\python38-32\include -Ic:\users\blake\appdata\local\programs\python\python38-32\include -Ibuild\temp.win32-3.8\Release\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" /Tcsrc\av\buffer.c /Fobuild\temp.win32-3.8\Release\src\av\buffer.obj
buffer.c
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\PCbuild\win32 /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32 /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32\libs /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32 /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x86" avformat.lib swscale.lib avutil.lib avdevice.lib avcodec.lib avfilter.lib swresample.lib /EXPORT:PyInit_buffer build\temp.win32-3.8\Release\src\av\buffer.obj /OUT:build\lib.win32-3.8\av\buffer.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\src\av\buffer.cp38-win32.lib /OPT:NOREF
LINK : fatal error LNK1181: cannot open input file 'avformat.lib'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\link.exe' failed with exit status 1181
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for av
Running setup.py clean for av
Building wheel for biplist (setup.py) ... done
Created wheel for biplist: filename=biplist-1.0.3-py3-none-any.whl size=11112 sha256=a4d729333821d5ace3ee4c24ffe167c89577dbef381a6041c7293b64cce1aa26
Stored in directory: c:\users\blake\appdata\local\pip\cache\wheels\46\2c\cd\430837291daf5c95cad74ffd141ad4b379cfc73d41f9da8952
Building wheel for hexdump (setup.py) ... done
Created wheel for hexdump: filename=hexdump-3.3-py3-none-any.whl size=8953 sha256=eb3e967da622f65ff533fc51be596e930b06469c9bb06c24b68551336e69d871
Stored in directory: c:\users\blake\appdata\local\pip\cache\wheels\e7\e9\2c\acade4155d5e4d629d483bba20858447956413642cd0e2558d
Building wheel for hkdf (setup.py) ... done
Created wheel for hkdf: filename=hkdf-0.0.3-py3-none-any.whl size=3766 sha256=8cc68f2f386db1e1fd70b6408efbabbfa7d33cdcfd5544bc864f3cf10a73e112
Stored in directory: c:\users\blake\appdata\local\pip\cache\wheels\75\ce\64\89357f6d149a2462c21e9fcd5ebf6ef7102c52433932899a65
Successfully built biplist hexdump hkdf
Failed to build av
Installing collected packages: netifaces, ifaddr, hkdf, hexdump, biplist, av, zeroconf, urllib3, six, pycryptodome, pycparser, idna, charset-normalizer, certifi, srptools, requests, cffi, cryptography
Running setup.py install for av ... error
error: subprocess-exited-with-error

× Running setup.py install for av did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\av
copying av\datasets.py -> build\lib.win32-3.8\av
copying av\deprecation.py -> build\lib.win32-3.8\av
copying av_init_.py -> build\lib.win32-3.8\av
copying av_main_.py -> build\lib.win32-3.8\av
creating build\lib.win32-3.8\av\audio
copying av\audio_init_.py -> build\lib.win32-3.8\av\audio
creating build\lib.win32-3.8\av\codec
copying av\codec_init_.py -> build\lib.win32-3.8\av\codec
creating build\lib.win32-3.8\av\container
copying av\container_init_.py -> build\lib.win32-3.8\av\container
creating build\lib.win32-3.8\av\data
copying av\data_init_.py -> build\lib.win32-3.8\av\data
creating build\lib.win32-3.8\av\filter
copying av\filter_init_.py -> build\lib.win32-3.8\av\filter
creating build\lib.win32-3.8\av\sidedata
copying av\sidedata_init_.py -> build\lib.win32-3.8\av\sidedata
creating build\lib.win32-3.8\av\subtitles
copying av\subtitles_init_.py -> build\lib.win32-3.8\av\subtitles
creating build\lib.win32-3.8\av\video
copying av\video_init_.py -> build\lib.win32-3.8\av\video
running build_ext
running config
writing build\temp.win32-3.8\Release\include\pyav\config.h
running cythonize
building 'av.buffer' extension
creating build\temp.win32-3.8\Release\src
creating build\temp.win32-3.8\Release\src\av
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\blake\appdata\local\programs\python\python38-32\include -Ibuild\temp.win32-3.8\Release\include -IC:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\include -Iinclude -IC:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\include -Ic:\users\blake\appdata\local\programs\python\python38-32\include -Ic:\users\blake\appdata\local\programs\python\python38-32\include -Ibuild\temp.win32-3.8\Release\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" /Tcsrc\av\buffer.c /Fobuild\temp.win32-3.8\Release\src\av\buffer.obj
buffer.c
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32 /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\PCbuild\win32 /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32\libs /LIBPATH:c:\users\blake\appdata\local\programs\python\python38-32 /LIBPATH:C:\Users\blake\Documents\GitHub\airplay2-receiver\ap2env\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x86" avfilter.lib avformat.lib swscale.lib avdevice.lib avutil.lib avcodec.lib swresample.lib /EXPORT:PyInit_buffer build\temp.win32-3.8\Release\src\av\buffer.obj /OUT:build\lib.win32-3.8\av\buffer.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\src\av\buffer.cp38-win32.lib /OPT:NOREF
LINK : fatal error LNK1181: cannot open input file 'avfilter.lib'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\link.exe' failed with exit status 1181
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> av

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

(ap2env) C:\Users\blake\Documents\GitHub\airplay2-receiver>

Additional information

No response

[Windows 11 Home] Airplay receiver not visible to other devices

The problem

Hello,

I am grateful that you provided a function to list the device GUID's. I believe I found the correct device interface GUID, and received confirmation that the server is supposedly working:
[Receiver]: serving on [local IP]
However, I do not see any airplay server being broadcast via my iPad Pro. The "Screen Mirroring" list remains empty. I tested this out with LonelyScreen and I indeed still get that to successfully broadcast.

Are there any additional security settings that I should investigate, when running these commands?

What commit exhibits the issue?

07195c5

Was there a last known working commit?

No response

What type of installation are you running?

direct (via python3)

With which python3 version do you run Receiver?

3.10.7

OS the receiver runs on

Windows 11 Home Version 21H2

OS the sender runs

iOS 16.2; iPad OS 16.3

Which sender client was used

[screen mirroring]

Command invocation

python ap2-receiver.py -m myap2 -n "{device GUID here}"

Please include --debug output which helps to illustrate the problem

No response

Additional information

No response

amixer: Unable to find simple control 'PCM',0

Thank you for contribution!

tried this receiver on my RP3, but got an issue as below.

Checked amixer on my RP3 there is only 'Master' not 'PCM'

Think if I could change the audio source(?), then docker can be run.

Is there any way to custom and fix ?


amixer: Unable to find simple control 'PCM',0

Traceback (most recent call last):
File "ap2-receiver.py", line 1108, in
setup_global_structs(args)
File "ap2-receiver.py", line 273, in setup_global_structs
volume = get_volume()
File "/airplay2/ap2/utils.py", line 94, in get_volume
line_pct = subprocess.check_output(["amixer", "get", "PCM"]).splitlines()[-1]
File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/usr/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['amixer', 'get', 'PCM']' returned non-zero exit status 1.

Crash if IPv6 is not available

Originally: ckdo#12

@oxixes commented Mar 2, 2021

My wifi adapter does not offer an IPv6, and the program crash on startup, I solved the issue by just commenting the IPv6 part on the code and removing it from sonos_one_setup, but I think it should be done better.

TypeError: str, bytes or bytearray expected, not NoneType

I did:

  1. docker build -f docker/Dockerfile -t invano/ap2-receiver .
  2. docker run -it --rm --device /dev/snd --net host -v /home/pi/data/airplay/pairings:/pairings invano/ap2-receiver
Enabled features: 0001c300405f4200
Feat.Ft48TransientPairing|Ft47PeerMgmt|Ft46HKPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertInf|Ft22AudioUnencrypted|Ft20RcvAudAAC_LC|Ft19RcvAudALAC|Ft18RcvAudPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgres|Ft14MFiSoftware|Ft09AirPlayAudio
Interface: wlan0
IPv4: None
IPv6: None

mDNS service registered
Starting RTSP server, press Ctrl-C to exit...
Shutting down mDNS...
Unregistering...
Traceback (most recent call last):
  File "ap2-receiver.py", line 1157, in <module>
    with AP2Server((IPV4, PORT), AP2Handler) as httpd:
  File "ap2-receiver.py", line 1002, in __init__
    super().__init__(addr_port, handler)
  File "/usr/lib/python3.7/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
TypeError: str, bytes or bytearray expected, not NoneType

Can't connect to receiver

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

Cannot run docker image: ModuleNotFoundError: No module named 'av'

The problem

Built the image per the instructions. When attempting docker run, I get:
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
Traceback (most recent call last):
File "ap2-receiver.py", line 25, in <module>
from ap2.connections.stream import Stream
File "/airplay2/ap2/connections/stream.py", line 5, in <module>
from .audio import AudioRealtime, AudioBuffered
File "/airplay2/ap2/connections/audio.py", line 7, in <module>
import av
ModuleNotFoundError: No module named 'av'

What commit exhibits the issue?

504614f

Was there a last known working commit?

No response

What type of installation are you running?

Docker

With which python3 version do you run Receiver?

3.9.2

OS the receiver runs on

Raspberry Pi OS

OS the sender runs

Raspberry Pi OS

Which sender client was used

No response

Command invocation

docker run -it --rm --device /dev/snd --net host --volume pwd/pairings/:/airplay2/pairings/ ap2-receiver

Please include --debug output which helps to illustrate the problem

[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
Traceback (most recent call last):
File "ap2-receiver.py", line 25, in
from ap2.connections.stream import Stream
File "/airplay2/ap2/connections/stream.py", line 5, in
from .audio import AudioRealtime, AudioBuffered
File "/airplay2/ap2/connections/audio.py", line 7, in
import av
ModuleNotFoundError: No module named 'av'

Additional information

Built docker image using the command in readme.md. Only one error (red): debconf: delaying package configuration, since apt-utils is not installed. apt-utils is, in fact, installed though. Module av is also installed on the host, although not sure if that's relevant even.

I can't receive a stream from Mojave – RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')

The problem

Thanks for a lot of work clearly making an excellent project. Unfortunately, either in docker or running natively on ubuntu 22.04 (x64) I can't stream music from other devices on my lan – the crypto seems to fail. I've tried two different network interfaces (wifi and ethernet) and other implementations of airplay work with my alsa / pulsedaudio config (i.e. shairplay-sync).

$ python3 ap2-receiver.py -m DownstairsSpeakers --netiface=wlp3s0 -nv
[Receiver]: Name: DownstairsSpeakers
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
[Receiver]: Interface: wlp3s0
[Receiver]: Mac: xxxxxxxxxxxxxxxxxxxxxxxxxx
[Receiver]: IPv4: 10.0.0.67
[Receiver]: IPv6: xxxxxxxxxxxxxxxxxxxxxxxxxx
[Receiver]:
[asyncio]: Using selector: EpollSelector
[Receiver]: mDNS: service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[Receiver]: serving on 10.0.0.67:7000
[AP2Server: 10.0.0.67:7000]: Opened connection from 10.0.0.218:60126
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: {'qualifier': ['txtAirPlay']}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: Sending our device info
[AP2Server: 10.0.0.67:7000]: Thread-2 (process_request_thread): Opened HAPSocket from 10.0.0.218:60126
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SETUP: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: GET_PARAMETER: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: GET_PARAMETER: b'volume'
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: Volume Management is disabled
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: RECORD: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SETPEERS: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: ['10.0.0.67', '10.0.0.218', 'fe80::10f9:ccfa:f035:7696']
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SET_PARAMETER: b'volume' => b' -20.000000'
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: Volume Management is disabled
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SETUP: rtsp://10.0.0.67/12487981574068520270
[utils] removing StreamHandler from Audio.debug file logger
[Audio.debug] file logging level: DEBUG
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]:
[asyncio]: Using selector: EpollSelector
ALSA lib pcm_dsnoop.c:601:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
[AudioRealtime]: audioDevicelatency (sec): 0.00868
[AudioRealtime]: pyAudioDelay (sec): 0.00871
[AudioRealtime]: Total sample_delay (sec): 0.01939
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: DMAP:
dmap.persistentid: 0x5fc3db46c80516be
dmap.itemname: Ola Gjeilo - Northern Lights - YouTube
daap.songdatakind: True
dacp.playerstate: Playing

[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: FLUSH: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/12487981574068520270
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:60126; Thread-2 (process_request_thread)]: DMAP:
dmap.persistentid: 0x5fc3db46c80516be
dmap.itemname: Ola Gjeilo - Northern Lights - YouTube
daap.songdatakind: True
dacp.playerstate: Playing

[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
<these lines repeat indefinitely...>

What commit exhibits the issue?

9b37407

Was there a last known working commit?

No response

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

Python 3.10.4

OS the receiver runs on

Ubuntu 22.04

OS the sender runs

OS X 10.14.6

Which sender client was used

YouTube website in Firefox (as a browser)

Command invocation

python3 ap2-receiver.py -m DownstairsSpeakers --netiface=wlp3s0 -nv

Please include --debug output which helps to illustrate the problem

python3 ap2-receiver.py -m DownstairsSpeakers --netiface=wlp3s0 -nv --debug
[Receiver] logging level: DEBUG
[Receiver]: Name: DownstairsSpeakers
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
[HAP] logging level: DEBUG
[HAP]: Loading ed25519 keypair for own ID: aa5cb8df-7f14-4249-901a-5e748ce57a93
[Receiver]: Interface: wlp3s0
[Receiver]: Mac: xxxxxxxxxxxxxxxxx
[Receiver]: IPv4: 10.0.0.67
[Receiver]: IPv6: fe80::d5b5:ac45:4dfe:f532
[Receiver]:
[asyncio]: Using selector: EpollSelector
[Receiver]: mDNS: service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[AP2Server: 10.0.0.67:7000] logging level: DEBUG
[Receiver]: serving on 10.0.0.67:7000
[AP2Server: 10.0.0.67:7000]: Opened connection from 10.0.0.218:50530
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)] logging level: DEBUG
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: GET: /info
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-ProtocolVersion: 1
Content-Length: 70
Content-Type: application/x-apple-binary-plist
CSeq: 0
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'qualifier': ['txtAirPlay']}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Sending our device info
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'audioLatencies': [{'inputLatencyMicros': 0, 'outputLatencyMicros': 400000}],
 'deviceID': '14:cc:20:10:a6:fa',
 'features': 495880824111616,
 'keepAliveLowPower': True,
 'keepAliveSendStatsAsBody': True,
 'manufacturer': 'OpenAirplay',
 'model': 'Receiver',
 'name': 'DownstairsSpeakers',
 'nameIsFactoryDefault': False,
 'pi': 'aa5cb8df-7f14-4249-901a-5e748ce57a93',
 'protocolVersion': '1.1',
 'sdk': 'AirPlay;2.0.2',
 'sourceVersion': '366.0',
 'statusFlags': '0x4'}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /pair-setup
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-HKP: 4
X-Apple-Client-Name: MacBook Pro - Vega
Content-Length: 9
Content-Type: application/x-apple-binary-plist
CSeq: 1
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[HAP] logging level: DEBUG
[HAP]: Loading ed25519 keypair for own ID: aa5cb8df-7f14-4249-901a-5e748ce57a93
[HAP]: -----    Pair-Setup [1/2]
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /pair-setup
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-HKP: 4
X-Apple-Client-Name: MacBook Pro - Vega
Content-Length: 457
Content-Type: application/x-apple-binary-plist
CSeq: 2
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[HAP]: -----    Pair-Setup [2/2]
00000000: 3F CB 29 BE 05 C3 64 5B  68 B9 BB DA 8A FF 1F AE  ?.)...d[h.......
00000010: 6E EF 5C D8 7A 46 CE 7C  59 CD AE 9F 28 4D EC 3B  n.\.zF.|Y...(M.;
00000020: BE D6 89 5F 1A 32 24 6C  EA 8C 1F E8 CB 2B 37 54  ..._.2$l.....+7T
00000030: AA CE D4 58 27 0A 2B 5B  A7 81 2F A1 5E E3 E1 4D  ...X'.+[../.^..M
[AP2Server: 10.0.0.67:7000]: Thread-2 (process_request_thread): Opened HAPSocket from 10.0.0.218:50530
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: ----- ENCRYPTED CHANNEL -----
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /fp-setup
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-ET: 32
Content-Length: 16
Content-Type: application/octet-stream
CSeq: 3
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /fp-setup
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-ET: 32
Content-Length: 164
Content-Type: application/octet-stream
CSeq: 4
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SETUP: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Content-Length: 765
Content-Type: application/x-apple-binary-plist
CSeq: 5
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'deviceID': '38:F9:D3:90:D3:C1',
 'groupContainsGroupLeader': False,
 'groupUUID': '5A6061B6-1AE4-46B2-BAE1-BD5134FDDC54',
 'isMultiSelectAirPlay': False,
 'macAddress': '00:E0:XX:XX:XX:XX',
 'model': 'MacBookPro15,3',
 'name': 'MacBook Pro - Vega',
 'osBuildVersion': '18G9216',
 'osName': 'Mac OS X',
 'osVersion': '10.14.6',
 'senderSupportsRelay': False,
 'sessionUUID': 'E1CFECF4-8033-46C1-AC36-844989D60D9D',
 'sourceVersion': '387.2',
 'timingPeerInfo': {'Addresses': ['10.0.0.218', 'fe80::1cbc:58e2:1858:6699'],
                    'ID': '5A6061B6-1AE4-46B2-BAE1-BD5134FDDC54',
                    'SupportsClockPortMatchingOverride': True},
 'timingPeerList': [{'Addresses': ['10.0.0.218', 'fe80::1cbc:58e2:1858:6699'],
                     'ID': '5A6061B6-1AE4-46B2-BAE1-BD5134FDDC54',
                     'SupportsClockPortMatchingOverride': True}],
 'timingProtocol': 'PTP'}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Sending EVENT:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: [+] eventPort=60171
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'eventPort': 60171,
 'timingPeerInfo': {'Addresses': ['10.0.0.67'], 'ID': '14:cc:20:10:a6:fa'},
 'timingPort': 0}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[utils] removing StreamHandler from events file logger
[events] file logging level: DEBUG
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: GET: /info
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: X-Apple-ProtocolVersion: 1
CSeq: 6
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: GET_PARAMETER: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Content-Length: 8
Content-Type: text/parameters
CSeq: 7
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: GET_PARAMETER: b'volume'
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Volume Management is disabled
00000000: 76 6F 6C 75 6D 65 3A 20  30 0D 0A                 volume: 0..
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: RECORD: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 8
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SETPEERS: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Content-Length: 97
Content-Type: /peer-list-changed
CSeq: 9
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: ['10.0.0.67', '10.0.0.218', 'fe80::1cbc:58e2:1858:6699']
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Content-Length: 20
Content-Type: text/parameters
CSeq: 10
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SET_PARAMETER: b'volume' => b' -20.000000'
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Volume Management is disabled
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SETUP: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Content-Length: 223
Content-Type: application/x-apple-binary-plist
CSeq: 11
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'streams': [{'audioFormat': 262144,
              'audioMode': 'default',
              'controlPort': 59079,
              'ct': 2,
              'latencyMax': 88200,
              'latencyMin': 11025,
              'spf': 352,
              'streamConnectionID': 26595965306948614,
              'type': 96}]}
[Control: 10.0.0.67:35456] logging level: DEBUG
[utils] removing StreamHandler from Audio.debug file logger
[Audio.debug] file logging level: DEBUG
[AudioRealtime] logging level: DEBUG
[AudioRealtime]: Negotiated audio format: AirplayAudFmt.ALAC_44100_16_2
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: Building stream channels:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: [+] type 96: controlPort=35456 dataPort=54558
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: {'streams': [{'audioBufferSize': 8388608,
              'controlPort': 35456,
              'dataPort': 54558,
              'streamID': 1,
              'type': 96}]}
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[HAP] logging level: DEBUG
[HAP]: Loading ed25519 keypair for own ID: aa5cb8df-7f14-4249-901a-5e748ce57a93
[asyncio]: Using selector: EpollSelector
[Control: 10.0.0.67:35456] logging level: DEBUG
ALSA lib pcm_dsnoop.c:601:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
[AudioRealtime]: audioDevicelatency (sec): 0.00868
[AudioRealtime]: pyAudioDelay (sec): 0.00871
[AudioRealtime]: Total sample_delay (sec): 0.01939
[Control: 10.0.0.67:35456]: TIME_ANNOUNCE_PTP: senderRtpTimestamp=229729149 with monotonic_s=1797.1751488 clockID=adde480011220000 plays at timestamp=229806324
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: RTP-Info: rtptime=229718124
Content-Length: 118
Content-Type: application/x-dmap-tagged
CSeq: 12
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: DMAP:
dmap.persistentid: 0x5463ce7a475a5aff
dmap.itemname: Ola Gjeilo - Gjeilo: Night - YouTube
daap.songdatakind: True
dacp.playerstate: Playing

[Control: 10.0.0.67:35456]: TIME_ANNOUNCE_PTP: senderRtpTimestamp=229730425 with monotonic_s=1797.2040753 clockID=adde480011220000 plays at timestamp=229807600
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: FLUSH: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: RTP-Info: seq=58171;rtptime=229813110
CSeq: 13
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: SET_PARAMETER: rtsp://10.0.0.67/16271484513579910849
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: RTP-Info: rtptime=229719400
Content-Length: 118
Content-Type: application/x-dmap-tagged
CSeq: 14
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: DMAP:
dmap.persistentid: 0x5463ce7a475a5aff
dmap.itemname: Ola Gjeilo - Gjeilo: Night - YouTube
daap.songdatakind: True
dacp.playerstate: Playing

[Control: 10.0.0.67:35456]: TIME_ANNOUNCE_PTP: senderRtpTimestamp=229775405 with monotonic_s=1798.2240370 clockID=adde480011220000 plays at timestamp=229852580
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 15
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[Control: 10.0.0.67:35456]: TIME_ANNOUNCE_PTP: senderRtpTimestamp=229820386 with monotonic_s=1799.2440101 clockID=adde480011220000 plays at timestamp=229897561
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[Control: 10.0.0.67:35456]: TIME_ANNOUNCE_PTP: senderRtpTimestamp=229865367 with monotonic_s=1800.2639989 clockID=adde480011220000 plays at timestamp=229942542
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 16
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AudioRealtime]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 17
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 18
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 19
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 20
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 21
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 22
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 23
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 24
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 25
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 26
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 27
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 28
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 29
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 30
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 31
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 32
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 33
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 34
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 35
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 36
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 37
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 38
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 39
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 40
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 41
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 42
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 43
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 44
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 45
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 46
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 47
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2


[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: POST: /feedback
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]:
[AP2Handler: 10.0.0.67:7000<=>10.0.0.218:50530; Thread-2 (process_request_thread)]: CSeq: 48
DACP-ID: C666A81DB114C317
Active-Remote: 3639393480
User-Agent: AirPlay/387.2

Additional information

No response

Cannot stream from macOS Big Sur / iOS 14.7

I'm running the program on macOS 10.15 (iMac). I'm trying to stream from my MacBook Pro running 11.4 (Big Sur). It fails to connect. Firewall is off on the receiving end. Scanning over the Console.app output, it seems there's a pairing issue at fault.

default 08:22:37.916774+0200    AirPlayXPCHelper    [0x0407] httpConnection_setupHTTPClient: HTTPClient connected to [fe80::1872:10fc:5680:45cc%en0]:7000 (from [fe80::c19:bc68:b62e:f9b8%en0]:58147)
default 08:22:37.916882+0200    mDNSResponder   [R224386] DNSServiceQueryRecord(400000, 6, <mask.hash: 'r3qep7Q7hNXNbqvcgWk21g=='>, SRV) STOP PID[128](AirPlayXPCHelpe)
default 08:22:37.917201+0200    AirPlayXPCHelper    Connect success: CID 0xFD2B0000, Peer NULL
default 08:22:37.917242+0200    mDNSResponder   [R224387] DNSServiceGetAddrInfo(<mask.hash: 'E3HhpjVsWybBrdpHSCEKyQ=='>) STOP PID[128](AirPlayXPCHelpe)
default 08:22:37.917243+0200    AirPlayXPCHelper    Request start: CID 0xFD2B0001, Peer NULL, TimeoutSecs 60
default 08:22:37.917310+0200    AirPlayXPCHelper    Request written: CID 0xFD2B0001, Header 209 bytes, Body 70 bytes
default 08:22:37.926878+0200    AirPlayXPCHelper    Response received: CID 0xFD2B0001, Header 123 bytes, Body 1088 bytes, Status 200
error   08:22:37.927030+0200    AirPlayXPCHelper    airPlayDescription_updateAdvertiserInfoWithEndpointInfo:3544: false condition
default 08:22:37.927073+0200    AirPlayXPCHelper    [AirPlayVolume] [0x97A1] No Initial Volume from receiver
default 08:22:37.927258+0200    AirPlayXPCHelper    [0x52A1] APPairingClientCoreUtils created.
default 08:22:37.927297+0200    AirPlayXPCHelper    [0x97A1] Created pairing client [0x52A1]
error   08:22:37.968051+0200    AirPlayXPCHelper    coreUtilsPairing_XPCFindPeer:1271: got error -6727/0xFFFFE5B9 kNotFoundErr
default 08:22:37.968096+0200    AirPlayXPCHelper    [0x97A1] Pair-setup over Infra with "myap2"
default 08:22:37.968270+0200    AirPlayXPCHelper    [0x07AD] APPairingClientCoreUtils created.
default 08:22:37.968303+0200    AirPlayXPCHelper    [0x97A1] Created pairing client [0x07AD]
default 08:22:37.968327+0200    AirPlayXPCHelper    [0x07AD] Control pair-setup CU, type 4
default 08:22:37.968348+0200    AirPlayXPCHelper    [0x07AD] PairingFlags 16
default 08:22:37.968368+0200    AirPlayXPCHelper    [0x07AD] Created Pair-setup session [0x6AFD]
default 08:22:37.968388+0200    AirPlayXPCHelper    PairStart, PairSetupClient, 0x10 < Transient >
default 08:22:37.968410+0200    AirPlayXPCHelper    Pair-setup client M1 -- start request
    0x00 (Method), 1 bytes, 00 |^|
    0x06 (State),  1 bytes, 01 |^|
    0x13 (Flags),  1 bytes, 10 |^|
error   08:22:37.968668+0200    kernel  Sandbox: AirPlayXPCHelper(128) deny(1) mach-lookup com.apple.timed.xpc
default 08:22:37.968739+0200    AirPlayXPCHelper    Error: Daemon connection invalidated
default 08:22:37.968925+0200    AirPlayXPCHelper    Request start: CID 0xFD2B0002, Peer NULL, TimeoutSecs 60
default 08:22:37.969001+0200    AirPlayXPCHelper    Request written: CID 0xFD2B0002, Header 250 bytes, Body 9 bytes
default 08:22:37.975825+0200    AirPlayXPCHelper    Response received: CID 0xFD2B0002, Header 113 bytes, Body 32 bytes, Status 200
default 08:22:37.975933+0200    AirPlayXPCHelper    ### [0x07AD] Control pair-setup CU failed: 200401/0x30ED1 Unauthorized
error   08:22:37.975971+0200    AirPlayXPCHelper    coreUtilsPairing_PerformSetup:536: got error 200403/0x30ED3 Forbidden
error   08:22:37.975994+0200    AirPlayXPCHelper    apsession_performPairSetup:5423: got error 200403/0x30ED3 Forbidden
error   08:22:37.976012+0200    AirPlayXPCHelper    apsession_ensurePaired:5792: got error 200403/0x30ED3 Forbidden
error   08:22:37.976030+0200    AirPlayXPCHelper    apsession_ensureConnectedInternal:1820: got error 200403/0x30ED3 Forbidden
default 08:22:37.976088+0200    AirPlayXPCHelper    APTransportTrafficRegistrar: MAC 00:00:00:00:00:00 has 0 connections, 1 require infrastructure
error   08:22:37.976138+0200    AirPlayXPCHelper    apsession_ensureStartedInternalStage1StartTransaction:2035: got error 200403/0x30ED3 Forbidden
default 08:22:37.976192+0200    AirPlayXPCHelper    [0x97A1] Disconnecting from 'myap2-AP'
error   08:22:37.976231+0200    AirPlayXPCHelper    ### [0xD774] Received sender session failed notification.
error   08:22:37.976283+0200    AirPlayXPCHelper    apsession_ensureStartedInternal:1982: got error 200403/0x30ED3 Forbidden
error   08:22:37.976309+0200    AirPlayXPCHelper    endpoint_activateInternal:3011: got error 200403/0x30ED3 Forbidden
error   08:22:37.976329+0200    AirPlayXPCHelper    [0xD774] Endpoint activation (seed 7) failed with error 200403/0x30ED3 Forbidden.
default 08:22:37.976402+0200    AirPlayXPCHelper    [0xD774] Deactivating endpoint 'myap2' with reason 'FailedActivation'...

Output from the program:

Got connection with 192.168.1.16:57980
GET: /info?txtAirPlay&txtRAOP


192.168.1.16 - - [02/Sep/2021 08:22:48] code 404, message : Method GET Path /info?txtAirPlay&txtRAOP endpoint not implemented

Error streaming from iPhone

I installed airplay2-receiver on both:

  1. 2018 Macbook Pro running Big Sur 11.6.2
  2. 2014 Mac Mini running running Monterey 12.1

for both installs I am able to connect my iPhone (iOs 15.2) via airplay. However, once I start streaming I get the following error:

[Audio.Main]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')

python ap2-receiver.py -m myap2 --netiface=en0
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: Feat.Ft48TransientPairing|Ft47PeerMgmt|Ft46HKPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertInf|Ft22AudioUnencrypted|Ft20RcvAudAAC_LC|Ft19RcvAudALAC|Ft18RcvAudPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgres|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
[Receiver]: Interface: en0
[Receiver]: Mac: f0:18:98:38:a9:94
[Receiver]: IPv4: 192.168.68.116
[Receiver]: IPv6: fe80::4e:3d75:354a:dfae
[Receiver]:
[asyncio]: Using selector: KqueueSelector
[Receiver]: mDNS service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[Receiver]: serving at port 7000
[Receiver]: Opened connection from 192.168.68.124:54885
[Receiver]: {'qualifier': ['txtAirPlay']}
[Receiver]: Sending our device info
[Receiver]: SETUP: rtsp://192.168.68.116/367695622011766926
[Receiver]:
[Receiver]: GET_PARAMETER: rtsp://192.168.68.116/367695622011766926
[Receiver]: GET_PARAMETER: b'volume'
[Receiver]: RECORD: rtsp://192.168.68.116/367695622011766926
[Receiver]: SETPEERS: rtsp://192.168.68.116/367695622011766926
[Receiver]: ['192.168.68.124', 'fe80::1852:8e1a:5388:12dd']
[Receiver]: TEARDOWN: rtsp://192.168.68.116/367695622011766926
[Receiver]: {}
[Receiver]: Opened connection from 192.168.68.124:54897
[Receiver]: {'qualifier': ['txtAirPlay']}
[Receiver]: Sending our device info
[Receiver]: SETUP: rtsp://192.168.68.116/5351491092943162614
[Receiver]:
[Receiver]: GET_PARAMETER: rtsp://192.168.68.116/5351491092943162614
[Receiver]: GET_PARAMETER: b'volume'
[Receiver]: RECORD: rtsp://192.168.68.116/5351491092943162614
[Receiver]: SETPEERS: rtsp://192.168.68.116/5351491092943162614
[Receiver]: ['192.168.68.124', 'fe80::1852:8e1a:5388:12dd']
[Receiver]: SETUP: rtsp://192.168.68.116/5351491092943162614
[Receiver]:
[Receiver]: FLUSH: rtsp://192.168.68.116/5351491092943162614
[Audio.Main]: Total sample_delay (sec): 0.12676
[Audio.Main]: RTP ChaCha20_Poly1305 decrypt: ValueError('MAC check failed')

Can't connect to the receiver by personal hotspot (on phone aka tethering)

Server: iPhone (iOS 15.1)
Receiver: Windows with python 3.6

When making connections with local router or windows tethering everything is ok, while using personal hotspot from iPhone, the pairing process would be stopped after server received the reply from the second fairplay setup. I have no idea that whether two apple device could use AirPlay by personal hotspot, so if there's any solution (maybe NTP with legacy pairing), please tell me, thanks.

System logs of iPhone from one failed connection

Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Pair-setup transient client done -- server authenticated
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x831E] Control pair-setup coreUtils success
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Created pairing client [0x831E]
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Created APKeyHolderCoreUtils [0x3990]
Nov 12 16:30:09 mediaserverd(libMobileGestalt.dylib)[35] <Notice>: elided platform fast path for key: re6Zb+zwFKJNlkQTUeT+/w
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xE4B10005, Peer NULL, TimeoutSecs 60
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xE4B10005, Header 196 bytes, Body 16 bytes
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xE4B10005, Header 73 bytes, Body 142 bytes, Status 200
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xE4B10006, Peer NULL, TimeoutSecs 60
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xE4B10006, Header 197 bytes, Body 164 bytes
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xE4B10006, Header 72 bytes, Body 32 bytes, Status 200
Nov 12 16:30:09 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(CoreMedia)[35] <Notice>: <<<< 8021ASClock >>>> CM8021ASClockCreate: clock <0x15d5278b0> initially locked to GM 0x68ef433b5a4e0008
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: Setting PTP clock 0xA8D8 to update every 2000 ms
Nov 12 16:30:09 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:30:09 mediaserverd(CoreMedia)[35] <Notice>: <<<< TimeSyncClock >>>> CMTimeSyncClockCreateForSystemDomainClockIdentifier: clock 0x15d580ce0 created
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] GMID: 0x68ef433b5a4e0008 --> 0x68ef433b5a4e0008, GM peer is: 'NULL'
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Clock hub changed to NULL.
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP started
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: BootUUID 4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: clock_copyUsableInterface:422: false condition
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: APSNetworkClockDetermineAndSetOrUpdateLocalPeerInfo:782: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureSenderNetworkClockStarted:4356: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0x6AAB] Failed to set up senderNetworkClock err = -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ptpClock_removePeerInternal:1225: false condition
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: ### Removing peer from PTP clock 0xA8D8 failed, err -72291/0xFFFEE59D
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0x6AAB] Failed to remove peer 172.20.10.3 from sender network clock
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP stopped
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureStartedInternalStage1StartTransaction:2136: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] Disconnecting from 'myap2-AP'
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: ### [0xF6A8] Received sender session failed notification.
Nov 12 16:30:09 wifid[52] <Notice>: __WiFiServerClientTerminationCallback: Client mediaserverd terminated, cleanup state
Nov 12 16:30:09 wifid(WiFiPolicy)[52] <Notice>: manager->wow.lpasSetting 1 CFSetGetCount(manager->wow.wowClients) 2 isWowActivityRegistered=0 manager->wow.overrideWoWState 0 manager->externalPower 1 manager->iokit.battery.chargeLevel 72
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0x6AAB] APSenderSessionAirPlay disconnected
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: apsession_ensureStartedInternal:2069: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: endpoint_activateInternal:3056: got error -71974/0xFFFEE6DA
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Error>: [0xF6A8] Endpoint activation (seed 1) failed with error -71974/0xFFFEE6DA .
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xF6A8] Deactivating endpoint 'myap2' with reason 'FailedActivation'...
Nov 12 16:30:09 mediaserverd(CoreUtils)[35] <Notice>: [0xA98B] APTransportConnectionHTTP finalizing.

System logs of iPhone from one successful connection

Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Pair-setup transient client done -- server authenticated
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x2489] Control pair-setup coreUtils success
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x86DB] Created pairing client [0x2489]
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0x86DB] Created APKeyHolderCoreUtils [0xFE89]
Nov 12 16:24:10 mediaserverd(libMobileGestalt.dylib)[35] <Notice>: elided platform fast path for key: re6Zb+zwFKJNlkQTUeT+/w
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xB7E60005, Peer NULL, TimeoutSecs 60
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xB7E60005, Header 196 bytes, Body 16 bytes
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xB7E60005, Header 73 bytes, Body 142 bytes, Status 200
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request start: CID 0xB7E60006, Peer NULL, TimeoutSecs 60
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Request written: CID 0xB7E60006, Header 197 bytes, Body 164 bytes
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Response received: CID 0xB7E60006, Header 72 bytes, Body 32 bytes, Status 200
Nov 12 16:24:10 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(CoreMedia)[35] <Notice>: <<<< 8021ASClock >>>> CM8021ASClockCreate: clock <0x15d43d1e0> initially locked to GM 0x68ef433b5a4e0008
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Setting PTP clock 0xA8D8 to update every 2000 ms
Nov 12 16:24:10 kernel(IOTimeSyncFamily)[0] <Notice>: IOTimeSyncClockManager::addgPTPServices adding services
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(TimeSync)[35] <Notice>: Adding Client <private> to clock <private> clients <private>
Nov 12 16:24:10 mediaserverd(CoreMedia)[35] <Notice>: <<<< TimeSyncClock >>>> CMTimeSyncClockCreateForSystemDomainClockIdentifier: clock 0x15d535330 created
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] GMID: 0x68ef433b5a4e0008 --> 0x68ef433b5a4e0008, GM peer is: 'NULL'
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Clock hub changed to NULL.
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] <AirPlayClock> APSNetworkClock PTP started
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: BootUUID 4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: Setting local peer info for PTP clock 0xA8D8 to {
    "ID" : "4D8D62FD-AC34-46D0-B96F-9DF8C333A1E0",
    "Addresses" : 
    [
        <APSNetworkAddress 0x15d52f830 '192.168.1.4'>,
        <APSNetworkAddress 0x15d7c9a50 'fe80::4c3:18b7:7922:754e%en0'>,
        <APSNetworkAddress 0x15d7c9a80 '240e:398:3eb:5570:1070:ba5a:8782:108'>
    ],
    "DeviceType" : 0,
    "InterfaceName" : "en0",
    "SupportsClockPortMatchingOverride" : true,
}
Nov 12 16:24:10 mediaserverd(CoreUtils)[35] <Notice>: [0xA8D8] Number of legacy peers added to peer list: 0

FileNotFoundError: [Errno 2] No such file or directory: './pairings/ltsk.txt'

Build was success, but got an keypair related error as below when tried to run it.

What did I miss something ?

Generating new ed25519 keypair for b'aa5cb8df-7f14-4249-901a-5e748ce57a93'
Traceback (most recent call last):
File "ap2-receiver.py", line 213, in
LTPK = LTPK()
File "ap2-receiver.py", line 178, in init
announce_id, self.ltpk = Hap(PI).configure()
File "/airplay2/ap2/pairing/hap.py", line 335, in init
encryption_algorithm=serialization.NoEncryption()
File "/airplay2/ap2/pairing/hap.py", line 273, in set_ltsk
self.set_bytes(_id, 'LTSK', _value)
File "/airplay2/ap2/pairing/hap.py", line 199, in set_bytes
_val
File "/airplay2/ap2/pairing/hap.py", line 176, in create_entry
self.json_handler.put_store(self.store)
File "/airplay2/ap2/pairing/hap.py", line 155, in put_store
self.save_store()
File "/airplay2/ap2/pairing/hap.py", line 158, in save_store
self.save_json(self.store, self.path)
File "/airplay2/ap2/pairing/hap.py", line 142, in save_json
with open(path, mode="w", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: './pairings/ltsk.txt'

much noisy or broken voice when playing songs.

The problem

I do complied the project and the receiver worked in my windows pc and raspberry pi.
but the sounds has much noisy . and when I see the log, there are many resend request.
any other meet this problem?

also, I fix some codes otherewise the voice cannot play. what I changed like following:

@@ -569,7 +569,7 @@ class Audio:
try:
for frame in self.codecContext.decode(packet):
frame = self.resampler.resample(frame)

  •                return frame.planes[0].to_bytes()
    
  •            return frame[0].planes[0].to_bytes()
    

anyone can help? many thanks.

What commit exhibits the issue?

master

Was there a last known working commit?

No response

What type of installation are you running?

virtualenv

With which python3 version do you run Receiver?

python 3.7

OS the receiver runs on

windows

OS the sender runs

win11

Which sender client was used

kugou music

Command invocation

python3 ap2-receiver.py -m jspc -n {xxxxx}

Please include --debug output which helps to illustrate the problem

[comtypes]: CoInitializeEx(None, 2)
[Receiver]: Name: justinpc
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
dev_name: justinpc parser.get_default('mdns'): myap2
dev_name here: justinpc
[comtypes]: Release <POINTER(IMMDeviceEnumerator) ptr=0x11e3b544340 at 11e53671848>
[comtypes]: Release <POINTER(IMMDevice) ptr=0x11e523fb3e0 at 11e53671a48>
[comtypes]: Release <POINTER(IUnknown) ptr=0x11e522c9480 at 11e53671848>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f2bf0 at 11e53671a48>
[comtypes]: Release <POINTER(IAudioSessionManager2) ptr=0x11e522c9480 at 11e53671ac8>
[comtypes]: Release <POINTER(IAudioSessionEnumerator) ptr=0x11e5255ee20 at 11e53671848>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f3600 at 11e53671bc8>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f2bf8 at 11e53671b48>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f3608 at 11e53671a48>
[Receiver]: Interface: {8FA38462-186D-442A-9951-87305B33C34E}
[Receiver]: Mac: 98:3b:8f:d6:f4:7f
[Receiver]: IPv4: 192.168.1.125
[Receiver]: IPv6: 240e:3b1:3498:c680:80e6:a144:5b3d:b38d
[Receiver]:
[asyncio]: Using selector: SelectSelector
[Receiver]: mDNS: service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[Receiver]: serving on 192.168.1.125:7000
[AP2Server: 192.168.1.125:7000]: Opened connection from 192.168.1.176:49741
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: {'qualifier': ['txtAirPlay']}
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: Sending our device info
[AP2Server: 192.168.1.125:7000]: Thread-2: Opened HAPSocket from 192.168.1.176:49741
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SETUP: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]:
[comtypes]: CoInitializeEx(None, 2)
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: GET_PARAMETER: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: GET_PARAMETER: b'volume'
[comtypes]: Release <POINTER(IMMDeviceEnumerator) ptr=0x11e3b544340 at 11e5374f948>
[comtypes]: Release <POINTER(IMMDevice) ptr=0x11e397541a0 at 11e5374f8c8>
[comtypes]: Release <POINTER(IUnknown) ptr=0x11e522c9480 at 11e5374f948>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f3600 at 11e5374f8c8>
[comtypes]: Release <POINTER(IAudioSessionManager2) ptr=0x11e522c9480 at 11e5374f9c8>
[comtypes]: Release <POINTER(IAudioSessionEnumerator) ptr=0x11e5255f830 at 11e5374f948>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f2a80 at 11e5374fbc8>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f3608 at 11e5374fa48>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f2a88 at 11e5374f8c8>
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: RECORD: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SETPEERS: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: ['192.168.1.125',
'192.168.1.176',
'fe80::8c2:464c:174d:b460',
'240e:3b1:3498:c680:93:cb4c:d759:c9c2']
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SETUP: rtsp://192.168.1.125/7898143271540051563
[utils] removing StreamHandler from Audio.debug file logger
[Audio.debug] file logging level: DEBUG
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]:
[comtypes]: Release <POINTER(IMMDeviceEnumerator) ptr=0x11e3b544340 at 11e5377b948>
[comtypes]: Release <POINTER(IMMDevice) ptr=0x11e525a32e0 at 11e5377b0c8>
[comtypes]: Release <POINTER(IUnknown) ptr=0x11e522c9480 at 11e5377b948>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f3600 at 11e5377b0c8>
[comtypes]: Release <POINTER(IAudioSessionManager2) ptr=0x11e522c9480 at 11e5377b9c8>
[comtypes]: Release <POINTER(IAudioSessionEnumerator) ptr=0x11e5255f1a0 at 11e5377b948>
[comtypes]: Release <POINTER(IAudioSessionControl) ptr=0x11e523f3490 at 11e5377bb48>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f3608 at 11e5377bac8>
[comtypes]: Release <POINTER(IAudioSessionControl2) ptr=0x11e523f3498 at 11e5377b0c8>
[asyncio]: Using selector: SelectSelector
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SET_PARAMETER: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SET_PARAMETER: b'progress' => b' 2089603523/2113203412/2100347252'
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: FLUSH: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: SET_PARAMETER: rtsp://192.168.1.125/7898143271540051563
[AP2Handler: 192.168.1.125:7000<=>192.168.1.176:49741; Thread-2]: DMAP:
dmap.persistentid: 0x4673abff1abe5b7d
daap.songalbum: 《我和我的祖国》
daap.songartist: 华语群星
dmap.itemname: 华语群星 - 我和我的祖国
dacp.playerstate: Paused

[comtypes]: CoInitializeEx(None, 2)
[comtypes]: CoInitializeEx(None, 2)
[AudioRealtime]: audioDevicelatency (sec): 0.09000
[AudioRealtime]: pyAudioDelay (sec): 0.09016
[AudioRealtime]: Total sample_delay (sec): 0.18216
D:\myprojects\embedded\airplay2-receiver-main\ap2\connections\audio.py:572: MethodDeprecationWarning: AudioPlane.to_bytes is deprecated.
return frame[0].planes[0].to_bytes()
[AudioRealtime]: requesting resend of sequence_no 54133; amt 2
[AudioRealtime]: requesting resend of sequence_no 54143; amt 1
[AudioRealtime]: requesting resend of sequence_no 54147; amt 3
[AudioRealtime]: requesting resend of sequence_no 54143; amt 1
[AudioRealtime]: requesting resend of sequence_no 54147; amt 3
[AudioRealtime]: requesting resend of sequence_no 54160; amt 1
[AudioRealtime]: requesting resend of sequence_no 54166; amt 1
[AudioRealtime]: requesting resend of sequence_no 54172; amt 4
[AudioRealtime]: requesting resend of sequence_no 54181; amt 1
[AudioRealtime]: requesting resend of sequence_no 54186; amt 1
[AudioRealtime]: requesting resend of sequence_no 54189; amt 1
[AudioRealtime]: requesting resend of sequence_no 54200; amt 2
[AudioRealtime]: requesting resend of sequence_no 54204; amt 1
[AudioRealtime]: requesting resend of sequence_no 54207; amt 1
[AudioRealtime]: requesting resend of sequence_no 54212; amt 2
[AudioRealtime]: requesting resend of sequence_no 54215; amt 1
[AudioRealtime]: requesting resend of sequence_no 54224; amt 1
[AudioRealtime]: requesting resend of sequence_no 54226; amt 2
[AudioRealtime]: requesting resend of sequence_no 54237; amt 3
[AudioRealtime]: requesting resend of sequence_no 54181; amt 1
[AudioRealtime]: requesting resend of sequence_no 54186; amt 1
[AudioRealtime]: requesting resend of sequence_no 54189; amt 1
[AudioRealtime]: requesting resend of sequence_no 54200; amt 2
[AudioRealtime]: requesting resend of sequence_no 54204; amt 1
[AudioRealtime]: requesting resend of sequence_no 54207; amt 1
[AudioRealtime]: requesting resend of sequence_no 54212; amt 2
[AudioRealtime]: requesting resend of sequence_no 54215; amt 1
[AudioRealtime]: requesting resend of sequence_no 54224; amt 1
[AudioRealtime]: requesting resend of sequence_no 54226; amt 2
[AudioRealtime]: requesting resend of sequence_no 54301; amt 3
[AudioRealtime]: requesting resend of sequence_no 54329; amt 1
[AudioRealtime]: requesting resend of sequence_no 54237; amt 3
[AudioRealtime]: requesting resend of sequence_no 54259; amt 1
[AudioRealtime]: requesting resend of sequence_no 54264; amt 2
[AudioRealtime]: requesting resend of sequence_no 54277; amt 1
[AudioRealtime]: requesting resend of sequence_no 54340; amt 2
[AudioRealtime]: requesting resend of sequence_no 54367; amt 1
[AudioRealtime]: requesting resend of sequence_no 54371; amt 3
[AudioRealtime]: requesting resend of sequence_no 54301; amt 3
[AudioRealtime]: requesting resend of sequence_no 54392; amt 2
[AudioRealtime]: requesting resend of sequence_no 54407; amt 1
[AudioRealtime]: requesting resend of sequence_no 54329; amt 1
[AudioRealtime]: requesting resend of sequence_no 54340; amt 2
[AudioRealtime]: requesting resend of sequence_no 54367; amt 1
[AudioRealtime]: requesting resend of sequence_no 54425; amt 1
[AudioRealtime]: requesting resend of sequence_no 54433; amt 2
[AudioRealtime]: requesting resend of sequence_no 54457; amt 1
[AudioRealtime]: requesting resend of sequence_no 54392; amt 2
[AudioRealtime]: requesting resend of sequence_no 54407; amt 1
[AudioRealtime]: requesting resend of sequence_no 54495; amt 1
[AudioRealtime]: requesting resend of sequence_no 54499; amt 3
[AudioRealtime]: requesting resend of sequence_no 54425; amt 1
[AudioRealtime]: requesting resend of sequence_no 54433; amt 2
[AudioRealtime]: requesting resend of sequence_no 54457; amt 1
[AudioRealtime]: requesting resend of sequence_no 54457; amt 1
[AudioRealtime]: requesting resend of sequence_no 54495; amt 1
[AudioRealtime]: requesting resend of sequence_no 54499; amt 3
[AudioRealtime]: requesting resend of sequence_no 54634; amt 4
[AudioRealtime]: requesting resend of sequence_no 54652; amt 1
[AudioRealtime]: requesting resend of sequence_no 54655; amt 1
[AudioRealtime]: requesting resend of sequence_no 54663; amt 1
[AudioRealtime]: requesting resend of sequence_no 54668; amt 2
[AudioRealtime]: requesting resend of sequence_no 54681; amt 1
[AudioRealtime]: requesting resend of sequence_no 54634; amt 4
[AudioRealtime]: requesting resend of sequence_no 54652; amt 1
[AudioRealtime]: requesting resend of sequence_no 54655; amt 1
[AudioRealtime]: requesting resend of sequence_no 54663; amt 1
[AudioRealtime]: requesting resend of sequence_no 54668; amt 2
[AudioRealtime]: requesting resend of sequence_no 54753; amt 5
[AudioRealtime]: requesting resend of sequence_no 54764; amt 2
[AudioRealtime]: requesting resend of sequence_no 54681; amt 1
[AudioRealtime]: requesting resend of sequence_no 54704; amt 1
[AudioRealtime]: requesting resend of sequence_no 54719; amt 1
[AudioRealtime]: requesting resend of sequence_no 54780; amt 1
[AudioRealtime]: requesting resend of sequence_no 54783; amt 1
[AudioRealtime]: requesting resend of sequence_no 54719; amt 1
[AudioRealtime]: requesting resend of sequence_no 54753; amt 5
[AudioRealtime]: requesting resend of sequence_no 54820; amt 2
[AudioRealtime]: requesting resend of sequence_no 54829; amt 1
[AudioRealtime]: requesting resend of sequence_no 54844; amt 1
[AudioRealtime]: requesting resend of sequence_no 54854; amt 2

Additional information

No response

Direct HomePod Streaming Unresponsive

The current release of master is non-functional on Windows devices. No exception, no error, no requests even so much as logged to console. Going to test by going back a bunch of commits until I find out where it broke.

Update 1: I've gone all the way back to d28733e (when #4 was merged) and it's still not working. Very bizarre, likely just something to do with my setup.

Update 2: Restarted the device though I don't think that was the issue. I've tested it twice now and when I initiate the music playing from my HomePod, and then use my phone to also enable streaming to the receiver, it rejects the connection. Would love to know if someone else can repro

Server Not Showing up on iPhone

Hello, I know this is probably a stupid question, but how did you or any other successful users obtain your interface GUID? I'm not sure where to start. I'm on Windows 10.

AttributeError: 'Hap' object has no attribute 'accessory_id'

I'm getting this error using iOS 15 Developer Beta 2 at the first half of the pair-verify step.

POST /pair-verify
-----   Pair-Verify [1/2]
----------------------------------------
Exception occurred during processing of request from ('192.168.1.113', 49212)
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python39\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python39\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python39\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Program Files\Python39\lib\http\server.py", line 429, in handle
    self.handle_one_request()
  File "C:\Program Files\Python39\lib\http\server.py", line 415, in handle_one_request
    method()
  File "E:\Projects\Web Dev\airplay2-receiver\ap2-receiver.py", line 259, in do_POST
    self.handle_pair_verify()
  File "E:\Projects\Web Dev\airplay2-receiver\ap2-receiver.py", line 579, in handle_pair_verify
    res = self.server.hap.pair_verify(body)
  File "E:\Projects\Web Dev\airplay2-receiver\ap2\pairing\hap.py", line 140, in pair_verify
    res = self.pair_verify_m1_m2(req[Tlv8.Tag.PUBLICKEY])
  File "E:\Projects\Web Dev\airplay2-receiver\ap2\pairing\hap.py", line 233, in pair_verify_m1_m2
    accessory_info = self.accessory_curve_public + self.accessory_id + client_public
AttributeError: 'Hap' object has no attribute 'accessory_id'
----------------------------------------

Weirdly, it works on another phone I have which is running iOS 14. Was a change made in iOS 15 which would be affecting this? I can't think of any other reason why my device on the Developer Beta wouldn't be able to pair.

I have made a few modifications to my usage compared to the main repo:

  • I have removed IPv6 as my device does not support it.
  • I have added support for getting & setting the volume on Windows.

If anyone has any idea why this would happen I would appreciate it.

Kind regards,
N

docker run error: zeroconf.NoneUniqueNameException

Originally: ckdo#7

@adrianzhang commented Sep 23, 2020

I git clone the source code and followed the instructions to create docker image and run it. However it gives me an error:

[root@mini airplay2-receiver]# docker run -it --rm --device /dev/snd --env AP2IFACE=enp1s0 --net host invano/ap2-receiver
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
Interface: enp1s0
IPv4: 192.168.1.5
IPv6: 240e:325:c:cf00:2e0:4cff:fe68:39b2

Traceback (most recent call last):
File "ap2-receiver.py", line 737, in
mdns = register_mdns(args.mdns)
File "ap2-receiver.py", line 659, in register_mdns
zeroconf.register_service(info)
File "/usr/local/lib/python3.7/dist-packages/zeroconf/init.py", line 2464, in register_service
self.check_service(info, allow_name_change, cooperating_responders)
File "/usr/local/lib/python3.7/dist-packages/zeroconf/init.py", line 2628, in check_service
raise NonUniqueNameException
zeroconf.NonUniqueNameException

Don't worry about using root account, it is just a test computer. Thank you !

@adrianzhang commented Sep 23, 2020

There is a Airplay printer, other airplay android devices running in same network, however these clients working well.

Docker / Raspi 4 - no sound

Originally: ckdo#10

@PaulWieland commented Feb 21, 2021 •

I’m just testing out the docker image on my raspberry pi 4 and for some reason I am not getting any sound output.

The client (iOS 14.4) connects and I see what looks like audio being buffered in the container log, but I have no audio coming from the 1/8” port on the pi.

I tested aplay a wav file locally to make sure there isn’t something wrong with my pi and it seems to work just fine.

I’m really interested in this project. It would be excellent to have a basic airplay 2 receiver for multi room audio with the pi acting as a receiver and a digital signal processor for DML speakers.

UPDATE:
I ran docker run -it --rm --device /dev/snd --entrypoint /bin/bash invano/ap2-receiver to get to the containers shell, and then ran speaker-test. This is producing static on the pi's headphone jack, which tells me that the the hardware + docker are all working just fine.

@PaulWieland commented Mar 17, 2021

I believe this is some sort of a problem with pyaudio (or even portaudio), but I cannot figure it out. I can't get pyaudio to output any sound under docker on my raspberry pi 4.

I created a new docker image that only installs the libraries and then attempts to play a wav file using the example script from the pyaudio home page. This doesn't produce any sound, however aplay works just fine.
http://people.csail.mit.edu/hubert/pyaudio/

Then then tried compiling portaudio and running the test/patest_sine8. program - (which I am blindly assuming outputs a sine wave sweep) which also produces no sound.

Stuck.

@systemcrash commented Mar 17, 2021

Probably portaudio - I think portaudio is intended for macOS only. Could be wrong.

@PaulWieland commented Mar 17, 2021

Well, doesn’t the receiver script rely on pyaudio to output sound (regardless of OS)?

from what I understand pyaudio is a python wrapper for portaudio.

@systemcrash commented Mar 17, 2021

I was completely wrong XD - PortAudio is cross-platform 🤦

@PaulWieland commented Mar 31, 2021

I built a test dockerfile that does the bare minimum. It's built on the official python3 image and it uses the demo play.py file from pyaudio. No sound.

https://github.com/PaulWieland/pyaudio_test

@M-Whitaker commented Apr 5, 2021

I'm currently also having this issue @PaulWieland do you have this fork working outside of docker? Also I have tried on macOS Big Sur with no luck (however due to Big Sur being different in lots of ways I kind of expected that)

@PaulWieland commented Apr 5, 2021

@M-Whitaker I can't get a RaspberryPi to output sound correctly with pyaudio (see my pyaudio_test container in the previous reply). Docker or not doesn't seem to matter.

From what I understand, the docker container is incompatible with macOS because it expects to output to /dev/snd - which is normal for Linux but not for macOS.

The ap2 receiver does work on macOS if you run it natively using the instructions in the Readme.

@M-Whitaker commented Apr 5, 2021

Ah perfect thanks for the clarification. For information I was using the native install for macOS Big Sur as like you I noted the /dev forwarding wasn't going to work. What devices have you got this working on? as I'm slightly confused as to what is working and what shouldn't as I understand this is a POC.

@PaulWieland commented Apr 5, 2021

I'm running the receiver under 10.15.7 (I haven't updated to Big Sur yet because of compatibility issues with my company's VPN).

Tested Clients:

Music 1.0.6.10 (on Catalina)
iOS 14.4.2

This combination works perfectly fine for me.

@M-Whitaker commented Apr 5, 2021

Ok, thanks for that as said it is really not a surprise that Big Sur breaks things (I'm also running M1 but that shouldn't effect anything from what I have seen skimming the code). I have to say on the docker/portaudio front I haven't previously tried running audio applications though docker as I know getting devices & drivers to work this way can be a pain. Would be interesting to see if #9 works (i.e. not using docker) on your setup as I couldn't get past an error: amixer: Unable to find simple control 'PCM',0

@PaulWieland commented Apr 5, 2021

The program should not be trying to call amixer under darwin (macOS).

airplay2-receiver/ap2/utils.py

Line 44 in cf2d54c
if subsys == "Darwin":

Can you run a quick test to verify what python thinks your OS is?

Go to a terminal and type in python3 and press enter. Now type in the following two lines:

import platform
platform.system()

It will output your system name, which if you are on a mac should be 'Darwin'.

image

@M-Whitaker commented Apr 5, 2021 •

Sorry, this is on my PI4. (My Mistake)

@PaulWieland commented Apr 5, 2021 •

Ok, in that case you need to find out what the alsa device name is (which can be different on each machine - which is why ckdo added the --no-volume-management flag).
https://github.com/ckdo/airplay2-receiver/blob/cf2d54c6dd0534e08acbd02dafef166dff113dfd/docker/start.sh#L19

On mine it's Headphone (not PCM).

So the solution is to run it without volume management - or or to modify the get/set_volume subroutines in the utils.py script.
https://github.com/ckdo/airplay2-receiver/blob/cf2d54c6dd0534e08acbd02dafef166dff113dfd/ap2/utils.py#L48

Launch a container and jump into the shell:
docker run -it --rm --device /dev/snd --net host invano/ap2-receiver /bin/bash

Then type amixer scontrols and it should tell you what your mixer name is.
image

Then modify utils.py accordingly:

Get Volume becomes:

line_pct = subprocess.check_output(["amixer", "get", "Headphone"]).splitlines()[-1]

Set Volume becomes:

subprocess.run(["amixer", "set", "Headphone", "%d%%" % pct])

@M-Whitaker commented Apr 5, 2021

Thanks, that was a bit simple of me... Shouldn't have skipped over that. So this is now working the same as the docker container (no audio) which I assume is the same place you are on your PI4?

@PaulWieland commented Apr 5, 2021 •

Correct. The client can connect and play/pause/disconnect/reconnect/adjust volume. But there's no sound. I'm trying to get help from the port audio mailing list, because I believe this is an issue with that library. The python script is using pyaudio (which depends on portaudio).
https://listserv.cuit.columbia.edu/scripts/wa.exe?A2=2103B&L=PORTAUDIO&D=0&S=b&P=292768

My pyaudio_test was an attempt to isolate the problem.

@satrik commented Apr 16, 2021

@PaulWieland I'm testing it currently with Docker on Debian Buster (kernel 4.19) and it works if I use --privileged for the audio device. I know --privileged isn't a (nice) solution, but it helps to narrow down the error further. I will do some tests on the weekend and maybe I'll find the cause and a nice solution :)

@PaulWieland commented Apr 16, 2021

A small update. I replaced portaudio with alsa and everything works fine.

https://github.com/PaulWieland/airplay2-receiver/blob/alsaaudio/ap2/connections/audio.py

I’m sure this change breaks cross platform support but shairport-sync writes directly to alsa as well so...

Not listed "AirPlay Display"

The problem

I run airplay receiver on Raspberry Pi 4 by "python3 ap2-receiver.py -m myap2 -nv --netiface=eth0"
I saw mDNS packets of "None._airplay.local" with receiver IP address on Wireshark on same network.

I try to screen mirroring from MacBook.
On macOS -> System Preferences -> Displays -> AirPlay Display: the list is empty.
I cannot mirror from MacBook.

What commit exhibits the issue?

9b37407

Was there a last known working commit?

No response

What type of installation are you running?

direct (via python3)

With which python3 version do you run Receiver?

Python 3.7.2

OS the receiver runs on

Linux raspberrypi 5.15.32-v8+ aarch64

OS the sender runs

macOS Big Sur 11.6.3

Which sender client was used

System Preferences -> Displays -> AirPlay Display

Command invocation

python3 ap2-receiver.py -m myap2 -nv --netiface=eth0

Please include --debug output which helps to illustrate the problem

$ python3 ap2-receiver.py -m myap2 -nv --netiface=eth0 --debug
[Receiver] logging level: DEBUG
[Receiver]: Name: None
[Receiver]: Enabled features: 0001c300405f4200
[Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
[HAP] logging level: DEBUG
[HAP]: Loading ed25519 keypair for own ID: aa5cb8df-7f14-4249-901a-5e748ce57a93
[Receiver]: Interface: eth0
[Receiver]: Mac: dc:a6:32:21:f1:64
[Receiver]: IPv4: 192.168.2.20
[Receiver]: IPv6: fe80::5754:665:8c26:259d
[Receiver]:
[asyncio]: Using selector: EpollSelector
[Receiver]: mDNS: service registered
[Receiver]: Starting RTSP server, press Ctrl-C to exit...
[AP2Server: 192.168.2.20:7000] logging level: DEBUG
[Receiver]: serving on 192.168.2.20:7000

Additional information

81 15:38:26.600734 192.168.2.20 MDNS 224.0.0.251 Standard query response 0x0000 PTR None._airplay._tcp.local SRV, cache flush 0 0 7000 dca63221f164@None._airplay.local TXT, cache flush A, cache flush 192.168.2.20 AAAA, cache flush fe80::5754:665:8c26:259d

WireShark mDNS packets.

Receiver visible on iPhone's list but cannot connect

The problem

Hi. I set up a receiver using docker compose. The receiver is visible then on my iPhone and MacBook, however I'm unable to connect. Before it started to be visible on the list I whitelisted required ports in ufw but as I mentioned I cannot connect.

Am I still missing something?

Below are the logs:

me@wyse-5070:~/airplay2-receiver$ sudo docker compose -f docker/docker-compose.yaml up
[+] Running 1/0
 ⠿ Container docker-ap2-1  Created                                                                                                     0.0s
Attaching to docker-ap2-1
docker-ap2-1  | Starting Avahi mDNS/DNS-SD Daemon: avahi-daemonProcess 13 died: No such process; trying to remove PID file. (/run/avahi-daemon//pid)
docker-ap2-1  | .
docker-ap2-1  | [Receiver]: Name: Airplay2
docker-ap2-1  | [Receiver]: Enabled features: 0001c300405f4200
docker-ap2-1  | [Receiver]: FeatureFlags.Ft48TransientPairing|Ft47PeerManagement|Ft46HomeKitPairing|Ft41_PTPClock|Ft40BufferedAudio|Ft30UnifiedAdvertisingInfo|Ft22AudioUnencrypted|Ft20ReceiveAudioAAC_LC|Ft19ReceiveAudioALAC|Ft18ReceiveAudioPCM|Ft17AudioMetaTxtDAAP|Ft16AudioMetaProgress|Ft14MFiSoft_FairPlay|Ft09AirPlayAudio
docker-ap2-1  | [Receiver]: Interface: enp1s0
docker-ap2-1  | [Receiver]: IPv4: 192.168.0.6
docker-ap2-1  | [Receiver]: IPv6: fe80::e654:e8ff:fe3c:6881
docker-ap2-1  | [Receiver]: 
docker-ap2-1  | [asyncio]: Using selector: EpollSelector
docker-ap2-1  | [Receiver]: mDNS: service registered
docker-ap2-1  | [Receiver]: Starting RTSP server, press Ctrl-C to exit...
docker-ap2-1  | [Receiver]: serving on 192.168.0.6:7000
docker-ap2-1  | [AP2Server: 192.168.0.6:7000]: Opened connection from 192.168.0.118:49984
docker-ap2-1  | [AP2Handler: 192.168.0.6:7000<=>192.168.0.118:49984; Thread-2]: {'qualifier': ['txtAirPlay']}
docker-ap2-1  | [AP2Handler: 192.168.0.6:7000<=>192.168.0.118:49984; Thread-2]: Sending our device info
docker-ap2-1  | [AP2Server: 192.168.0.6:7000]: Thread-2: Opened HAPSocket from 192.168.0.118:49984
docker-ap2-1  | [AP2Handler: 192.168.0.6:7000<=>192.168.0.118:49984; Thread-2]: SETUP: rtsp://192.168.0.6/13447777975926408032
docker-ap2-1  | [AP2Handler: 192.168.0.6:7000<=>192.168.0.118:49984; Thread-2]: 

What commit exhibits the issue?

6f3c1ce

Was there a last known working commit?

No response

What type of installation are you running?

Docker

With which python3 version do you run Receiver?

3.8.10

OS the receiver runs on

Ubuntu 20.04.5 LTS

OS the sender runs

iOS 16.1, macOS Ventura 13.0

Which sender client was used

iOS Spotify, macOS settings

Command invocation

sudo docker compose -f docker/docker-compose.yaml up

Please include --debug output which helps to illustrate the problem

No response

Additional information

No response

Rework the pairings folder

@LewdNeko Wonder if you want to take a shot at this. This way, you avoid removing/reinserting all of the strange characters which are not 'file safe' that might appear in IDs today and tomorrow.

I think the pairings should be all be in a single file. It can be whatever format internally, but a text format for simplicity is nice. I propose a single flat JSON file, with each key, ID and permissions base64 encoded.

The alternative is to use binary plists, which we already use in ap2-receiver.

This will at least fix the issue we saw in #38 (comment)

Some Bugs I Noticed in the Program

Originally: ckdo#1

@Bubba8291 commented Jun 5, 2020

Hello,

I like the enhancements you made to this project. There are still a few bugs though, and I would like to point them out incase you missed them. First, after you disconnect, you can't reconnect to the AP2 server without restarting the program. Second, the sound doesn't play every time, meaning I have to restart it a few times before it works. Third, when I did manage to get it to work, when you skip to another section in the song, it gives a few warnings in the console, and it takes a second to go to that section in the song, then it pauses. Fourth, the pause button doesn't work when it's playing. Fifth, it doesn't sync well with other airplay devices. For example, I tested multi room audio with my AirPort Express and my MacBook Pro playing the audio, and they were not synced at all. Also, when I tried to connect AP2 to my Apple TV, there was no log in the console and my phone did some weird UI glitch with the audio sharing widget in control center.

The one thing that worked the best was volume control. I hope this information helps.

@iRayanKhan commented Jun 7, 2020

Hey @Bubba8291, how are you using this project? Are you using docker on a Pi or something else?

@ckdo commented Jun 15, 2020 •

Hello @Bubba8291
Thank you for your feedback.
Actually this project intend to expose a learning platform, and to go further with the AP2 reverse and documentation, not to become a real receiver.
I also want to discover and provide samples/documentation for the sender side (see branch-sender)
I think once the protocol will be fully understood, another program like shairport-sync could be a good candidate for AP2 integration.

@iRayanKhan commented Jun 15, 2020 •

@ckdo Do you have the docker file from docker hub by chance? Invano made it private, and I can't run it on a Pi. I want to help with this project once I can get it running. I have at least 1 of every AirPlay 2 category device so far if that can help.

Edit: Also I would like to see what I can do in terms of the HAP side of the project as much as I can, especially the new audio characteristics for AP2.

@ckdo commented Jun 17, 2020 •

Hello @iRayanKhan,
You're contribution is welcome :)
To anyone who would like to contribute to this reverse of AP2 either by working on this "lab" receiver and/or airplay2 docs on https://github.com/openairplay/airplay-spec , please join us on https://homebridge-slackin.glitch.me/ , #airplay-2 channel

@PaulWieland commented Mar 1, 2021

I just created a PR with some fixes.
ckdo#11
#4

ValueError: Unknown format code 'x' for object of type 'str'

Running this on macOS 10.15 with python 3.8, I'm running into the following issue:

Traceback (most recent call last):
  File "ap2-receiver.py", line 1108, in <module>
    print(f'Enabled features: {FEATURES:016x}')
  File "/usr/local/Cellar/[email protected]/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/enum.py", line 669, in __format__
    return cls.__format__(val, format_spec)
ValueError: Unknown format code 'x' for object of type 'str'

After removing the format specifier the server boots up and starts listening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.