4

I'm looking for a flash widget that allows users to record their audio and then send it to the server.

There are a few similar questions:

Record Audio and Upload as Wav or MP3 to server

They advocate using Red5 or flash media server.

Shouldn't it be possible to record locally on the user's client using the codecs that the user already has and then upload the resulting file to the server, rather than say, process the and record the stream on the server itself.

Thanks.

Community
  • 1
  • 1
Mark
  • 32,293
  • 33
  • 107
  • 137
  • My last research from a year ago resulted in it not being possible. Interested to see whether anything comes up – Pekka Nov 26 '10 at 20:09

2 Answers2

3

According to the the Capturing Sound Input Article if you are running Flash Player 10.1 you can save the microphone data to a ByteArray. The Capturing microphone sound data section gives the following example on how to do it:

var mic:Microphone = Microphone.getMicrophone(); 
mic.setSilenceLevel(0, DELAY_LENGTH); 
mic.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler); 

function micSampleDataHandler(event:SampleDataEvent):void { 
  while(event.data.bytesAvailable) { 
    var sample:Number = event.data.readFloat(); 
    soundBytes.writeFloat(sample); 
  } 
}

Once you have the ByteArray you can of course do whatever you want with it.

martineno
  • 2,623
  • 17
  • 14
  • Great to hear, can you give more information on what we do with this data? Thanks. – Mark Nov 26 '10 at 21:12
  • Your original post mentioned that you want to process th data on the client and then upload to the server. Is that what you want do? What kind of processing were you thinking off? – martineno Nov 26 '10 at 22:50
  • just save it to some kind of format that allows me to play it back. – Mark Nov 26 '10 at 23:27
  • @Mark if you follow the link in the answer that I gave there is also some sample code to play the samples stored in the `ByteArray` back to the user. You don't need to do any processing on the samples stored in the `ByteArray` itself, just keep a reference to it in your program. – martineno Nov 26 '10 at 23:31
1

Once you have the ByteArray you can pass it in with NetStream.appendBytes()

epascarello
  • 204,599
  • 20
  • 195
  • 236
tubbo
  • 598
  • 10
  • 21