Streaming audio from Android to desktop application -
what title says really. need stream audio microphone on telephone , play in desktop application (also java code) on computer.
using udp or tcp not matter me, whatever works best. phone , computer on same nat anyway transmission work fine.
i have fair idea of how send stream data device using code:
mediarecorder recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.mpeg_4); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); string host = "10.0.2.2"; int port = 5740; socket socket = null; try { socket = new socket(inetaddress.getbyname(host), port); parcelfiledescriptor pfd = parcelfiledescriptor.fromsocket(socket); recorder.setoutputfile(pfd.getfiledescriptor()); recorder.prepare(); recorder.start(); log.d(tag, "sending audio 20 seconds.."); thread.sleep(20000); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); }
the problem is, how play stream in java application on pc? or there better way stream sound?
i have mined internet information on without results surely must have accomplished before?
thanks in advance kind of help!
i have done close have been trying do. using gstreamer on server listening udp port. there relay server written in java nothing more loopback socket. there 1 server port waits mobile client connections, upon receiving data, dumps them using datagrampackets (java class udp packets) gstreamer's udp port. catch find proper decoder gstreamer pipeline.
Comments
Post a Comment