I want to create the airplay in android in which my android device will work as a airplay server(receiver)and iPhone device will work as a receiver . I have used jmdns in my application which is open source library in java for the airplay . It is working fine for the audio . But when I come to the video and image then there is lot of struggle for me even with the discovery of the device .Here is my code for the creating and registering the service :
ServiceInfo info = ServiceInfo.create(identifier + "@" + name + "._raop._tcp.local", identifier + "@" + name, port, "tp=UDP sm=false sv=false ek=1 et=0,1 cn=0,1 ch=2 ss=16 sr=44100 pw=false vn=3 txtvers=1");
dns = JmmDNS.Factory.getInstance();
((JmmDNSImpl)dns).inetAddressAdded(new NetworkTopologyEventImpl(JmDNS.create(InetAddress.getByName("localhost")), InetAddress.getByName("localhost")));
try {
Thread.sleep(1000); // If this isn't done the Announcement sometimes doesn't go out on the local interface
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
dns.registerService(info);
when i change that ._raop in the first line to the ._airplay then the device has been discovered for the image and audio in the iPad. When i select the device for playing the video the it show the message "This video is playing android(server name )". But in server side i am not getting any packets to process. I am studied Jmdns lot . But i am not getting how to implement the video and image in the airplay using jmdns . Any ideas ?
You need a streaming server. FFmpeg seems to me an interesting place to start. See the ffserver component.
Here is a nice tutorial on how to wrap it in ffmpeg-java.
来源:https://stackoverflow.com/questions/15128124/implementing-android-as-a-server-receiver-in-airplay