07-22-2010 04:39 AM
Can anyone tell me how I should play a recorded audio? I am recording it in the default AMR format. The data is stored in a byte array. Now i want to play this data once the recording is finished. Please can someone give me a sample code of how this could be done.
My code is,
player = Manager.createPlayer("capture://audio");
rcControl = (RecordControl) player.getControl("RecordControl");
output = new ByteArrayOutputStream();
Once I hit the stop button, it does the following:
data = outout.toByteArray();
Now, When i hit the play button,
player = Manager.createPlayer(new String(data)); Note: data is a byte array
But when I hit the play button, the player doesnt play this data. Can someone please help me with this. I am really stuck with this. Can someone give me a code for playing this recorded audio? Thanks.
Solved! Go to Solution.
07-22-2010 05:59 AM
I didn't try this but I think it goes something like this:
(data is byte)
ByteArrayInputStream bi = new ByteArrayInputStream(data );
player = Manager.createPlayer(bi, "audio/amr");
02-22-2012 06:07 AM
I'm also trying to achieve something like this.
Only difference is i want to save the recording to a file.
Please tell me what i write on click event of 'Stop & Save' button.
Thanks in adavance.