• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Appendix: IV Appendixes: Quick Reference... > Publish a Camera and Microphone

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 connection
            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");


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint