RE: NetStream.Record.NoAccess
03/10/10 11:10 PM
I'm very new in FMS
I'm facing problem in recording audio save file. It is created only 1KB flv file.
Can anyone pls suggest me where i'm wrong or why it is happened.
=====================
stop();
recordBtn_mc._visible = true;
stopBtn_mc._visible = true;
playBtn_mc._visible = false;
saveBtn_mc._visible = false;
restartBtn_mc._visible = false;
var count:Number = 0;
var timestamp:Date = new Date();
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://localhost/dvr/");
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(2);
var mic:Microphone = Microphone.get();
mic.setRate(22);
ns.attachAudio(mic);
var currentMedia:String = myMedia.mediaType;
var fileName:String = "";
ns.onStatus = function($info:Object):Void
{
trace($info.code);
};
// record the audio to the stream
function recordAudio():Void
{
fileName = String(timestamp.getTime() + (count++));
ns.publish("files/" + 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(fileName);
}
// Save the file that was recorded
function saveRecordedAudio():Void
{
ns.save(fileName);
}
function newRecordAudio():Void
{
ns.publish("files/" + fileName, "record");
}
// stopBtn_mc.onPress = function () {
// recordBtn_mc._visible = false;
//stopBtn_mc._visible = false;
//playBtn_mc._visible = true;
//saveBtn_mc._visible = true;
//restartBtn_mc._visible = true;
//};
// restartBtn_mc.onPress = function () {
// recordBtn_mc._visible = true;
//stopBtn_mc._visible = true;
//playBtn_mc._visible = false;
//saveBtn_mc._visible = false;
//restartBtn_mc._visible = false;
//};
// record button
recordBtn_mc.onRelease = function():Void
{
recordAudio();
};
// stop button
stopBtn_mc.onRelease = function():Void
{
stopRecordingAudio();
recordBtn_mc._visible = false;
stopBtn_mc._visible = false;
playBtn_mc._visible = true;
saveBtn_mc._visible = true;
restartBtn_mc._visible = true;
};
// play button
playBtn_mc.onRelease = function():Void
{
playRecordedAudio();
};
// Save button
saveBtn_mc.onRelease = function():Void
{
getURL("javascript:launchwin('" + fileName + "')");
};
// re-record button
restartBtn_mc.onRelease = function():Void
{
ns.removeAll()
ns.publish(false);
gotondplay
recordBtn_mc._visible = true;
stopBtn_mc._visible = true;
playBtn_mc._visible = false;
saveBtn_mc._visible = false;
restartBtn_mc._visible = false;
};
=============