Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Load movie only if a certain variable is met

8 replies [Last post]

Hello,

We have a FMS setup and I found this player perfect match for video streaming. My main concern is this now though, we have limited bandwidth so I had to pull a environment variable through vbscript and turn it into a variable to be passed into Flash, and then that variable is part of the vhost on our FMS that helps limit the bandwidth.

My question is this, can I pass this variable into jwplayer and have it link up to one of our vhosts still?

To hopefully better understand this, this is the vital piece in Flash that we used to link the flashvar to our vhost.

data:"rtmp://fms"+Num+"/myapps/"+item.attribute("src").toXMLString()});

Num is the flashvar.

Thanks

@Alex -

I think the way to do this would be to generate the "streamer" option through JavaScript and pass it into the player that way. There's no way to configure the player to insert a flashvar into the streamer.

Example, using SWFObject:

<script type="text/javascript">
  swfobject.embedSWF('player.swf', 'player', '560', '300', '7.0.0', 'expressInstall.swf',
     {
        file: '/path/to/file.mp4',
        streamer: 'rtmp://fms'+Num+'/myapps/',
        provider: 'rtmp'
     },
     params,
     attributes
  );
</script>

Hey Pablo-

That sounds like it could work. The other thing I forgot to mention is that this is in place because we have many different locations so each location has a different variable. It seems like by doing it this way I would still be able to pick up the variable with my script, and then have the SWFObject be able to use that variable still so it goes to the right Vhost.

Correct?

Thanks a lot!! :)

So I tried this, and I get the error that swfObject is undefined :(

<script type="text/javascript">
  swfobject.embedSWF('player.swf', 'player', '560', '300', '7.0.0', 'expressInstall.swf',
     {
        file: '/VOD/vid1.f4v',
        streamer: 'rtmp://fms'+Number+'/myapps/',
        provider: 'rtmp'
     },
     params,
     attributes
  );
</script>

@Alex - you need to download the swfobject library (http://code.google.com/p/swfobject/) and embed it on your page:

<script type="text/javascript" src="swfobject.js"></script>

http://www.longtailvideo.com/support/jw-player/13/embedding-flash#swfobject

@Pablo,

I have the swfobject.js embedded, but it still isn't working. I followed each step on the link you provided and still receiving the error and no video stream.

I must have the streamer and file messed up, but I get confused as to what file path to use. Within the main FMS folder structure, i see the applications folder and the docs and samples, but we created an archive in this folder where the videos are all being stored.

Is this the folder that I use for the file? Which folder is the streamer, does my code look about right? Do I need the mp4: extension before the filename?

@Alex A - Can you show me where you are running this?

I seem to have figured it out. My new problem arises now as this:

I am trying to use the videolightbox.js plugin and in order to properly get the video to play, I need to pass a flashvar along through querystring. My problem though is that my variable I'm trying to pass is dynamic and will always be different depending upon where our viewers are, so my question is how can I pass this variable?

It works fine if I define it as ?Number=1, but as I said this number will always be different depending upon the user. I tried many different variations hoping that ?Number would transfer the variable and whatever was stored, but doesn't work.

Can you show me where you are running this?