Basically, this is the actionscript I have for the "Broadcaster" application:
/* first create a new instance of the LoadVars object */
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("hs.php");
startstop_pb.enabled = false;
connect_pb.onRelease = function(){
if(this.label == "Connect"){
this.label = "Disconnect";
nc.connect("rtmp:/livecast");
} else {
this.label = "Connect";
nc.close();
}
}
nc = new NetConnection();
nc.onStatus = function(info) {
startstop_pb.enabled = true;
createNetStream(this);
}
createNetStream = function(nc){
ns = new NetStream(nc);
mycam = Camera.get();
mycam.setQuality(25600, 0);
mymic = Microphone.get();
mymic.setRate(11);
ns.attachVideo(mycam);
ns.attachAudio(mymic);
myvid.attachVideo(mycam);
}
startstop_pb.onRelease = function(){
if (this.label == "Start Broadcast"){
this.label = "Stop Broadcast";
ns.publish(myVars.hs, "live");
} else {
this.label = "Start Broadcast";
myvid.attachVideo(null);
myvid.clear();
ns.close();
}
}
---- On the other side, a "Receiver" application displays the stream that has
been published.
How do I display the number of viewers, or the number of "receivers"
subscribed to the published stream?
(example:
http://www.ustream.tv - they use FMS2).