By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

How do i record audio from microphone to my local file system

P: 1
Hi All,


I need to record audio captured from microphone to the local file system .Is it possible? I am trying to use NetConnect() to connect to local file system.
But its throwing error.

I am attaching my code below.


package
{
import flash.display.Sprite;
import flash.events.*;
import flash.media.Microphone;
import flash.system.Security;
import flash.system.SecurityPanel;
import flash.net.*;

public class MicrophoneExample extends Sprite
{
public function MicrophoneExample()
{
var nc:NetConnection = new NetConnection();

var stream:NetStream = new NetStream(nc);

var mic:Microphone = Microphone.getMicrophone();


Security.showSettings(SecurityPanel.MICROPHONE);
mic.setLoopBack(true);

if (mic != null) {
stream.attachAudio(mic);
stream.publish("abc.mp3", "record");

mic.setUseEchoSuppression(true);
mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
mic.addEventListener(StatusEvent.STATUS, statusHandler);
}
}

private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}

private function statusHandler(event:StatusEvent):void {
trace("statusHandler: " + event);
}
}
}


Regards,
Roopal
Dec 17 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.