GitPedia

Java airplay lib

This library is intended to easily create AirPlay2 servers acting like Apple TV

From serezhka·Updated March 30, 2026·View on GitHub·

This library is intended to easily create AirPlay2 servers acting like Apple TV. Tested with iPhone X (iOS 14.0.1) The project is written primarily in Java, distributed under the MIT License license, first published in 2020. Key topics include: airplay, airplay-receiver, airplay-server, airplay2, airplaymirror.

Latest release: 1.0.5java-airplay-lib:1.0.5
June 9, 2022View Changelog →

java-airplay-lib

build
Release
ViewCount
License

<br><br><br> 14.12.2022: Check out new java-airplay project: https://github.com/serezhka/java-airplay <br><br><br>

This library is intended to easily create AirPlay2 servers acting like Apple TV. Tested with iPhone X (iOS 14.0.1)

How to use?

  • Add java-airplay-lib dependency to your project

  • Make your server discoverable by Bonjour

java
String serverName = "@srzhka"; int airPlayPort = 5001; int airTunesPort = 7001; AirPlayBonjour airPlayBonjour = new AirPlayBonjour(serverName); airPlayBonjour.start(airPlayPort, airTunesPort); ... airPlayBonjour.stop();
<img src="https://github.com/serezhka/java-airplay-lib/blob/media/bonjour.jpg" width="256" height="256">
  • Listen airTunesPort and handle RTSP requests. Pass request content bytes to the library and respond with provided content bytes.
java
RTSP GET | POST String uri = ... byte[] requestContent = ... switch (uri) { case "/info": { airPlay.info(.. byte output stream ..); // RTSP OK + provided bytes } case "/pair-setup": { airPlay.pairSetup(.. byte output stream ..); // RTSP OK + provided bytes } case "/pair-verify": { airPlay.pairVerify(.. requestContent input stream .., .. byte output stream ..); // RTSP OK + provided bytes } case "/fp-setup": { airPlay.fairPlaySetup(.. requestContent input stream .., .. byte output stream ..); // RTSP OK + provided bytes } case "/feedback": { // RTSP OK } } RTSP SETUP airPlay.rtspSetup(.. requestContent input stream .., .. byte output stream .., int videoDataPort, int videoEventPort, int videoTimingPort, int audioDataPort, int audioControlPort); // RTSP OK + provided bytes if (airPlay.isFairPlayVideoDecryptorReady()) { // start listening video data on videoDataPort } if (airPlay.isFairPlayAudioDecryptorReady()) { // start listening audio data on audioDataPort } RTSP GET_PARAMETER, RECORD, SET_PARAMETER, TEARDOWN ... DECRYPT MIRROR DATA airPlay.decryptVideo(byte[] video); airPlay.decryptAudio(byte[] audio, int audioLength);

<img src="https://github.com/serezhka/java-airplay-lib/blob/media/paired_1.jpg" width="256" height="256"><img src="https://github.com/serezhka/java-airplay-lib/blob/media/paired_2.jpg" height="256">

Example server

java-airplay-server with Netty

<img src="https://github.com/serezhka/java-airplay-server-examples/blob/media/gstreamer_playback.gif" width="600">

Analysis of AirPlay2 Technology

Info

Inspired by many other open source projects analyzing AirPlay2 protocol. Special thanks to OmgHax.c's author 🤯

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from serezhka/java-airplay-lib via the GitHub API.Last fetched: 6/29/2026