Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serezhka/java-airplay-lib
This library is intended to easily create AirPlay2 servers acting like Apple TV
https://github.com/serezhka/java-airplay-lib
airplay airplay-receiver airplay-server airplay2 airplaymirror appletv mirroring
Last synced: 26 days ago
JSON representation
This library is intended to easily create AirPlay2 servers acting like Apple TV
- Host: GitHub
- URL: https://github.com/serezhka/java-airplay-lib
- Owner: serezhka
- License: mit
- Created: 2020-01-15T13:28:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T12:14:34.000Z (about 2 years ago)
- Last Synced: 2024-08-07T23:49:52.053Z (5 months ago)
- Topics: airplay, airplay-receiver, airplay-server, airplay2, airplaymirror, appletv, mirroring
- Language: Java
- Homepage:
- Size: 928 KB
- Stars: 182
- Watchers: 21
- Forks: 38
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# java-airplay-lib
[![build](https://github.com/serezhka/java-airplay-lib/actions/workflows/build.yaml/badge.svg)](https://github.com/serezhka/java-airplay-lib/actions/workflows/build.yaml)
[![Release](https://jitpack.io/v/serezhka/java-airplay-lib.svg)](https://jitpack.io/#serezhka/java-airplay-lib)
![ViewCount](https://views.whatilearened.today/views/github/serezhka/java-airplay-lib.svg)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)####
14.12.2022: Check out new java-airplay project: https://github.com/serezhka/java-airplayThis 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](https://jitpack.io/#serezhka/java-airplay-lib) to your project
* Make your server discoverable by [Bonjour](https://ru.wikipedia.org/wiki/Bonjour)
```java
String serverName = "@srzhka";
int airPlayPort = 5001;
int airTunesPort = 7001;
AirPlayBonjour airPlayBonjour = new AirPlayBonjour(serverName);
airPlayBonjour.start(airPlayPort, airTunesPort);
...
airPlayBonjour.stop();
```* 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);
```## Example server
[java-airplay-server](https://github.com/serezhka/java-airplay-server) with Netty
## Links
[Analysis of AirPlay2 Technology](http://www.programmersought.com/article/2084789418/)
## Info
Inspired by many other open source projects analyzing AirPlay2 protocol. Special thanks to OmgHax.c's author 🤯