Ask a Question related to Macromedia Flash Flashcom, Design and Development.
-
Eugene Cool #1
Switching Cameras
Hello Im trying to do a lil something that gets the available cameras in a
broadcasting computer and puts em in a combo box. When the broadcaste changes
the combo box selection, the reciever should seamlessly stop seeing the first
cam and start with the new one.
I used an adobe script to start, currently if I were to switch camera Id have
to stop broadcasting(button), stop connection(button), select the camera and
press the connect button and the broadcast button again.
I tried to ad the code in the buttons so that when the broadcaster chooses
from the comboBox the connection/unbroadcasting and reconnection/broadcasting
is done automatically. When I do this, the receivers video stops but does not
update to the new video.
HERE IS THE CODE FOR THE BROADCASTER:
startstop_pb.enabled = false;
connect_pb.onRelease = function(){
if(this.label == "Connect"){
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
} else {
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
}
}
nc = new NetConnection();
nc.onStatus = function(info) {
status_txt.text += "NC.onStatus> info.code: " + info.code + newline;
if (info.code == "NetConnection.Connect.Success") {
status_txt.text += "Connected to " + this.uri + newline;
startstop_pb.enabled = true;
createNetStream(this);
}
}
createNetStream = function(nc){
ns = new NetStream(nc);
ns.onStatus = function(info) {
status_txt.text += "NS.onStatus> info.code: " + info.code + newline;
}
mycam = null;
mymic = null;
mycam = Camera.get(cameras_cb.selectedIndex);
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"){
status_txt.text += "Starting broadcast" + newline;
this.label = "Stop Broadcast";
ns.publish(streamname_txt.text, "live");
} else {
status_txt.text += "Stopping broadcast" + newline;
this.label = "Start Broadcast";
myvid.attachVideo(null);
myvid.clear();
ns.close();
}
}
var mycam:Camera = Camera.get();
var myvid:Video;
myvid.attachVideo(mycam);
var camera_lbl:mx.controls.Label;
var cameras_cb:mx.controls.ComboBox;
camera_lbl.text = mycam.name;
cameras_cb.dataProvider = Camera.names;
function changeCamera():Void {
camera_lbl.text = mycam.name;
//stopping broadcast
status_txt.text += "Stopping broadcast" + newline;
this.label = "Start Broadcast";
myvid.attachVideo(null);
myvid.clear();
ns.close();
//disconnecting
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
//reconnecting
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
do{status_txt.text += "connecting" + newline;}
while(info.code == "NetConnection.Connect.Success");
//starting broadcast
status_txt.text += "Starting broadcast" + newline;
this.label = "Stop Broadcast";
ns.publish(streamname_txt.text, "live");
}
cameras_cb.addEventListener("change", changeCamera);
camera_lbl.setStyle("fontSize", 9);
cameras_cb.setStyle("fontSize", 9);
AND THE CODE FOR THE RECEIVER:
startstop_pb.enabled = false;
connect_pb.onRelease = function(){
if(this.label == "Connect"){
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
} else {
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
}
}
nc = new NetConnection();
nc.onStatus = function(info) {
status_txt.text += "NC.onStatus> info.code: " + info.code + newline;
if (info.code == "NetConnection.Connect.Success") {
status_txt.text = "Connected to " + this.uri + newline;
startstop_pb.enabled = true;
createNetStream(this);
}
}
createNetStream = function(nc){
ns = new NetStream(nc);
ns.onStatus = function(info) {
status_txt.text += "NS.onStatus> info.code: " + info.code + newline;
}
myvid.attachVideo(ns);
ns.play(streamname_txt.text, -1)
}
I read somewhere about a reset function. Please help me out here I will
appreciate it a lot :)
Eugene Cool Guest
-
IP Cameras
Hi, I'm looking to build an app for viewing motion JPEG (MJPEG) streams directly from IP/Network cameras. Does anyone know where I can find... -
Cameras Question
Hello! I am envolved on a surveillance system with flash media server. Is it posible to get multiple cameras (in this case webcams) in flash... -
switching between multiple cameras
"kelly jones" webforumsuser@macromedia.com wrote: Hhi. Try setting the sprite().camera property of the 3D scene. I think I have a demo of that... -
The New 5 MP Cameras
Question.... What is the problem with the 5400??? "David J. Littleboy" <davidjl@gol.com> wrote in message news:bdt6h7$jg2$1@nnrp.gol.com... that -
WTD: Cameras
Hi there, Looking for any: Vintage Medium format camera that takes 120roll 6x6 Twin Lens Reflex Polaroid(110a/110b/150/160/800/pathfinder)...



Reply With Quote

