Giter VIP home page Giter VIP logo

java-airplay-lib's Introduction

java-airplay-lib

build Release ViewCount License




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


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

  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.
  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 with Netty

Links

Analysis of AirPlay2 Technology

Info

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

java-airplay-lib's People

Contributors

serezhka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-airplay-lib's Issues

Will this allow my 2012 macbook Air running Catalina become an Airplay Receiver?

Will this allow my 2012 macbook Air running Catalina become an Airplay Receiver?
If not, could you add that to future capabilities?

I'm trying to use my 2012 Macbook Air to become a second monitor for my 2020 MacBook Pro. (Currently, it works the other way around, but the Air is too slow, and I get lags and disconnects pushing it's video to the Pro)

How to use the audio stream.

I've tried to write aac data locally, and I've tried to convert it to PCM format and write it locally. But it won't play.

How can I start multiple airplay server?

Hello!
Firstly, I really impressed your project and thank you :)
So I want to use it for mirroring some device concurrently.

I tried as below for starting multiple airplay server.
(I use kotlin)

AirplayServer("servername", 5003, 5004, MirrorDataConsummerImplement).start()
AirplayServer("servername2", 5103, 5104, MirrorDataConsummerImplement).start()
AirplayServer("servername3", 5203, 5204, MirrorDataConsummerImplement).start()

But I can see only one server among them on my iPhone or iPad.

Is it related with value of airPlayMDNSProps in AirPlayBonjour.java like deviceid, pk, pi?
How can I start multiple airplay server?

Some questions about mirror connection

Dear developer, I have a question. During the process of image projection, opening the iPhone Video playback software video will interrupt the current projection operation. What is the reason, or do you have relevant information. Thank you very much.

Help

Привет. Подскажите пожалуйста как реализовать клиента который хочет подключиться к серверу и отдавать свой rtsp стрим? Готов заплатить за помощь.
Условно у меня есть девайс на котором запущен стрим. Я хочу законнектить его к appleTV.
Свяжитесь со мной пожалуйста по почте [email protected] или телеграм @vitalyRR . Буду очень признателен на помощь

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.