Skip to main content
Participant
January 25, 2007
Question

Recording a Flash Video from Webcam

  • January 25, 2007
  • 2 replies
  • 678 views
Hello All,

I am currently working on a project which requires to record a video stream from a WebCam. The work is pretty similar to www.flixn.com. I am able to capture the video from the Webcam but is unable to record it . Can anyone help me to get this done.

Thanks in advance.

Regards,
simanta-int
    This topic has been closed for replies.

    2 replies

    Participating Frequently
    January 26, 2007
    hi, if you try :

    var nc:NetConnection();
    nc.connect("rtmp://myserver/myapp/");
    var ns:NetStream= new NetStream(nc);
    var c:Camera= Camera.get();
    ns.attachVideo(c);
    ns.publish("myvideo","record");

    doesn't work?
    January 25, 2007
    Not really enough to go on there. Can you post the code you're having trouble with or explain the problem in a little more detail?
    Participant
    January 29, 2007
    Basically,my purpose is to record the video from the webcam by clicking on the "Record" button and stop recording the video when I clicks on "Stop" button. Then on clicking the "preview" button it will play the recorded video.

    Can I achieve the above job without using rtmp? I am new to FMS and I am not getting any clue to solve this problem. Please, help me where I am making the mistake in my below code.

    // Capturing the Web Camera & Video
    var my_cam:Camera = Camera.get();
    myVideo.attachVideo(my_cam);

    //Streaming and Recording the video
    var rtmpNow:String = "rtmp:/localhost";
    var nc:NetConnection = new NetConnection();
    var ns:NetStream = new NetStream(nc);
    nc.onStatus = function(info) {
    if (info.code == "NetConnection.Connect.Success") {
    status_txt = "Connected";
    } else {
    status_txt = "No Connection";
    }
    };
    nc.connect(rtmpNow);


    function record() {
    if (record_btn.label == "Record") {
    record_btn.label = "Recording";
    ns.attachVideo(my_cam);
    ns.publish("simanta", "record");
    trace("record video");
    } else {
    ns.close();
    record_btn.label = "Record";
    }
    }

    function stoprecord() {
    if (stop_btn.label == "Stop") {
    stop_btn.label = "Stop";
    record_btn.label = "Record";
    ns.attachVideo(my_cam);
    ns.publish(false);
    trace("stop recording");
    } else {
    ns.close();
    record_btn.label = "Recording";
    }
    }

    record_btn.onRelease = function() {
    record();
    trace("gsjfjhf");
    };

    stop_btn.onRelease = function() {
    stoprecord();
    trace("qwqwqw");
    };
    Participating Frequently
    January 29, 2007
    hi

    var rtmpNow:String = "rtmp:/localhost";

    you must create a directory in the flash media server applications directory .

    ex: applications/videoTest/

    after clientside
    var rtmpNow:String = "rtmp:/localhost/videoTest/";