Skip to main content
April 30, 2010
Question

Stream.play on server side makes video choppy

  • April 30, 2010
  • 1 reply
  • 3518 views

I have an *.flv file on a FMS. When I play it on the client side the video plays just fine, but when I call Stream.play(filename, 0, -1, false) on the server side the video turns out really choppy.

I both cases I use NetConnection to connect to an rtmp and NetStream to play the stream, but in one case I connect to a stream and request the server to play my file on that stream. Apparently that doesn't work with files? It works just fine for live streams.

I really don't get why this should differ at all. Any suggestions?

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    April 30, 2010

    Can you share your client and server-side code?

    April 30, 2010

    Sure

    I'll try to break it down a bit. Sorry if I miss any essential lines in the prosess

    client side:

    //Really basic.. Connection to rtmp and so on.
    nc = new NetConnection();

    nc.connect("rtmp://mydomain/application");

    -------------------------------------------------------------------------------------------

       //OnNetStatus -> connecting NetStream to Video and playing a live stream: "myStream"

       private function onNetStatus(e:NetStatusEvent):void {
            if (e.info.code == "NetConnection.Connect.Success") {
              
                vid = new Video();
                videoHolder.addChild(vid);

                ns = new NetStream(nc);
                ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);

           
                vid.attachNetStream(ns);
                ns.play("stream");
            }

        }

    -------------------------------------------------------------------------------------------

    //On some event -> call server side function providing the stream name for the file on the same server.

    nc.call("switchStreamRecorded", null, fileStream);

    Really basic. NetConnection connection to my rtmp and so on..

    Server side:

    //Getting the right stream and playing my file on that stream
    Client.prototype.switchStreamRecorded = function(fileToPlay) {
        trace("playing file: " + fileToPlay);
        application.myStream = Stream.get("stream");
        application.myStream.play(fileToPlay, 0, -1, true);
    };

    Let me know if there's anything else of my code you would like to see, but I think this is the basic.

    This works great for live streams. I've been using the example for Stream.play for chaining streams between servers from adobe and no problem with that. Don't get why this should be a problem.

    Participating Frequently
    April 30, 2010

    Code looks fine to me , should work, i mean there should not be any difference whether you play is as VOD or subscribe it via server-side play.

    Can you try replacing ns.play("stream"); by ns.play("stream",-1,-1,true); - see if that helps.

    Also does this happen with all files or just single file.If its problem with just one particular file , if you are ok you can mail me that file at se0208.forum@gmail.com (provided file is small enough to mail )