views:

441

answers:

2

Hello all,

I am building a small flash application to record audio from the client's computer. I wish to be able to use the microphone, store the recorded information in a byte array and then send it onwards. I saw the following piece of code that works fine with the camera:

        var _loc_1:BitmapData;
        var _loc_2:ByteArray;
        _loc_1 = new BitmapData(video.width, video.height, false, 13421772);
        _loc_1.draw(video, new Matrix());

        _loc_2 = PNGEncoder.encode(_loc_1);
        return Base64.encodeByteArray(_loc_2);

In order for this to work with audio I need classes like BitmapData and PNGEncoder that will work with audio and not just images \ video. Do you know of any such classes? Is it even possible?

A: 

I'm afraid that's not possible by using flash alone. You will have to stream the input to a server which then sends the data back. Here's two very short threads discussing it:

http://www.actionscript.org/forums/showthread.php3?t=88653

http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=21974&p=115759

Also, about your code-example, I just want to say that unless you know what you're doing and need to store the data as a string, there's no need of encoding it with Base64, it'll waste both cpu-recourses and space.

Clox
I know that it's possible to cache a byte of arrays based on the image displayed on screen, thereby creating a local cache based on the images captured by the web camera. Are you sure something similar cannot be done with audio ?
vondip
You can access the graphical-output and do anything with that yes, but there's no way of accessing the audio-output in flash, and unfortunately you don't have that kind of control of the microphone either.I was hoping this would have changed with the release of AS3 but it didn't.
Clox
+1  A: 

i am searching for the same type of project. ie. capture audio from microphone from client computer and send to server side application. i have to use integrated flex+java application with eclipse IDE, and BlazeDS.

i am wondering is that only the way to upload media content to server side by Flash Media Server or RED 5 ???

it is not possible by other means -- byteArray method??

Ganesh