Stop-starting airplay from terminal?

I use OSMC/Kodi’s airplay functionality a lot and often run into what seem to be crashes of the airplay service when changing sources*. These can always be fixed by rebooting, but I wondered if there’s a way to restart the airplay service from the command line instead?

Thanks in advance!

* I’m assuming these are a Kodi issue, but in case not, the symptoms are that trying to select Kodi as an audio output leads to a failure to connect message after 30 secs or so. It seems to be repeatable if you try to connect a second airplay device while a first one is active, at which point deactivating that source or streaming over another one become impossible. While that’s obviously putting it under some stress, general use with multiple sources seems to throw up similar symptoms (if less consistently) even when the connection is manually released on one device before connecting another.

There is no “airplay service” - airplay is handled internally by Kodi. So you would need to restart Kodi:

sudo systemctl restart mediacenter

Or use the Exit/Quit option through the GUI.