Question
Preoblem with live streaming
Hi,
Now I am trying to develop a web cam capturing movie. I created two swf's, one for broadcasting and the other for receiving. The broadcaster captures the live video from web cam. After connecting the receiver with media server, it ll displays the video capturing by broadcaster. When i am doing this in the system where media server is installed, its working fine. That means broadcaster swf and receiver swf are placed in the system where media server is running But when i tried it by opening the broadcaster swf form system where media server is running and receiver swf from any other system, its not working. The code that i used for broadcaster is attached following:
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 = 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"){
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();
}
}
The script that i used for receiver is following:
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 have already wasted 3 days because of this issue. So please help me. I am the only one in my office for flash scripting. And i am bginner having 4 months experience. Thats why i joined here. So plz help me.
Now I am trying to develop a web cam capturing movie. I created two swf's, one for broadcasting and the other for receiving. The broadcaster captures the live video from web cam. After connecting the receiver with media server, it ll displays the video capturing by broadcaster. When i am doing this in the system where media server is installed, its working fine. That means broadcaster swf and receiver swf are placed in the system where media server is running But when i tried it by opening the broadcaster swf form system where media server is running and receiver swf from any other system, its not working. The code that i used for broadcaster is attached following:
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 = 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"){
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();
}
}
The script that i used for receiver is following:
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 have already wasted 3 days because of this issue. So please help me. I am the only one in my office for flash scripting. And i am bginner having 4 months experience. Thats why i joined here. So plz help me.
