Skip to main content
Inspiring
May 17, 2007
Answered

FMS/FLVPlayback

  • May 17, 2007
  • 22 replies
  • 3303 views
FMS is installed. I have my .flv file under my directory for the application. Trying to use the FLVPlayback in Flash 8 to call it using rtmp://myserver/myapp/_definst_/myvideo.flv. Publish and it just brings up a blank screen. never plays. I know the .flv file works ok. I can see it connecting to the FMS so I know that is working ok. My application does use UC/LC combination and i read something that says it might be a problem. Any help??? I have the main.asc file from the Flash8 components sample (although that does say it is for the old 1.5 server).
    This topic has been closed for replies.
    Correct answer hml398
    OK - for anyone doing research - first try a sample .flv from somewhere if you are having problems. The connection string that works:

    rtmp://servername/applicationname/flvfile

    22 replies

    May 17, 2007
    Im using Flash 8. R u using FME to stream the FLV? If so, then you would need to change the isLive to true and make sure FME is publishing the correct stream name.

    hml398Author
    Inspiring
    May 17, 2007
    I found this on Adobe's site:

    Note: When you test the playback SWF files, if everything is working correctly, the video being streamed by Flash Media Encoder should appear almost immediately. If the video being streamed does not appear within 15 or 30 seconds, double-check all the steps for creating the playback SWF file and the steps in the prior sections on Flash Media Server and Flash Media Encoder. If the video still does not appear, the layer behind it (if any) will show through. This is true if either Flash Media Server or Flash Media Encoder are not started. This is also true if there is any error in configuring the FLVPlayback component at author time.

    I can see a layer that I stuck behind the flash file so that isn't a good sign. But I can definitely see the connection on the media server and it isn't getting dropped. Are you using Flash 8 or CS3?
    hml398Author
    Inspiring
    May 17, 2007
    any other ideas?? I really appreciate your help on this.
    May 17, 2007
    Everything looks ok in the asc file. If you don't need to check the bandwidth, dump calulateClientBw method and only send the onBWDone.

    May 17, 2007
    RTMP connections are not case sensitive. If the FLV is in the HorationMembers/streams/_definst_/wolk, then it must be that the main.asc file is not sending the result to FLVPlayback.

    Do you have a main.asc file in HoratioMembers directory and does it contain the call("onBWdone") in the onConnect method?
    hml398Author
    Inspiring
    May 17, 2007
    This is the main.asc file that we are using.

    /* Copyright 2004 Macromedia, Inc. All rights reserved.
    The following is Sample Code and is subject to all restrictions
    on such code as contained in the Macromedia Flash Communication
    Server MX 1.5 End User License Agreement .
    */

    application.onConnect = function(p_client, p_autoSenseBW)
    {
    //Add security here

    this.acceptConnection(p_client);

    if (p_autoSenseBW)
    this.calculateClientBw(p_client);
    else
    p_client.call("onBWDone");
    }

    Client.prototype.getStreamLength = function(p_streamName) {
    return Stream.length(p_streamName);
    }

    Client.prototype.checkBandwidth = function() {
    application.calculateClientBw(this);
    }


    application.calculateClientBw = function(p_client)
    {

    p_client.payload = new Array();
    for (var i=0; i<1200; i++){
    p_client.payload = Math.random(); //16K approx
    }

    var res = new Object();
    res.latency = 0;
    res.cumLatency = 1;
    res.bwTime = 0;
    res.count = 0;
    res.sent = 0;
    res.client = p_client;
    var stats = p_client.getStats();
    var now = (new Date()).getTime()/1;
    res.pakSent = new Array();
    res.pakRecv = new Array();
    res.beginningValues = {b_down:stats.bytes_out, b_up:stats.bytes_in, time:now};
    res.onResult = function(p_val) {

    var now = (new Date()).getTime()/1;
    this.pakRecv[this.count] = now;
    //trace( "Packet interval = " + (this.pakRecv[this.count] - this.pakSent[this.count])*1 );
    this.count++;
    var timePassed = (now - this.beginningValues.time);

    if (this.count == 1) {
    this.latency = Math.min(timePassed, 800);
    this.latency = Math.max(this.latency, 10);
    }


    //trace("count = " + this.count + ", sent = " + this.sent + ", timePassed = " + timePassed);

    // If we have a hi-speed network with low latency send more to determine
    // better bandwidth numbers, send no more than 6 packets
    if ( this.count == 2 && (timePassed<2000))
    {
    this.pakSent[res.sent++] = now;
    this.cumLatency++;
    this.client.call("onBWCheck", res, this.client.payload);
    }
    else if ( this.sent == this.count )
    {
    // See if we need to normalize latency
    if ( this.latency >= 100 )
    { // make sure we detect sattelite and modem correctly
    if ( this.pakRecv[1] - this.pakRecv[0] > 1000 )
    {
    this.latency = 100;
    }
    }

    delete this.client.payload;
    // Got back responses for all the packets compute the bandwidth.
    var stats = this.client.getStats();
    var deltaDown = (stats.bytes_out - this.beginningValues.b_down)*8/1000;
    var deltaTime = ((now - this.beginningValues.time) - (this.latency * this.cumLatency) )/1000;
    if ( deltaTime <= 0 )
    deltaTime = (now - this.beginningValues.time)/1000;

    var kbitDown = Math.round(deltaDown/deltaTime);

    trace("onBWDone: kbitDown = " + kbitDown + ", deltaDown= " + deltaDown + ", deltaTime = " + deltaTime + ", latency = " + this.latency + "KBytes " + (stats.bytes_out - this.beginningValues.b_down)/1024) ;

    this.client.call("onBWDone", null, kbitDown, deltaDown, deltaTime, this.latency );
    }
    }
    res.pakSent[res.sent++] = now;
    p_client.call("onBWCheck", res, "");
    res.pakSent[res.sent++] = now;
    p_client.call("onBWCheck", res, p_client.payload);

    }
    May 17, 2007
    Is the flv a live stream or recorded FLV? If recorded, it must be in the horationmembers/streams/_definst_ folder and the flvplayback isLive set to false.
    hml398Author
    Inspiring
    May 17, 2007
    It is a recorded FLV. I have tried it set to false and that doesn't work. I have tried it with the .flv extension and without. I have tried it with _definst_ in the string and without. The actual folder name of hte Application is HoratioMembers. Do you think the caps could be an issue?
    May 17, 2007
    Just tried, but did not connect. Is the rtmp mapped to your FMS server and is port 1935 open? Can you log into the FMS admin panel and see if the app is rejecting the conection?
    hml398Author
    Inspiring
    May 17, 2007
    I can see it connecting ok - port 1935 is open. That is what is so weird!
    hml398Author
    Inspiring
    May 17, 2007
    Public:

    xxxxx
    May 17, 2007
    Is your rtmp public or on your local host? If public, can u send me the connection string and I can test from here.
    May 17, 2007
    check you rtmp connection string in the contentPath...should look like

    rtmp://myFMS.com/myApp/myFlv

    replace myFMS with your fms connection info, myApp wiht your applicaiton name, and myFlv with your flv name

    also make sure that autoPlay is true to play when connected.
    hml398Author
    Inspiring
    May 17, 2007
    All that and a bag of chips and the stupid thing still doesn't play!