Airplay (audio) fails after restarting kodi

Hi,
when I enable airplay in Kodi it works fine, actually works very well. I can send audio from an iphone, ipad and mac.
But everytime that I reboot the raspberry airplay fails, I can’t connect from any device. To make it working again I have to go to settings => Services => Airplay: disable and enable it. Then it works again.

When it fails the effect is that it is visible in the airplay menu of the iphone/ipad/mac, I can select it, but I get an error: “unable to connect”.
Same effect with the 3 apple devices. All connected to the same wifi.

It’s Kodi 19.4 on a raspberry 4 (OMSC).
In kodi I have the option “Enable airplay videos and pictures” disabled in the airplay settings.

I have enabled the logs and watched it from a remote terminal with ‘tail -f’ while I try to connect. When it fails to connect nothing is shown in the logs, like it’s not receiving any connection request. So, there is nothing in the logs.
When I disable/enable airplay in kodi, it works again, and then I can see in the logs the process of connecting, sending the song picture, etc.

I have also a Marantz AVR with airplay enabled that works always fine, with the same apple devices sending the audio.

Any hint would be appreciated.
Thank you!

Is the IP address of your RPi changing when you reboot? I just did a quick test on a RPi 4 streaming from an iPhone and when I rebooted the Pi my phone said the device was disconnected and switched back to playing on my phone. As soon as the Pi rebooted I selected it on my phone again and it immediately started streaming to Kodi again.

No, I have the IP of the RPi fix in the router dhcp, it’s always the same.
In your case it works as I would expect. I have tried to change some settings like uPnP, but unsuccesfully.

uPnP is unrelated to Airplay so those settings wouldn’t make a difference. I’m at a loss for ideas of what could be going on.

Make sure the “wait for network” is enabled in the osmc settings. The airplay service otherwise starts without a proper IP address and that causes the issues you experience.

3 Likes

That’s spot on! You are right, that solved the problem.
I enabled it in: My OSMC → Network → wired → wait for network.

The thing is that this parameter is in both sections: wired and wireless. But is the same parameter, if you enable it in one place gets enabled in the other one also.
Time ago I changed from wireless to wired, maybe then I disabled it by mistake.
Thank you!