Hi, I`m trying to capture video from the webcam and record it on the FMS folder (localhost/vod), but in the nc.connect below, my code won`t connect. I don`t know what I`m doing wrong. Plese tell me what could be or where I should start looking.
Thanks.
Code:import flash.net.NetStream; var RTMP:String = "rtmp://localhost/vod"; var nTimer:Number; var cam:Camera = Camera.getCamera(); //oVideo1 is a linked video in the stage. oVideo1.attachCamera(cam); mcRecordInfo.visible = false; //mcRecordInfo is a message that the app is recording record_mc.buttonMode = true; //record_mc is the button 'record' 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; }




Reply With Quote