Next Page

Page: 1

Previous Page

Thread: ns:NetStream - for audio

Created on: 03/10/10 11:13 PM

Replies: 1

aman





Joined: 03/10/10

Posts: 2

ns:NetStream - for audio
03/10/10 11:13 PM

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;
};
=============

aman

Link | Top | Bottom

hibiscus





Joined: 11/10/08

Posts: 6

RE: ns:NetStream - for audio
03/12/10 1:33 PM

Adobe's documentation says that the error means this:

The client tried to record a stream that is still playing, or the client tried to record (overwrite) a stream that already exists on the server with read-only status.

Have you deleted the existing flv file before trying to record? Are you sure that you have write access rights to the file/directory that you're trying to create? What about trying to publish with "append" to see if that correctly adds to the file.

Link | Top | Bottom

New Post

Please login to post a response.