Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AirPlay receiver (macOS) not working with password based pairing #1385

Open
Lawris opened this issue Jan 11, 2022 · 12 comments
Open

AirPlay receiver (macOS) not working with password based pairing #1385

Lawris opened this issue Jan 11, 2022 · 12 comments

Comments

@Lawris
Copy link

Lawris commented Jan 11, 2022

Hello, first of all, thanks a lot for this software that is a real grail for anyone looking to have a working multi-room audio without having to buy expensive devices to do so. In my case I am setting up Owntone to cast to my Apple TV 4th gen and my iMac.

Casting to the Apple TV works flawlessly.

There are 3 options when it comes to cast to macOS: allowing only devices with the same Apple Id, allowing devices in the same network or everyone. There is also the possibility to set a password.

Screenshot 2022-01-11 at 16 07 40

Since I believe Owntone do not manage passing some sort of Apple Id credentials to macOS, I am using "Anyone on the same network". Please correct me if Owntone actually manages this.

Without setting a password, pairing and casting from Owntone to macOS works great. The problem is that everytime I log off the mac, or restart it or leave it for a while without casting: there is an annyoing popup everytime Owntone tries to pair to the mac, that I need to click on.

Screenshot 2022-01-11 at 16 18 23

I can't save my choice or "always allow" (searched on the internet about it). This is a problem in the sense that if I want to cast music, I absolutely need to be close to the Mac in order to allow Owntone to pair. If I deny or wait to long, the entity in the web interface "Remote & Outputs" unticks (and therefore unpairs?).

I then tried to setup a password from the mac. This way, Owntone doesn't allow me to pair with it, it doens't ask me for a password. And when toggling from the web interface I get this message:

Request failed (status: 500 Internal Server Error, url: http://myserver:3689/api/outputs/115444276454047/toggle)

Logs at the boot of Owntone:

[2022-01-11 16:32:46] [DEBUG]     raop: Event for AirPlay device 'Loris's iMac' (port 7000, id 68fef716e29f)
[2022-01-11 16:32:46] [ INFO]     raop: Adding AirPlay device 'Loris's iMac': password: 0, verification: 0, encrypt: 0, authsetup: 0, metadata: 7, type Other, address 192.168.1.19:7000
[2022-01-11 16:32:46] [DEBUG]     mdns: Avahi Resolver: resolved service 'Loris's iMac' type '_airplay._tcp' proto 0, host Loriss-iMac.local, address 192.168.1.19
[2022-01-11 16:32:46] [DEBUG]     mdns: Connection test to 192.168.1.19:7000 completed successfully
[2022-01-11 16:32:46] [DEBUG]  airplay: Event for AirPlay device 'Loris's iMac' (port 7000, id 68fef716e29f)
[2022-01-11 16:32:46] [ INFO]  airplay: Adding AirPlay device 'Loris's iMac': features 0x4A7FCFD5,0xB8154FDE, type Other, address 192.168.1.19:7000

I don't know if I interpret this correctly, but does this mean that Owntone does not detect the need for a password?

Logs when trying to toggle:

[2022-01-11 16:37:01] [DEBUG]   player: Speaker enable: 'Loris's iMac' (id=115444276454047)
[2022-01-11 16:37:01] [DEBUG]   player: Registered callback to device_activate_cb with id 0 (device 0x55d1597a3490, Loris's iMac)
[2022-01-11 16:37:01] [DEBUG]   player: Number of active callbacks: 1
[2022-01-11 16:37:01] [DEBUG]   player: Subscription request for quality 44100/16/2 (now 1 subscribers)
[2022-01-11 16:37:01] [ INFO]     raop: Making verification request step 4 to 'Loris's iMac'
[2022-01-11 16:37:01] [  LOG]     raop: Verification step 4 to 'Loris's iMac' failed with error code 500: Internal Server Error
[2022-01-11 16:37:01] [DEBUG]   player: Callback request received, id is 0
[2022-01-11 16:37:01] [DEBUG]   player: Unsubscription request for quality 44100/16/2 (now 0 subscribers)
[2022-01-11 16:37:01] [DEBUG]   player: Making deferred callback to device_activate_cb, id was 0
[2022-01-11 16:37:01] [DEBUG]   player: Callback from AirPlay 1 device Loris's iMac to device_activate_cb (status -2)
[2022-01-11 16:37:01] [  LOG]   player: The AirPlay 1 device 'Loris's iMac' requires a valid PIN or password
[2022-01-11 16:37:01] [DEBUG]     main: Command has 0 pending events
[2022-01-11 16:37:01] [DEBUG]   player: Status update - status: 2, events: 12, caller: speaker_generic_bh
[2022-01-11 16:37:01] [DEBUG]      mpd: Asynchronous listener callback called with event type 12.
[2022-01-11 16:37:01] [DEBUG]      web: notify callback reason: 71
[2022-01-11 16:37:01] [DEBUG]      mpd: Notify clients waiting for idle results: 12
[2022-01-11 16:37:01] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/115444276454047/toggle)
[2022-01-11 16:37:01] [DEBUG]      web: notify callback reason: 11
[2022-01-11 16:37:01] [DEBUG]      web: notify callback reply: 4
[2022-01-11 16:37:01] [DEBUG]      web: notify callback reason: 11
[2022-01-11 16:37:01] [DEBUG]      web: notify callback reply: 4
[2022-01-11 16:37:01] [DEBUG]      web: JSON api request: '/api/player'
[2022-01-11 16:37:01] [DEBUG]   player: Player status: stopped

I also tried to add the password in the config file but I get the same logs, so it doesn't seem like it's trying to use it.

Is there any way I could try to force sending the password?

Any help is greatly appreciated.

Thanks.

Owntone version: 28.2
macOS version: 12.0.1 (Monterey)

@ejurgensen
Copy link
Member

Apple has many authentication schemes when it comes to Airplay, and from the log it isn't clear to me which one OwnTone is expected to use here. It looks like OwnTone is trying ATV device verification for Airplay 1, but that isn't working.

My suggestion would be to force OwnTone to use Airplay 2 towards your mac. Then OwnTone will use a different pairing scheme that might work better. You force Airplay 2 by using the "raop_disable" setting in the config file. It is done per device, so you will be doing it just for your mac. Any other devices will be unaffected. If the setting is working you should see in the log that the messages related to session setup are marked with "airplay:" and not "raop:".

Let me know how that works out.

@Lawris
Copy link
Author

Lawris commented Jan 12, 2022

Thanks for your quick answer. Just tried what you said, doesn't seem to work, here are the according logs trying to toggle the mac from web:

[2022-01-12 10:14:38] [DEBUG]      web: JSON api request: '/api/outputs/115444276454047/toggle'
[2022-01-12 10:14:38] [DEBUG]   player: Speaker enable: 'Loris's iMac' (id=115444276454047)
[2022-01-12 10:14:38] [DEBUG]   player: Registered callback to device_activate_cb with id 0 (device 0x5558d67b8d00, Loris's iMac)
[2022-01-12 10:14:38] [DEBUG]   player: Number of active callbacks: 1
[2022-01-12 10:14:38] [DEBUG]   player: Subscription request for quality 44100/16/2 (now 1 subscribers)
[2022-01-12 10:14:38] [DEBUG]   ffmpeg: tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[2022-01-12 10:14:38] [DEBUG]    xcode: Created 'in' filter: time_base=1/44100:sample_rate=44100:sample_fmt=s16:channel_layout=0x3
[2022-01-12 10:14:38] [DEBUG]    xcode: Created 'format' filter: sample_fmts=s16p:sample_rates=44100:channel_layouts=0x3
[2022-01-12 10:14:38] [DEBUG]   ffmpeg: auto-inserting filter 'auto_resampler_0' between the filter 'in' and the filter 'format'
[2022-01-12 10:14:38] [DEBUG]   ffmpeg: ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz
[2022-01-12 10:14:38] [DEBUG]  airplay: device_probe: Sending GET /info (probe) to 'Loris's iMac'
[2022-01-12 10:14:38] [DEBUG]  airplay: Local address: 192.168.1.26 (LL: no) port 53986
[2022-01-12 10:14:38] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 132: cable attached 1, one time pairing 0, password 1, PIN 0
[2022-01-12 10:14:38] [  LOG]  airplay: 'Loris's iMac' requires password authentication, but that is currently unsupported for AirPlay 2
[2022-01-12 10:14:38] [DEBUG]   player: Callback request received, id is 0
[2022-01-12 10:14:38] [DEBUG]   player: Unsubscription request for quality 44100/16/2 (now 0 subscribers)
[2022-01-12 10:14:38] [DEBUG]   player: Making deferred callback to device_activate_cb, id was 0
[2022-01-12 10:14:38] [DEBUG]   player: Callback from AirPlay 2 device Loris's iMac to device_activate_cb (status -2)
[2022-01-12 10:14:38] [  LOG]   player: The AirPlay 2 device 'Loris's iMac' requires a valid PIN or password
[2022-01-12 10:14:38] [DEBUG]     main: Command has 0 pending events
[2022-01-12 10:14:38] [DEBUG]   player: Status update - status: 2, events: 12, caller: speaker_generic_bh
[2022-01-12 10:14:38] [DEBUG]      mpd: Asynchronous listener callback called with event type 12.
[2022-01-12 10:14:38] [DEBUG]      mpd: Notify clients waiting for idle results: 12
[2022-01-12 10:14:38] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/115444276454047/toggle)
[2022-01-12 10:14:38] [DEBUG]      web: notify callback reason: 71
[2022-01-12 10:14:38] [DEBUG]      web: notify callback reason: 11
[2022-01-12 10:14:38] [DEBUG]      web: notify callback reply: 4
[2022-01-12 10:14:38] [DEBUG]      web: notify callback reason: 11
[2022-01-12 10:14:38] [DEBUG]      web: notify callback reply: 4
[2022-01-12 10:14:38] [DEBUG]      web: JSON api request: '/api/outputs'
[2022-01-12 10:14:38] [DEBUG]      web: JSON api request: '/api/player'
[2022-01-12 10:14:38] [DEBUG]   player: Player status: stopped
[2022-01-12 10:14:38] [DEBUG]       db: Running query 'BEGIN TRANSACTION;'
[2022-01-12 10:14:38] [DEBUG]       db: Starting enum 'SELECT * FROM queue f WHERE pos = 0 ORDER BY pos;'
[2022-01-12 10:14:38] [DEBUG]       db: End of queue enum results
[2022-01-12 10:14:38] [DEBUG]       db: Running query 'END TRANSACTION;'
[2022-01-12 10:14:38] [DEBUG]      web: JSON api request: '/api/player'
[2022-01-12 10:14:38] [DEBUG]   player: Player status: stopped
[2022-01-12 10:14:38] [DEBUG]       db: Running query 'BEGIN TRANSACTION;'
[2022-01-12 10:14:38] [DEBUG]       db: Starting enum 'SELECT * FROM queue f WHERE pos = 0 ORDER BY pos;'
[2022-01-12 10:14:38] [DEBUG]       db: End of queue enum results
[2022-01-12 10:14:38] [DEBUG]       db: Running query 'END TRANSACTION;'
[2022-01-12 10:14:38] [DEBUG]      web: JSON api request: '/api/outputs'

Maybe this Airplay Receiver feature on macOS is using another authentification scheme?

What are your thoughts ?

@ejurgensen
Copy link
Member

Ok, here you had "Require password" checked, right? What happens if you uncheck it, but still use Airplay 2? Do you then get the annoying popup?

@Lawris
Copy link
Author

Lawris commented Jan 12, 2022

Yes, I had the require password checked. Testing now while unchecking it and still using Airplay 2.
Pairing once work while accepting the popup, stopping the stream for a few seconds and starting it again gives me the annoying popup again.

Here are the according logs:

[2022-01-12 11:12:16] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 516: cable attached 1, one time pairing 1, password 0, PIN 0
[2022-01-12 11:12:16] [DEBUG]  airplay: device_start: Sending pair verify 1 to 'Loris's iMac'
[2022-01-12 11:12:16] [DEBUG]  airplay: device_start: Sending pair verify 2 to 'Loris's iMac'
[2022-01-12 11:12:16] [DEBUG]  airplay: Ciphering setup of 'Loris's iMac' completed succesfully, now using encrypted mode
[2022-01-12 11:12:16] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Loris's iMac'
...
[2022-01-12 11:12:31] [  LOG]  airplay: No response to SETUP (session) from 'Loris's iMac'
[2022-01-12 11:12:31] [  LOG]  airplay: Clearing 'Loris's iMac' pairing keys, you need to pair again

Looks like the mac forces a new pairing after a moment.

@ejurgensen
Copy link
Member

I shortened the log a bit, removed the irrelevant stuff. I'm confused why it says [2022-01-12 11:12:16] [DEBUG] airplay: device_start: Sending pair verify 1 to 'Loris's iMac', because this request shouldn't be required for your mac. It could be the result of some bad keys being left over from when you used Airplay 1, but as you can see from the last line they should now have been cleared. So how does the log look if you try again? (just share the airplay: parts)

When you have unchecked the password requirement, and you connect from an iOS device, are you then also getting the prompt on the mac each time? (trying to establish if password auth is necessary to avoid the prompt).

@Lawris
Copy link
Author

Lawris commented Jan 13, 2022

Thanks for your reply. So I did let it "rest" until today to retry.

I tried to test it and check the logs in two steps (so that maybe it is more relevant).

(My config is still raop_disable, and on the mac "anyone on the same network" without password)

First test

  1. Open the web interface, Apple TV is still ticked, iMac not.
  2. Start casting from an iOS device
  3. Tick the mac on the web interface, prompt on the mac, accepting it.
  4. Got the usual request failed message on the web interface and now prompting for a pin (on the mac a pin appears).
  5. Entering the pin in the web interface. Pairing successful and music streams correctly.

Here are the logs (stripped to airplay: parts) of the steps above:

[2022-01-13 15:24:17] [DEBUG]  airplay: device_start: Sending GET /info to 'Loris's iMac'
[2022-01-13 15:24:17] [DEBUG]  airplay: Local address: 192.168.1.26 (LL: no) port 34852
[2022-01-13 15:24:17] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 516: cable attached 1, one time pairing 1, password 0, PIN 0
[2022-01-13 15:24:17] [  LOG]  airplay: Starting device pairing for 'Loris's iMac', go to the web interface and enter PIN
[2022-01-13 15:24:17] [DEBUG]  airplay: device_start: Sending PIN start to 'Loris's iMac'
[2022-01-13 15:24:47] [DEBUG]  airplay: device_authorize: Sending pair setup 1 to 'Loris's iMac'
[2022-01-13 15:24:47] [DEBUG]  airplay: device_authorize: Sending pair setup 2 to 'Loris's iMac'
[2022-01-13 15:24:47] [DEBUG]  airplay: device_authorize: Sending pair setup 3 to 'Loris's iMac'
[2022-01-13 15:24:47] [  LOG]  airplay: Pair setup stage complete, saving authorization key
[2022-01-13 15:24:51] [DEBUG]  airplay: device_start: Sending GET /info to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: Local address: 192.168.1.26 (LL: no) port 34904
[2022-01-13 15:24:51] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 516: cable attached 1, one time pairing 1, password 0, PIN 0
[2022-01-13 15:24:51] [DEBUG]  airplay: device_start: Sending pair verify 1 to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: device_start: Sending pair verify 2 to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: Ciphering setup of 'Loris's iMac' completed succesfully, now using encrypted mode
[2022-01-13 15:24:51] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: pair_success: Sending SETPEERS to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: pair_success: Sending SETUP (stream) to 'Loris's iMac'
[2022-01-13 15:24:51] [ INFO]  airplay: Setting up AirPlay session 4039048200 (192.168.1.26 -> 192.168.1.19)
[2022-01-13 15:24:51] [DEBUG]  airplay: Negotiated UDP streaming session; ports d=63185 c=64758 t=0 e=49965
[2022-01-13 15:24:51] [DEBUG]  airplay: RTP-Info is seq=24492;rtptime=1539449304
[2022-01-13 15:24:51] [DEBUG]  airplay: pair_success: Sending RECORD to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: Sending volume -0.000000 to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: pair_success: Sending SET_PARAMETER (volume) to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: SET_PARAMETER (progress): Sending SET_PARAMETER (progress) to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: SET_PARAMETER (text): Sending SET_PARAMETER (text) to 'Loris's iMac'
[2022-01-13 15:24:51] [DEBUG]  airplay: Start sync packet sent to 'Loris's iMac': cur_pos=1539369932, cur_ts=509706.468188765, clock=509706.468250441, rtptime=1539458104
[2022-01-13 15:24:52] [DEBUG]  airplay: Event for AirPlay device 'Loris's iMac' (port 7000, id 68fef716e29f)
[2022-01-13 15:24:52] [ INFO]  airplay: Adding AirPlay device 'Loris's iMac': features 0x4A7FCFD5,0xB8154FDE, type Other, address 192.168.1.19:7000
[2022-01-13 15:24:57] [DEBUG]  airplay: flush: Sending FLUSH to 'Loris's iMac'
[2022-01-13 15:25:07] [DEBUG]  airplay: device_stop: Sending TEARDOWN to 'Loris's iMac'
[2022-01-13 15:25:07] [DEBUG]  airplay: AirPlay event from 'Loris's iMac'
[2022-01-13 15:25:07] [DEBUG]  airplay: 'Loris's iMac' disconnected from the event channel
[2022-01-13 15:25:08] [DEBUG]  airplay: Event for AirPlay device 'Loris's iMac' (port 7000, id 68fef716e29f)
[2022-01-13 15:25:08] [ INFO]  airplay: Adding AirPlay device 'Loris's iMac': features 0x4A7FCFD5,0xB8154FDE, type Other, address 192.168.1.19:7000
[2022-01-13 15:25:09] [DEBUG]  airplay: device_start: Sending GET /info to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: Local address: 192.168.1.26 (LL: no) port 34946
[2022-01-13 15:25:09] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 516: cable attached 1, one time pairing 1, password 0, PIN 0
[2022-01-13 15:25:09] [DEBUG]  airplay: device_start: Sending pair verify 1 to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: device_start: Sending pair verify 2 to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: Ciphering setup of 'Loris's iMac' completed succesfully, now using encrypted mode
[2022-01-13 15:25:09] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: pair_success: Sending SETPEERS to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: pair_success: Sending SETUP (stream) to 'Loris's iMac'
[2022-01-13 15:25:09] [ INFO]  airplay: Setting up AirPlay session 3124587414 (192.168.1.26 -> 192.168.1.19)
[2022-01-13 15:25:09] [DEBUG]  airplay: Negotiated UDP streaming session; ports d=55244 c=61181 t=0 e=49970
[2022-01-13 15:25:09] [DEBUG]  airplay: RTP-Info is seq=18720;rtptime=2021467322
[2022-01-13 15:25:09] [DEBUG]  airplay: pair_success: Sending RECORD to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: Sending volume -0.000000 to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: pair_success: Sending SET_PARAMETER (volume) to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: SET_PARAMETER (progress): Sending SET_PARAMETER (progress) to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: SET_PARAMETER (text): Sending SET_PARAMETER (text) to 'Loris's iMac'
[2022-01-13 15:25:09] [DEBUG]  airplay: Start sync packet sent to 'Loris's iMac': cur_pos=2021379122, cur_ts=509724.643377195, clock=509724.643772279, rtptime=2021467322
[2022-01-13 15:25:11] [DEBUG]  airplay: Event for AirPlay device 'Loris's iMac' (port 7000, id 68fef716e29f)
[2022-01-13 15:25:11] [ INFO]  airplay: Adding AirPlay device 'Loris's iMac': features 0x4A7FCFD5,0xB8154FDE, type Other, address 192.168.1.19:7000
[2022-01-13 15:25:16] [DEBUG]  airplay: keep_alive: Sending POST /feedback to 'Loris's iMac'
[2022-01-13 15:25:41] [DEBUG]  airplay: keep_alive: Sending POST /feedback to 'Loris's iMac'

Second test

For the second test I stopped the casting from the iOS, waited a few minutes and tried again.

  1. Check the web interface: iMac still ticked.
  2. Start to cast from the same iOS device.
  3. Get a prompt on the iMac, denying it.

Here are the according logs:

[2022-01-13 15:36:18] [DEBUG]  airplay: device_start: Sending GET /info to 'Loris's iMac'
[2022-01-13 15:36:18] [DEBUG]  airplay: Local address: 192.168.1.26 (LL: no) port 35916
[2022-01-13 15:36:18] [DEBUG]  airplay: Status flags from 'Loris's iMac' was 516: cable attached 1, one time pairing 1, password 0, PIN 0
[2022-01-13 15:36:18] [DEBUG]  airplay: device_start: Sending pair verify 1 to 'Loris's iMac'
[2022-01-13 15:36:18] [DEBUG]  airplay: device_start: Sending pair verify 2 to 'Loris's iMac'
[2022-01-13 15:36:18] [DEBUG]  airplay: Ciphering setup of 'Loris's iMac' completed succesfully, now using encrypted mode
[2022-01-13 15:36:18] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Loris's iMac'
[2022-01-13 15:36:31] [  LOG]  airplay: Response to SETUP (session) from 'Loris's iMac' was negative, aborting (400 Bad Request)
[2022-01-13 15:36:31] [  LOG]  airplay: Clearing 'Loris's iMac' pairing keys, you need to pair again

It looks like the mac keeps on denying "SETUP", could it be a new protocol?

@ejurgensen
Copy link
Member

the mac keeps on denying "SETUP", could it be a new protocol?

No, it's because the encryption key has become invalid. This could be because the mac doesn't support persistent pairing with PIN, as the status flags indicate (notice it says PIN 0 and one-time-pairing 1). So I have to look into why OwnTone is going the PIN-route.

@ejurgensen
Copy link
Member

Had a closer look at it, and now I understand why OwnTone is doing as it is. Your mac is announcing "one time pairing" required, which should mean that OwnTone should negotiate a key and then re-use it next time. That is also what OwnTone does, and the key works fine for immediate use, but for reasons I don't understand it doesn't work for subsequent use.

It would be interesting to see what an iOS device does in this case, but it is complicated to test. I would need to test it myself, but I don't have a mac to test with.

So bottom line is that right now I don't have a solution for you. :-(

@Lawris
Copy link
Author

Lawris commented Jan 18, 2022

I understand. Nonetheless, thank you for your time!
Probably gonna write a (hacky) script to always accept airplay notifications when they pop.

@ejurgensen
Copy link
Member

This old issue may have been fixed with commit e437e41, at least for when a password is set and Airplay 2 is used. If you are still around let me know if that is the case, otherwise I will close the issue later.

@andrewbranch
Copy link

I’ve been giving this a try, and am encountering the same issue. Here are some logs showing a switch from an Apple TV called "Living Room" to my Mac Mini, which is set to allow Airplay from anyone on the network, and has a password set.

[2023-07-26 18:15:10] [DEBUG]   player: Player status: paused
[2023-07-26 18:15:10] [DEBUG]      web: JSON api request: '/api/outputs'
[2023-07-26 18:15:10] [DEBUG]     mdns: Avahi Record Browser (Living-room.local, proto 1): NEW record fde4:3020:73e4:4553:7:fd8c:959b:e159 for service type '_raop._tcp'
[2023-07-26 18:15:10] [DEBUG]     mdns: Connection test to [fde4:3020:73e4:4553:7:fd8c:959b:e159]:7000 completed successfully
[2023-07-26 18:15:10] [DEBUG]     raop: Event for AirPlay device 'Living room' (port 7000, id 54e61bf2718e, Active-Remote 468873614)
[2023-07-26 18:15:10] [ INFO]     raop: Adding AirPlay device 'Living room': password: 0, verification: 1, encrypt: 0, authsetup: 0, metadata: 7, type AppleTV, address [fde4:3020:73e4:4553:7:fd8c:959b:e159]:7000
[2023-07-26 18:15:10] [DEBUG]   player: Status update - status: 3, events: 12, caller: device_add
[2023-07-26 18:15:10] [DEBUG]      mpd: Asynchronous listener callback called with event type 12.
[2023-07-26 18:15:10] [DEBUG]      mpd: Notify clients waiting for idle results: 12
[2023-07-26 18:15:10] [DEBUG]      web: notify callback reason: 71
[2023-07-26 18:15:10] [DEBUG]      web: notify callback reason: 11
[2023-07-26 18:15:10] [DEBUG]      web: notify callback reply: 12
[2023-07-26 18:15:10] [DEBUG]      web: JSON api request: '/api/player'
[2023-07-26 18:15:10] [DEBUG]   player: Player status: paused
[2023-07-26 18:15:10] [DEBUG]      web: JSON api request: '/api/outputs'
[2023-07-26 18:15:12] [DEBUG]      web: JSON api request: '/api/player/play'
[2023-07-26 18:15:12] [DEBUG]   player: Restarting track: '/home/andrew/Music/file_example_MP3_700KB.mp3.1' (id=8, pos=19723)
[2023-07-26 18:15:12] [DEBUG]   player: Registered callback to device_activate_cb with id 0 (device 0xa397c8, Andrew’s Mac mini)
[2023-07-26 18:15:12] [DEBUG]   player: Number of active callbacks: 1
[2023-07-26 18:15:12] [DEBUG]   player: Subscription request for quality 44100/16/2 (now 1 subscribers)
[2023-07-26 18:15:12] [DEBUG]   ffmpeg: tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[2023-07-26 18:15:12] [DEBUG]    xcode: Created 'abuffer' filter: 'time_base=1/44100:sample_rate=44100:sample_fmt=s16:channel_layout=0x3'
[2023-07-26 18:15:12] [DEBUG]    xcode: Created 'aformat' filter: 'sample_fmts=s16p:sample_rates=44100:channel_layouts=0x3'
[2023-07-26 18:15:12] [DEBUG]    xcode: Created 'abuffersink' filter: ''
[2023-07-26 18:15:12] [DEBUG]   ffmpeg: auto-inserting filter 'auto_resampler_0' between the filter 'abuffer' and the filter 'aformat'
[2023-07-26 18:15:12] [DEBUG]   ffmpeg: ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz
[2023-07-26 18:15:12] [DEBUG]  airplay: device_start: Sending GET /info to 'Andrew’s Mac mini'
[2023-07-26 18:15:12] [DEBUG]   player: Resuming input read loop for item '/home/andrew/Music/file_example_MP3_700KB.mp3.1' (item id 8)
[2023-07-26 18:15:12] [DEBUG]  airplay: Local address: fde4:3020:73e4:4553:37b4:6327:ada1:b4b1 (LL: no) port 40740
[2023-07-26 18:15:12] [DEBUG]  airplay: Status flags from 'Andrew’s Mac mini' was 644: cable attached 1, one time pairing 1, password 1, PIN 0
[2023-07-26 18:15:12] [DEBUG]  airplay: device_start: Sending pair verify 1 to 'Andrew’s Mac mini'
[2023-07-26 18:15:12] [DEBUG]  airplay: device_start: Sending pair verify 2 to 'Andrew’s Mac mini'
[2023-07-26 18:15:12] [DEBUG]  airplay: Ciphering setup of 'Andrew’s Mac mini' completed succesfully, now using encrypted mode
[2023-07-26 18:15:12] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Andrew’s Mac mini'
[2023-07-26 18:15:12] [ WARN]  airplay: Response to SETUP (session) from 'Andrew’s Mac mini' was negative, proceeding anyway (401 Unauthorized)
[2023-07-26 18:15:12] [DEBUG]  airplay: WWW-Authenticate: Digest realm="airplay", nonce="MTY5MDQyMDUxMiDZSqtQn0wM4KY4D4Ad6WDX"
[2023-07-26 18:15:12] [DEBUG]  airplay: pair_success: Sending SETUP (session) to 'Andrew’s Mac mini'
[2023-07-26 18:15:27] [ WARN]    event: evrtsp_read: read timeout: Success
[2023-07-26 18:15:27] [  LOG]  airplay: No response to SETUP (session) from 'Andrew’s Mac mini'
[2023-07-26 18:15:27] [  LOG]  airplay: Clearing 'Andrew’s Mac mini' pairing keys, you need to pair again
[2023-07-26 18:15:27] [DEBUG]   player: Callback request received, id is 0
[2023-07-26 18:15:27] [DEBUG]   player: Unsubscription request for quality 44100/16/2 (now 0 subscribers)
[2023-07-26 18:15:27] [DEBUG]   player: Making deferred callback to device_activate_cb, id was 0
[2023-07-26 18:15:27] [DEBUG]   player: Callback from AirPlay 2 device Andrew’s Mac mini to device_activate_cb (status -1)
[2023-07-26 18:15:27] [  LOG]   player: The AirPlay 2 device 'Andrew’s Mac mini' failed to activate

When I switch devices, the Mac asks me if I want to allow the device to Airplay to it, even though I’ve already approved in the past. The config for the device is

airplay "Andrew’s Mac mini" {
        permanent = true
        raop_disable = true
        password = "play"
}

@bugprogrammer
Copy link

I understand. Nonetheless, thank you for your time! Probably gonna write a (hacky) script to always accept airplay notifications when they pop.

Is the problem solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants