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

Forums

/

Variables in Player Java Script

9 replies [Last post]

How do I best insert Variables in the below code?
I need to call the filenames of the flash videoa and the related jpg files of the starting frame form a database using asp vpscript.
I understand the difference between server side asp and client side java ...

This ist the code I want to use

<script type='text/javascript' src='/embed/swfobject.js'></script>
<div id='mediaspace'>This div will be replaced</div>
<script type='text/javascript'>
var s1 = new SWFObject('/jw/embed/player.swf','ply','470','320','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addParam('flashvars','file=http://content.longtailvideo.com/videos/flvplayer.flv');
s1.write('mediaspace');
</script>

In place of <b>'file=http://content.longtailvideo.com/videos/flvplayer.flv'<b>
I want to use a variable definded in asp.

How can I do this?

Thanks for helping out

Inline:

<script type='text/javascript'>
var s1 = new SWFObject('/jw/embed/player.swf','ply','470','320','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addParam('flashvars','file=<%=variablename%>&autostart=true');
s1.write('mediaspace');
</script>

Using a JavaScript variable:

<script type='text/javascript'>
var file = '<%=variablename%>';
var s1 = new SWFObject('/jw/embed/player.swf','ply','470','320','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addParam('flashvars','file=' + file + '&autostart=true');
s1.write('mediaspace');
</script>

So does this mean we caoul manipulate the displayclick icon using this method? say if I wanted to have the displayclick variable in a function - i.e <if(currentState == "PAUSED"){displayclick ="play";}
else if(currentState == "COMPLETED"){dsiplayclick ="next";}>

is this right if I placed it inside a listener or am I completely off the mark here?

You can only change displayclick if you re-instantiate the player.

To change the displayclick functionality, you can use JavaScript in the link(flashvar) or info(playlist element).

That JavaScript can then call a JavaScript function that can have logic that determines the action based upon the player's current STATE or whatever...

<info>javascript:doSomething()</info>

We are trying to use a set of variables for the first part of a URL in javascript. We are using the longtail player configuration listed in the url below.

http://home5.inet.tele.dk/nyboe/silverlight/wmvplayer/wmvlinkplaylist.htm

I've tried my best to implement the examples listed in the forum above but haven't got it to work yet. I think I'm setting the variable correctly, but I don't understand how to call the variable in a html playlist line such as:

<a href="javascript:createPlayer('mediaspace1', 'http://www.jeroenwijering.com/upload/silverlight.wmv', 'true');">video 1</a>

We would like to replace the partial url of "http://www.jeroenwijering.com/upload/" with a series of variables. Can someone share an example of the above line of code showing at least two variables in use to define the url?

Thanks in advance for any help with this!

bump, we still need help with this issue...

when i click on the micro ,it says javascript.

What do you mean by micro?

Still trying to solve this problem. Need to use variables with the html wmv type javascript playlist. The link to the example is now dead. Is there no one who understands how to do this? Please help!

Would like to know if this is possible, was able to get document.write(file1) to print file name but the player wont read 'file1', why!?!?!