android - Audio file transfer over websocket -
I have a wav file created in an android mobile and I want to send this file to the web socket on the server. The code below is used to send the file stream I am using autobahn lib for web socket connection.
byte [] buffer = new byte [1024]; FileInputStream fis = New FileInputStream (myFile); Log D. (Tag, "Sending ..."); Boolean status = true; While (position) {int in = fis.read (buffer, 0, buffer.label); If (in! = -1) {if (in & lt; buffer length) {byte [] temp = new byte [in]; For (int i = 0; i
.wav audio file running fine in mobile But the file received in the server side is not a proper watch audio file and it is not playing.
Server code:
(Byte [] data, Boolean Arg1) on public Zero Message {try {System.out.println ("Starting a new recording.") ; FileOutputStream fOut = New FileOutputStream (f1, true); FOut.write (data); FOut.close (); } Hold (exception e) {e.printStackTrace (); }}
Please help .........
Comments
Post a Comment