microphone sound recording,saving,playing flv file is saved but not working
Please help me,
While recording the flv is saved inside applications/stream/samples/audio.flv. But it is not working properly.
Mycode
stop();
var count:Number = 0;
var timestamp:Date = new Date();
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://localhost/audiotest/samples");
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(2);
var mic:Microphone = Microphone.get();
mic.setRate(22);
ns.attachAudio(mic);
ns.onStatus = function($info:Object):Void
{
trace($info.code);
};
// record the audio to the stream
function recordAudio():Void
{
var fileName:String = String(timestamp.getTime() + (count++));
ns.publish(fileName, "record");
}
// stop the recording of audio to the stream
function stopRecordingAudio():Void
{
ns.publish(false);
}
// plays back the audio that was recorded
function playRecordedAudio():Void
{
ns.play(currentFileName);
}
// record button
recordBtn_mc.onRelease = function():Void
{
recordAudio();
};
// stop button
stopBtn_mc.onRelease = function():Void
{
stopRecordingAudio();
};
// play button
playBtn_mc.onRelease = function():Void
{
playRecordedAudio();
};
