Publish a Camera and Microphone

Listing E.3 publishes your camera and microphone to a NetConnection. The connection script uses the UI components technique from Listings E.1 and E.2.

Listing E.3 Flash ActionScript for Publishing a Camera and Microphone
nc = new NetConnection();
nc.onStatus = function(info) {
      trace("LEVEL: "+info.level+"  CODE: "+info.code);
      if (info.code == "NetConnection.Connect.Success") {
            // Call a function to setup the NetStream Publish when the server accepts the 
graphics/ccc.gifconnection
            startStreamPublish();
      }
};
startStreamPublish = function () {
      // attach the Camera feed to an Embedded Video Object named, "my_video"
      // that exists on the Flash Stage.
      my_video.attachVideo(Camera.get());
      // attach a NetStream to the variable, publish_ns
      publish_ns = new NetStream(nc);
      // attach the Microphone and Camera to the publish_ns stream
      publish_ns.attachAudio(Microphone.get());
      publish_ns.attachVideo(Camera.get());
      // start publishing the combined camera and microphone feed
      publish_ns.publish("myStream");
};

nc.connect("rtmp://myApplication/myInstance", "Tracey Legault-Davis", "Bert");

The SSAS ActionScript template in Listing E.2 can be used with this ActionScript.



    Part I: 10 Quick Steps for Getting Started
     
    ASPTreeView.com
     
    Evaluation has ЗЦЪexpired.
    Info...