If when trying to connect to a device with Airplay, you get the error "Could not connect to", this can fix it – thereby sparing you a full system restart:
sudo killall AirPlayXPCHelper
I found this trick by grepping "airplay" in the list of process (ps axu | grep -i airplay
) and tried to kill them.