- Go 85.9%
- Kotlin 10.2%
- QML 1.5%
- Shell 1.1%
- Roff 1.1%
- Other 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| airplay-core | ||
| android | ||
| ci | ||
| fdroid | ||
| scripts | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| PLAN.md | ||
| README.md | ||
Screen & Sound Cast
An AirPlay sender for Android. It sends the phone's picture and sound to an Apple TV or a Mac, or the sound alone to any AirPlay 2 speaker (Sonos, HomePod). Pick a device, enter the PIN it shows the first time, and it plays; the device and the kind of stream ("Picture + sound" / "Sound only") can be switched at any time. It keeps sending in the background and with the screen off, needs no Google services and has no tracking.
The app follows the system language (English, German). Changes are listed in CHANGELOG.md, the original plan (German) in PLAN.md.
Install
F-Droid (recommended, automatic updates):
- In F-Droid (or Neo Store, Droid-ify): Settings → Repositories → +.
- Address
https://fdroid.umrath.dev/repo, fingerprint732DC12007C2873A07AA5E27DB47667F5A08E392C882E13C46D1480C7727CF19. - Refresh the repositories, search for "Screen & Sound Cast", install.
Obtainium (updates straight from the releases):
- Add App, URL
https://code.umrath.dev/thoralf/Screen-and-Sound-Cast; Obtainium recognises it as a Forgejo (Codeberg) source. - Leave Include prereleases off and tap Add. Obtainium installs
screen-and-sound-cast-v<version>.apkfrom the newest release.
Both ways deliver the same signed APK (certificate SHA-256
E6:EB:59:DD:00:D0:76:40:E4:6C:59:EC:38:80:EF:61:6D:36:C9:40:07:F7:9D:0C:7A:5D:1E:5F:B7:9A:AB:81),
so one can replace the other. Android 10 or newer, 64- or 32-bit ARM.
Use
- Choose what to send at the top: Picture + sound (Apple TV, Mac) or Sound only (every AirPlay 2 device). The list below shows the devices that fit; a speaker cannot take a picture. A Sonos gets the sound through its own interface instead of AirPlay (it stays silent with AirPlay from Android); it buffers that stream, so the sound comes about 6 to 7 s late. In a Sonos group, pick the group's first speaker.
- Tap a device. The first time it shows a PIN, which the app asks for; the pairing is kept, later connections need no PIN. Android asks once for permission to record the screen (also needed for sound) and for the microphone permission (recording what other apps play). Android 14+ lets you share the whole screen or one app; with one app the TV shows black while another app is in front, because Android does not draw apps in the background.
- Switch the device or the mode while sending: the app moves the session without asking again. Stop (or Back, or Stop in the notification) ends everything.
- Landscape video fills the TV: when the phone is turned to a landscape wider than 16:9, the middle 16:9 part is sent (about 10 % is cut off at each side). Upright, the screen is shown whole with bars.
- If another sender takes the device over, the app notices within a few seconds and stops.
- Sound comes only from apps that allow recording their playback; some apps forbid it and stay silent. A device address can also be typed in when it is not found automatically.
On GrapheneOS and other privacy-focused systems no special setup is needed; the app's battery setting just must not be "Restricted".
How it works
| Part | What it does |
|---|---|
airplay-core/ |
The AirPlay protocol in Go: pairing (PIN, transient), FairPlay, encryption, RTSP session set-up, H.264 video, ALAC audio, timing. A subtree of omarroth/doubletake (imported at 5e2f1cb); local changes are marked "Deviation from upstream" in the code and the changelog. |
airplay-core/mobile/ |
The small API the app uses, bound to Java with gomobile bind. |
android/ |
The app (Kotlin, Jetpack Compose), package com.familiewill.airplaysender. |
Inside the app:
ReceiverDiscoveryfinds devices (_airplay._tcpviaNsdManager); the screen-mirroring bit of thefeaturesTXT record tells TVs from speakers.SonosLinksends sound to a Sonos over its UPnP interface (port 1400): the app serves an AAC radio stream (AacEncoder,LiveStreamServer) and tells the speaker to play it.ReceiverSessionruns connect → PIN → pair → stream, without Android dependencies and tested against a fake;ReceiverLinkwraps the Go core.StreamController, one per process, owns the connection and the screen capture, so sending survives the activity (app swiped away, screen off).CaptureServiceis the foreground service of typemediaProjection; while it runs it holds a wake lock and a low-latency Wi-Fi lock.ScreenCapturekeeps the user's consent and one virtual display across sessions;ScreenStreamerencodes it withMediaCodec(H.264, 1080p30, 6 Mbit/s) throughCropRenderer(OpenGL, the 16:9 crop that follows rotation).PlaybackAudiorecords other apps' sound withAudioPlaybackCapture;CaptureClockgives it steady timestamps.- Pairing identities are stored per device, AES-GCM encrypted with a key in the Android Keystore, and excluded from backups.
Core API in short (airplay-core/mobile): Connect(host, port, timeout) →
Receiver; ShowPIN() and Pair(code), or Resume(credentials);
StartMirror(fps, kbps, audio, listener) or StartAudio(listener) → Mirror
with PushVideo(annexB, age), PushAudio(pcm, age) (stereo S16LE 44.1 kHz)
and Stop(). One connection carries one session; OnMirrorStopped tells
when and why it ended.
Build
Requirements: Go ≥ 1.26, JDK 21, an Android SDK with platforms;android-37.0,
build-tools;36.0.0 and NDK 28.2 (ANDROID_HOME set).
cd airplay-core && TMPDIR=/tmp go test ./... # core tests (TMPDIR for macOS)
scripts/build-aar.sh # core as build/airplay.aar
cd android && ./gradlew :app:testDebugUnitTest :app:lintDebug :app:assembleDebug
scripts/build-aar.sh runs the core tests, then gomobile bind for arm64,
arm and x86_64 (emulators) at API 29. The build downloads no SDK packages
(android.builder.sdkDownload=false).
airplay-core/cmd/mobile-probe runs the app's flow from a computer against a
real device (pairing, picture from an H.264 file, -pcm sound, -audio-only
for speakers); scripts/probe-media.sh makes test media.
CI and releases
Forgejo Actions; every step is a script in scripts/ci/.
.forgejo/workflows/apk.yml: every push tomainbuilds, tests, signs and publishes a prerelease on the internal instance. It is the dev app (com.familiewill.airplaysender.dev, "Cast (dev)", Gradle-PdevBuild), which installs next to the release..forgejo/workflows/release.yml(stage 1, by hand): builds, tests, signs and publishes releasev<version>on the internal instance. That APK is the one to test..forgejo/workflows/promote.yml(stage 2, by hand, the release decision): never rebuilds. It publishes exactly the stage-1 APK, with a source snapshot, on code.umrath.dev (compared byte by byte) and in the F-Droid repository, which it shares with Phandroid (see fdroid/README.md). Release notes come from the changelog section of the version.- The runner image is
ci/Dockerfile. Gradle and Go build unsigned; only the signing steps see the keys.
Updating the core
git subtree pull --prefix=airplay-core https://github.com/omarroth/doubletake main --squash
Keep local changes to the core small and marked, so that merges stay easy.
License
The app is licensed under GPL-3.0-or-later (LICENSE).
airplay-core/ is LGPL-3.0-or-later (airplay-core/LICENSE,
airplay-core/COPYING.GPL); changes to it are under the same license.
The Go modules built in are under MIT or BSD licenses, the Android libraries
under Apache-2.0. The app shows all license texts under About and
licenses; scripts/third-party-notices.sh writes them to
android/app/src/main/res/raw/notices.txt and has to run again when a
dependency changes.