Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top