views:

7

answers:

0

Hi, Im trying to save whats being captured by the webcam in the Flash Media Server installed in my machine, but the netConnection object fails at connection. Can you tell me what Im doing wrong or where should I start looking? How do I know If my FMS server is allright?

    var RTMP:String = "rtmp://localhost/vod/legend";
var nTimer:Number;

var cam:Camera = Camera.getCamera();
oVideo1.attachCamera(cam);

mcRecordInfo.visible = false;
record_mc.buttonMode = true;
record_mc.addEventListener(MouseEvent.CLICK,record);

var nc:NetConnection = new NetConnection();
nc.connect(RTMP);
if (nc.connected == true)
{
    trace("Connected");
}
else
{
    trace("Didn't connected");
}
var ns:NetStream = new NetStream(nc);

function record(e:MouseEvent):void
{
    mcRecordInfo.visible = true;
    ns.attachCamera(cam);
    ns.publish("demo.flv", "record");
    nTimer = setInterval(stopRecording,10000);
}

function stopRecording():void
{
    ns.close();
    clearInterval(nTimer);
    mcRecordInfo.visible = false;
}

Thank you very much.