Skip to main content
Inspiring
February 17, 2007
Answered

Republished live stream plays then freezes -- SOLVED!

  • February 17, 2007
  • 3 replies
  • 725 views
Hi all,

Can someone kindly help me with this problem?

I have written an application that republishes a live stream. When I connect to the republished stream, I can view it for about 30 seconds and then it freezes when the subscriber receives a "NetStream.Play.UnpublishNotify" for no apparent reason.

Here is a stripped-down version of the application the reproduces the problem:

main.asc:
application.onAppStart = function()
{
var stream = Stream.get("republish");
stream.play("publish", -1, -1);
}

When the capture client publishes to "publish" and the subscribing client subscribes to "republish" the live stream plays for about 30 seconds and then freezes when it receives a "NetStream.Play.UnpublishNotify" message. I am at my wits end with this problem. :(

Any and all replies are much appreciated.

Thanks in advance,
Barry
    This topic has been closed for replies.
    Correct answer Barry_F
    With the help of Adobe Platinum Support I found the solution. And of course it is so simple I am kicking myself. The problem is in the server-side code:

    application.onAppStart = function()
    {
    var stream = Stream.get("republish");
    stream.play("publish", -1, -1);
    }

    Because I stored the stream in a local variable, it gets garbage-collected a minute later and the stream is automatically unpublished. The correct code is:

    application.onAppStart = function()
    {
    application.stream = Stream.get("republish");
    application.stream.play("publish", -1, -1);
    }

    Any variation that stores the stream non-locally will also work. I assumed that a stream would not be garbage-collected while someone is watching it but I was wrong.

    I hope this solution saves somebody a lot of trouble in the future!


    Barry

    3 replies

    Barry_FAuthorCorrect answer
    Inspiring
    March 13, 2007
    With the help of Adobe Platinum Support I found the solution. And of course it is so simple I am kicking myself. The problem is in the server-side code:

    application.onAppStart = function()
    {
    var stream = Stream.get("republish");
    stream.play("publish", -1, -1);
    }

    Because I stored the stream in a local variable, it gets garbage-collected a minute later and the stream is automatically unpublished. The correct code is:

    application.onAppStart = function()
    {
    application.stream = Stream.get("republish");
    application.stream.play("publish", -1, -1);
    }

    Any variation that stores the stream non-locally will also work. I assumed that a stream would not be garbage-collected while someone is watching it but I was wrong.

    I hope this solution saves somebody a lot of trouble in the future!


    Barry
    February 21, 2007
    I don't see anything inherently wrong with the server side code you posted, so I'm guessing something is happening on the client side (on the publisher). Is the onStatus message you're getting coming from the client or the server?

    On of two things is happening... either the publishing client is unpublishing from "publish" or the server is unpublishing from "republish".

    Do you happen to be using the VideoRecord component that comes with the Adobe Communication Componenets set? I seem to remember someone posting about that some time back. It was unpublishing unexpectedly... but I don't recall why.
    Barry_FAuthor
    Inspiring
    February 22, 2007
    Thanks for your reply, Jay.

    The player client is receiving an UnpublishNotify message from the server, but the server is NOT receiving an UnpublishNotify from the capture client. As well, when I re-issue the command republish.play("publish", -1, -1) on the server, the video streams again (for another minute). This proves to me that the server is unpublishing the "republish" stream but the capture client is NOT unpublishing the "publish" stream. However as you can see there is nothing in my code that would make either stream unpublish. :-/

    The example client code is completely boilerplate and mostly copied from Macromedia training examples. However here are links to the code if you want to see it:
    Capture client
    Player client

    I know it is easy to blame Adobe but at this point I am convinced it is a bug in FMS. My example code is straight out of the textbook and my app is exhibiting behavior that is not documented anywhere. What do you think?


    Thanks again,
    Barry
    February 22, 2007
    Hmm... I don't see anything wrong with your code. As you said, pretty much textbook examples there.

    The only thing I do differently is to make sure the call to Stream.get() returns true before playing another stream over it:

    s = Stream.get("foo");
    if (s){
    s.play("publish", -1, -1, true);
    }

    ... but I don't really think skipping the evaluation would cause such a consisitent failure. Do you get any error messages in the server log when the stream stops publishing?
    Barry_FAuthor
    Inspiring
    February 20, 2007
    Pardon my bumping this thread but I am desperate for an answer.

    The live stream I republish using stream.play() unpublishes for no apparent reason after approx. 30 seconds. I have stripped down my code to what is essentially a textbook example but it still doesn't work. :(

    Could this be a bug in FMS 2.0? I haven't seen any similar bug reports in my web searches.

    Any and all replies are much appreciated.

    Thanks in advance,
    Barry