The Mac can use the Airplay device as an output device, but it's not ideal, because that will send ALL sound to the Airplay device.
The correct solution is for the application to support Airplay, so that for instance Spotify can stream music to your Airplay device, while the Mac sounds still goes to the speakers of the laptop/iMac.
The correct solution is for the application to support Airplay, so that for instance Spotify can stream music to your Airplay device, while the Mac sounds still goes to the speakers of the laptop/iMac.