Skip to main content
Participant
May 12, 2009
Question

Live Webcam and Netstream.publish HELP!

  • May 12, 2009
  • 2 replies
  • 2431 views

Hello! Im new to the forums. Im working on a project for work and im using FMS 3 and AS3. I've gotten to a point where google cant help me anymore. When I get my webcamera with flash and allow the camera to be used it then opens a netstream to the FMS server, which for some reason doesnt work all the way. I can see the new stream being published but i just stops and you cant view it. Here is my code.

var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://my_fms_server_ip/live/livestream");

var camera ;
var video ;

function onCameraStatus( evt ):void {
    if (evt.code == "Camera.Muted"){
        trace("Camera Access Has Been Denied!") ;
        }
    if (evt.code == "Camera.Unmuted"){
        trace("Camera Access Has Been Granted") ;
        }
    }

camera = Camera.getCamera() ;
camera.addEventListener(StatusEvent.STATUS, onCameraStatus) ;
if (camera == null)
   {
       Security.showSettings(SecurityPanel.CAMERA) ;
   }else{
video = new Video(camera.width, camera.height) ;
video.attachCamera(camera) ;
addChild(video) ;
}

var my_ns:NetStream = new NetStream(my_nc);
my_ns.attachCamera(camera);
my_ns.publish("cwysong");

Please Help!

    This topic has been closed for replies.

    2 replies

    wysong85Author
    Participant
    May 29, 2009

    I got everything working.. here is my code. FYI this is done in Actionscript 2.0 and im passing variables from PHP to actionscript using FlashVars.

         var nc:NetConnection = new NetConnection();

         nc.connect("rtmp://My.Server.IP/live/"+ confid);

         var ns:NetStream = new NetStream(nc);

    mycam = Camera.get();

         mymic = Microphone.get();

         myvid.attachVideo(mycam);

         mycam.setQuality(84500,0);

         mymic.setRate(11);

         ns.attachAudio(mymic);

         ns.attachVideo(mycam);

    ns.publish(+ uname);

    there ya go!

    Inspiring
    May 12, 2009

    you prob. need to speficy the type of publish?

    my_ns.publish("cwysong", "live"); or

    my_ns.publish("cwysong", "record");