Skip to main content
Inspiring
August 23, 2007
Question

Newb: Does this seem correct?

  • August 23, 2007
  • 1 reply
  • 233 views
Hi. I'm relatively new to FLV and streaming but I'm coming up to speed quickly (I think). I have a Flash app with two buttons. When the user clicks a button, an FLV movie plays inside an FLVPlayback component. It currently works and I'm using Flash Pro 8 to do this. Anyway, the code that I use to do all this is below. My first question is: are the first two lines establishing a net connection even necessary? When I eliminate them it still appears to play. If it is not correct - is there better code that I should be using? I'm using Influxis as my Flash Media host and the package provided me calls for 384 kbps bandwidth. Also, the FLV files are 16 and 12 mb each. When the user clicks a button, it takes about 2 seconds for the video to begin playing. Does that seem about right? Thanks very much for the advise.



var nc:NetConnection = new NetConnection(); var ns:NetStream;
nc.connect("rtmp://xxxxxxxx.rtmphost.com/VideoPlayer");

my1_btn.onRelease = function (){
myPlayer.contentPath = "rtmp://xxxxxxxx.rtmphost.com/VideoPlayer/_definst_/JSDemo142";
}

my2_btn.onRelease = function (){
myPlayer.contentPath = "rtmp://xxxxxxxx.rtmphost.com/VideoPlayer/_definst_/s42";
}
    This topic has been closed for replies.

    1 reply

    August 23, 2007
    If you're using the videoPlayback components, you don't need to define your netconnection in a variable (the component will create the netConnection for you). You just need to pass the rtmp address to the component in the contentPath, as you already are.

    With these two lines:

    var nc:NetConnection = new NetConnection(); var ns:NetStream;
    nc.connect("rtmp://xxxxxxxx.rtmphost.com/VideoPlayer");

    You're creating a connection to FMS that won't be used, so you'd just be needlessly decreasing your server license capacity.