Skip to content

AirPlay ​

Phones and Macs play their sound on the speaker with AirPlay, and mirror their screen on the TV. It is UxPlay, set up by the package (Device setup) and off until the owner turns it on with the switch in Settings → System → AirPlay. A speaker that was offline when the package was installed has no UxPlay yet: the switch downloads it (press it again a minute later).

What it does ​

  • Sound. UxPlay plays into the speaker's mixer (pcm.boombox), so the speaker's volume stays the master, and the recording copies it like a phone's Bluetooth sound. The song's title, artist and album go into the history.
  • Screen mirroring. UxPlay draws the picture on the TV itself, full screen over the kiosk, for as long as the phone mirrors; the page is still there when it stops. The remote's Back (or Exit) ends it. The phone's screen is portrait, so expect bars at the sides.
  • Takeover. AirPlay is a source like the phone, a playlist or Spotify. Starting it pauses what plays, and when another source starts, the AirPlay client is disconnected, as Spotify's is. With New playback set to keep what plays, a phone that starts AirPlay is turned away.

Settings ​

Setting
NameWhat phones show.
Who may connectAnyone on the network, or a password every phone asks for. (A PIN once per phone is gone: see Good to know.)
Mirror the screenOff: sound only.
Who draws the pictureThe TV (default): UxPlay itself, in hardware. Or the pages: the web pages draw it, so a phone or laptop browser can watch too, at the cost of the TV's CPU.
Picture size540p (default), 720p or 1080p.
Frames per second30 or 60.
Hold the picture backPages only; UxPlay's sync of picture and sound. Off by default: on, the picture was a second late and choppy there. On the TV the picture always follows the phone's times, which keeps it in step with the sound. Sound delay adds to it.
The phone's volume sliderStandard or tapered, its lowest setting in dB, and where it starts.
A silent phone is gone afterSeconds.

How it works ​

On the TV ​

With Who draws the picture set to the TV, the receiver runs -vd v4l2slh264dec -vc identity -vs "waylandsink qos=false max-lateness=-1" -srgb no: the chip's H.264 decoder decodes, and waylandsink hands its picture (NV12) as it is to the kiosk's compositor (sway), whose GPU scales it over Cog. No browser, no copy and no re-encoding are involved. The sink takes every picture, because the phone sends a single keyframe and a decoder that drops a late picture damages the rest of the stream (it showed as choppiness after every screen change on the phone).

Not through the 2D unit (-vc v4l2convert, rockchip-rga): an upright phone's picture (498×1080) is no multiple of 16 wide. As packed 24-bit RGB, which UxPlay pins the converter to on Linux unless -srgb no, it crashed UxPlay (SIGSEGV in v4l2convert's copy) the moment mirroring began; as 32-bit RGB the GPU rejects its rows ("panfrost: rejecting image due to unsupported offset or stride alignment"), and the TV stays black. The decoder's own picture has padded rows. Needs gstreamer1.0-gl, and the unit's drop-in boombox-airplay-screen.conf (group boombox-kiosk for the Wayland socket, /dev/dri, /dev/video*). When no screen is there, the receiver falls back to fakesink.

The remote's Exit/Return reaches the receiver through boombox-cec, which runs as boombox-kiosk and cannot restart the unit: it creates /run/boombox-airplay/disconnect, and the wrapper ends the receiver when it sees it.

In the pages ​

boombox-airplay.service runs boombox_airplay.py, which starts UxPlay with the options the agent wrote to /etc/boombox/airplay.options, reads its output for who is connected, whether the screen is mirrored and whether a song plays, and writes /run/boombox-airplay/state.json for the agent. UxPlay forwards the phone's H.264 as RTP to loopback (-vrtp) and, with the patched build (deploy/uxplay/shared-clock.patch), the sound as well (-artp), both stamped with the phone's own time. boombox_airplay_video.py unpacks both itself and serves them as records on one timeline (picture as it is, sound as AAC) in one endless HTTP response on 127.0.0.1:8098; Caddy forwards /boombox-airplay/ to it. The page (boombox-airplay-mirror, inside the Now playing card) asks the web app for a ticket, decodes the pictures with WebCodecs and draws the newest one on a canvas per screen refresh. On the TV it always fills the window (Back ends the mirroring); elsewhere a button makes it fill the window, and Escape or Back return to the card (Disconnect in Now playing ends the mirroring). Another button plays the phone's sound in that browser (not on the TV, where the speaker plays it): the sound runs on the browser's audio clock and each picture waits for its time on it, which puts the two in step.

A phone sends one keyframe when it starts mirroring and hardly any after, so a page can only start from that keyframe and every picture since. The speaker keeps them (up to 32 MB) and sends a page that joins exactly what the phone sent: no decoding, no encoding. Once they no longer fit, ffmpeg decodes them and encodes them again with a keyframe every second for the pages that join later; that costs about half a core for an upright phone and about 130% of a core for one held sideways (720p), for as long as the screen is mirrored. A keyframe of the phone's own (it was turned) ends that again, unless a page is on it. A browser without WebCodecs gets a motion JPEG, made by one more ffmpeg for each such page.

Good to know ​

  • UxPlay needs 1.72 or newer for -pw, and 1.73 for -md and -vrtp: Debian trixie's 1.71 lacks them, so boombox-airplay-update downloads the build the pipeline made (job uxplay_binary, run it by hand when the version changes).
  • -vs 0 would switch the video off, -vrtp with it; the receiver runs with -vs fakesink while mirroring.
  • Drawing a decoded picture into the canvas costs the TV's browser far more than decoding it (about 25 ms at 720p, 100 ms at 1080p), which is why the size is limited and only the newest picture is drawn.
  • There is no PIN option: current iOS does not pair with UxPlay's PIN. UxPlay 1.73.7 rejects the phone's 20-byte SRP proof (client_proof_len 20 invalid); master (1.74) accepts its size but not the proof (client proof not validated), also with the right PIN. A password works (tested with an iPhone). It is set in the AirPlay settings and never shown again, and the receiver keeps no list of phones.
  • With the TV drawing the picture, the stream is not forwarded: a browser page sees no screen unless Who draws the picture is The pages.
  • The receiver and its stream log to the journal: journalctl -u boombox-airplay.