views:

1355

answers:

3

There was a question on how to get data from a microphone on a client to a server via an HTTP browser, and the answer was "use flash or maybe a java servlet applet". Fine, but how? Is there any sample code or tutorial out there? Can it be done with a vanilla server or do I need adobe media server?

A: 

You will need to use flash media server. You can download it from adobe.com. It is free for 10 concurrent uses. You will find a tutorial at http://www.flashcomguru.com/tutorials/ and you can use www.influxis.com to host your app.

Alec Smart
This doesn't tell me how, and I really want to use Apache in conjunction with another application. any better info out there?
Aaron Watters
also the tutorials you point to make no mention of the microphone input device as far as I can tell, which one is about capturing sound from the client?
Aaron Watters
When you download and install FMS, they have a sample application that lets you record audio as well as video.
Alec Smart
+2  A: 

I believe that the answer was really "use flash or maybe a java applet" and not a "java servlet". For your problem you must implement two things:

  • A client application running in the user's browser that captures audio and then connects to a remote server to upload files.
  • A web application that accepts the uploaded files.

The client application must be implemented in a browser's plug-in technology, as it is impossible to record audio from the browser directly. This could be done with flash or a Java Applet. These aren't the only options, but they are the most common ones.

See this link for ActionScript code that access the microphone. The blogspot also interestingly describes what are your options with Silverlight.

For Java, this is a tutorial for audio recording. You would need to create an applet, which isn't very hard. A tricky issue is that you'd probably need to "sign" your applet in order to be able to access the microphone at the user's machine.

For the server side you can use any server technology and adobe media server is by no means required. Examples are PHP, Java (Tomcat), ASP.NET. The file uploading part you could even do it with just an Apache Web Server. All you need is to configure it to allow file uploads.

Update:

I agree with your comment that flash will be the best solution. You can find many examples in the net for accessing the microphone with ActionScript. This is what I have quickly found:

kgiannakakis
Nice links. Some problems:I can't get the java tutorial code to generate a sound file on my Mac -- something to do with bad parameters. If java has no way to figure out the parameters for the input device automatically then it's of no use to me because I want this to run on an arbitrary client. Also, I'm really not interested in restricting the platform to SilverLight. Apart from that this is a pretty good starting point (and I guess Flash is the best bet). Does anyone have anything even better?
Aaron Watters
A: 

I recently posted an answer on a similar question which may apply here.

As far as I can tell, it may be possible with Flash 10 and the new access to the byte streams of the sound objects, but no one has done it yet. I'm not a Flash programmer myself, but I'd be willing to help out with the server component if you or anyone else would like to give a shot at cracking this nut.

Barnabas Kendall