Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Airplay selection not working

I'm trying to implement airplay into my app. I can successfully playback sound and trigger the airplay selector sheet. If the target device is a Bluetooth only device I can connect with no problem and stream the audio to the Bluetooth device, but if the audio device is a airplay specific device like a HomePod or an Apple TV when I select it, I get a spinning icon, indicating that it is trying to connect, and eventually it times out and stops without connecting.

I don't believe it is an AirPlay audio issue because if I go to a different app, for example a podcast app and select my HomePods for output, and then switch back to my app. My audio will correctly stream to the HomePod. Not only that, I have it so that my icon will change color to indicate that it is connected via airplay and it is correctly indicating that it is connected via AirPlay. But I cannot then disconnect it using the Airplay selector.

The issue appears to be in the AirPlay selection side, which I have spent several days attempting to troubleshoot mostly using ChatGPT to suggest code different than what I have to maybe work around the issue. Mostly it is focused on the audio player section, but it doesn't seem like that is really the route that is the problem.

Answered by Engineer in 831124022

Hello @lezone, thank you for your post. Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Accepted Answer

Hello @lezone, thank you for your post. Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Yes, I get the same results with a small test project. Here is a link to it on my iCloud Drive. Let me know if there is a better way to share it.

https://www.icloud.com/iclouddrive/0a2H67-ZW1wkTPEnv_kbVk_yQ#AirPlayTest

STEPS TO REPRODUCE I don't know if audio needs to be playing or not at the time of selecting AirPlay so you can either press play or not on my test app which has a very simple audio file I recorded. If you activate a Bluetooth speaker and you click on the airplay icon, it will allow you to select the Bluetooth speaker and stream to it without any issue. I've tested that.

If you click on the airplay icon and attempt to connect to a standard airplay device like a HomePod, it will spin indefinitely for a minute or two and then stop spinning, but will never connect.

Airplay selection not working
 
 
Q