Skip to main content
Known Participant
July 10, 2006
Question

Stream.get issue

  • July 10, 2006
  • 6 replies
  • 480 views
hi... i have created a stream in the server side that attach the stream os someone

application.onConnect = function(client) {

trace("we are connected");
var playStream = Stream.get("source");
playStream.play("sc", 0, -1);

}
the name od the stream of the user is "sc", and the stream I have created in SS is "source".

when I go to the Admin API I see 2 streams... the "source", "sc", but in the client side when I ask to play the "source" nothing comes, but when i ask to play "sc" i can see the video....

where is my fault?

regards
Hacebe
    This topic has been closed for replies.

    6 replies

    Known Participant
    July 12, 2006
    Hi jay... I got that solved... but with some bugs...

    i can make that works, but after two minutes or less the final stream stops. I have checked in the Admin Console Logs, but nothing happens... It's strange...

    my main.asc is like this:

    quote:




    application.onConnect = function(clientObj) {

    trace("we are connected");
    clientObj.afs = function(str, str1){
    trace ("call");
    var playStream = Stream.get(str);
    playStream.play("client", -1, -1);

    };
    application.acceptConnection(clientObj);
    }


    and my fla actions is like this:

    quote:


    myCam = Camera.get();
    nc = new NetConnection();
    nc.connect("rtmp://server/television");

    nc.onStatus = function(info){
    trace(info.code);
    if(info.code == "NetConnection.Connect.Success"){
    ns = new NetStream(nc);
    ns.publish("client");
    ns.attachVideo(myCam);
    in_video.attachVideo(myCam);
    nc.call("afs", null, "output", "client");

    //ns1 = new NetStream(nc);
    //ns1.play("output");
    //out_video.attachVideo(ns1);
    }
    }


    nothing looks wrong!!!

    what do you think?
    may it be a FMS bug or what?
    thank you
    Known Participant
    July 11, 2006
    I meant Admin Console, sorry!

    yes... I can create an instance manually with no problems... it seems not to get that problem of connection anymore...

    as it is just a test i have made only that lines in the main. asc

    quote:


    application.onConnect = function(client) {

    trace("we are connected");
    var playStream = Stream.get("source");
    playStream.play("sc", 0, -1);

    }



    So, may the problem be in the FMS?
    I don't know almost nothing about SSAC... it's the worst!!!

    So be patience, I really need to learn!
    i read "Programming Flash Communication Server" book but that seems confusing to me!

    Thank you jay
    Known Participant
    July 11, 2006
    I tryed doing what you said...

    when the onStatus give me "NetConnection.Connect.Success" The stream becomes to be published.

    althought i can't see the feedback in the admin API i can see 4 streams. 2 with specific name and 2 with some differents characters I really don't know why it's not working, when I delete the main.asc, my app always connect, but when I put my main.asc again sometimes it fails on connecting!

    I have checked the syntaxes and got no errors!

    Thank you Jay for helping me again!
    July 11, 2006
    quote:

    Originally posted by: Vinicius Hacebe
    althought i can't see the feedback in the admin API
    quote:



    Do you mean the admin console or the admin api? There's a major difference.

    quote:

    when I delete the main.asc, my app always connect, but when I put my main.asc again sometimes it fails on connecting!
    quote:



    Post your entire main.asc, as well as the log from the app instance if you can. If the app is starting sporadically with the asc file inplace, my first guess is that there's an error in there somewhere. Can you start an instance manually from the admin console when the main.asc is in place?

    I have checked the syntaxes and got no errors!

    Thank you Jay for helping me again!


    July 10, 2006
    I don't see anything syntactically wrong with your code, but I have the feeling it's a timing issue. Since you don't have an onStatus handler for your netconnection, you might be subscribing to "input" before the connection is established.

    I'd try adding an onStatus handler to nc, and wait for the onStatus event before connecting to the stream.
    Known Participant
    July 10, 2006
    sorry jay... but I was not enought

    i have this in my main.as

    quote:

    application.onConnect = function(client) {

    trace("we are connected");
    var playStream = Stream.get("input");
    playStream.play("source", -1, -1);

    }



    and this in the .fla file

    quote:


    myCam = Camera.get();
    nc = new NetConnection();
    nc.connect("rtmp://server/television");
    ns = new NetStream(nc);
    ns.publish("source");
    ns.attachVideo(myCam);
    video_video.attachVideo(myCam);

    ns1 = new NetStream(nc);
    ns1.play("input");
    output_video.attachVideo(ns1);


    July 10, 2006
    This line is where you're going wrong:

    playStream.play("sc", 0, -1);

    For a live stream, you want the startTime flag to be -1. Right now, you have it set to zero. The result of setting the strat time to a value greater than -1 is that FMS looks for a recorded stream instead of a live stream. If there's no recorded stream, the method is ignored.

    Change that line to the following, and you should be good to go:

    playStream.play("sc", -1, -1);