Recently, I wanted to find a way to stream audio from my iPad to my DAC, both for listening to music and listening to videos I’m watching on the iPad. The latter requires extremely low latency between the audio and the video to be at least usable.
While my Chromecast audio can play music from some apps like Spotify, I’ve never been able to stream audio to it while watching a video. Also, iOS is locked down, and I can probably only use AirPlay for this kind of stuff.

I conveniently have a tiny home-server I can connect the DAC to via USB.
I came across UxPlay, an AirPlay server implementation for both video and sound. This software is available for all OSs.
It allows Apple devices to connect via AirPlay to stream audio and/or video, which can be useful for streaming to a TV without an Apple TV.

In my case, I just wanted to stream audio, but I also wanted to keep audio and video synchronized. Fortunately, Apple engineers thought about this: it turns out the AirPlay protocol buffers the stream for 2 seconds before starting playback. This has two advantages: it gives some room in case of missing packets / unstable Wi-Fi connection, and, by sending the timestamp with each audio packet, the client and the server can play the video/audio at exactly the same time. Commands, like volume update, are sent and applied immediately, so the 2-seconds delay is only for the audio stream.

Installation

I recommend you build UxPlay from source, as binaries in package managers are old. You also need to install all the listed dependencies.
In my case, my server had a Linux “server” distro, so I didn’t even have audio. In this case, you can install alsa and gstreamer1.0-plugins-alsa.
Remember to add yourself to audio: sudo groupadd <YOUR USER> audio.

Usage

First of all, you need to find the card number of your device.
Run aplay -l to list all of the available audio interfaces. Find the one desired.
Mine looks like this (card 1):

...
card 1: D30 [D30], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now you can start UxPlay with this; in hw: set the desired card number:

uxplay -async 2 -al 2 -as "alsasink device=hw:1,0"

The -async and -al parameters are set to 2 as that is the default buffer size. This is the only configuration that works for me.

Once started, you can select the AirPlay device and hit play. Make sure the two devices are on the same network and the Wi-Fi signal is strong.

NOTE: Once connected, the volume will be set at 100%. Not good for your ears.

AirPlay works