Skip to main content
Inspiring
March 6, 2009
Question

Preoblem with live streaming

  • March 6, 2009
  • 1 reply
  • 1067 views
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.

    This topic has been closed for replies.

    1 reply

    March 6, 2009
    What URL are you passing to the NetConnection.connect() call in the Receiver?

    Beyond that, is it just this app that you can't connect to, or is it all apps? Can you put the sample video player on the "other system" and connect to the vod app? (You can also create a simple test Receiver using the FLVPlayback component.)

    If you can connect to the vod app, then use the simple test Receiver to connect to your app.

    SreelashAuthor
    Inspiring
    March 9, 2009
    Hi,
    I am not able to connect any applications.For example, i just tried with other application provided by adobe(Hello Server), in which if the connection is established with flash media server that i am running locally, i had written a code in the server side to display a text in the client side.But its working in my system. I tried this application as i did with web cam capturing application on different system.Thus it was not working. Is there any problem in the source code I had written.Did u refer it.I wasted many days for this problem.So please help me.I want to fix this problem as soon as possible.
    Thanks and Regards,
    Sreelash.S.
    Participating Frequently
    March 11, 2009
    As asked in previous reply, what are you using as NetConnection URI so in terms of your code what is rtmp_txt.text set to . If its set to "rtmp://localhost/helloworld" and you are running the swf from system A and FMS is installed on System B, it wont work. If your FMS is on say machine whose IP is w.x.y.z then you your URI should be "rtmp://w.x.y.z/helloworld". Please try this and let me know if its not working still