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

Forums

/

flashvars+js playlist confusing betw mult. players

7 replies [Last post]

Hi there,

at the moment we have just one player on our site loading a xml-playlist with two mp3s and using the javascript playlist. everything is working fine:

http://www.initial-gain.de/index.html

now we want to add another player with only one video (loaded directly .. NO xml-playlist). this player is supposed to be the first of the two players.

in the first place i had some issues setting up two players at the same time but i found out how to do it.
unique id for the "mediaspace" and unique name for the player instance.

but it's not really working like it should. first of all i recognised that the first player only works if it's name is "so". else the "noPlayer" message is shown. (i wanted to name them "so_1" and "so_2"). so the first player is working fine. the second is also shown but it's somehow controlled by the flashvars of player one and/or the size variables while creating the first player instance. (i might talk a bit confusing stuff now, because i am really confused .. i don't really know javascript)
to be more precise .. the second player is supposed to be only 24px high as given in the code creating the instance + as given in it's flashvars BUT it's 294px high like the first player.

http://www.initial-gain.de/index_.html

if i switch the players (and their names because the first only works named "so") it's the other way round. the player with mp3 is now only 24px high (yeah) BUT the player with video now is also 24px high (oh no).

http://www.initial-gain.de/index__.html

in addition to my confusion the javascript playlist that looks and works really nice with just one player is now always attached to the first player, even when the first one is the one with the directly loaded video (no xml-playlist). plus there are two playlists shown .. but (confusing again) if the player with video is the first, the playlists are only two slim borders beneath it. if the player with the mp3 loading xml-playlist is the first then the javascript playlist looks nice again (nicely attached to the now first mp3-player) but doubled.

please .. i need help! :)

i need the first player 294px high only playing the video without playlist and the second only 24px high loading the xml-playlist with the two mp3s and showing the nice javascript playlist.

thx in advance.
cheers
norman

Here is demo code explaining how to set up multiple players, it should help clear this up:

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

<div id="hi"></div>

<script type="text/javascript">
var s1 = new SWFObject('player.swf','mp1','500','400','9');
s1.addParam('allowscriptaccess','always');
s1.addParam('allowfullscreen','true');
s1.addParam('wmode','transparent');
s1.addVariable('file','video.flv');
s1.addVariable('image','dawg.jpg');
s1.write('hi');
</script>

<div id="hi2"></div>

<script type="text/javascript">
var s2 = new SWFObject('player.swf','mp2','500','400','9');
s2.addParam('allowscriptaccess','always');
s2.addParam('allowfullscreen','true');
s2.addParam('wmode','transparent');
s2.addVariable('file','bunny.flv');
s2.addVariable('image','dawg.jpg');
s2.write('hi2');
</script>

<div id="hi3"></div>

<script type="text/javascript">
var s3 = new SWFObject('player.swf','mp3','500','400','9');
s3.addParam('allowscriptaccess','always');
s3.addParam('allowfullscreen','true');
s3.addParam('wmode','transparent');
s3.addVariable('file','video.flv');
s3.addVariable('image','dawg.jpg');
s3.write('hi3');
</script>

<div id="hi4"></div>

<script type="text/javascript">
var s4 = new SWFObject('player.swf','mp4','500','400','9');
s4.addParam('allowscriptaccess','always');
s4.addParam('allowfullscreen','true');
s4.addParam('wmode','transparent');
s4.addVariable('file','bunny.flv');
s4.addVariable('image','dawg.jpg');
s4.write('hi4');
</script>

<div id="hi5"></div>

<script type="text/javascript">
var s5 = new SWFObject('player.swf','mp5','500','400','9');
s5.addParam('allowscriptaccess','always');
s5.addParam('allowfullscreen','true');
s5.addParam('wmode','transparent');
s5.addVariable('file','bunny.flv');
s5.addVariable('image','dawg.jpg');
s5.write('hi5');
</script>

hi ethan

i was kind of blind to the code .. both, mine and yours but then *slap on the forehead* i saw the connection between

var sX = ...
andsX.addParam(...
so the players size is working fine now ..

http://www.initial-gain.de/index_.html

THANKS!

.. but unfortunately the javascript playlists still are being attached to the first player both (slim borders beneath the player only because there is no playlist in the first player .. i guess)
how do i tell the javascript playlist to not be there with the first player BUT to have a playlist attached to the second player? looks like the script can't differ between the players or maybe even is just looking for A player and then doesn't care if there is more than just one..?

cheers
norman

Where are the JS playlists on that page?

it's the green lines attached to the bottom of the first player. .. only those lines because this player doesn't use an xml-playlist.

when i switch the two players you can see what happens.

http://www.initial-gain.de/index__.html

the script recognises that there are two players but then only doubles the playlist of the first player it finds.

Your players are both loading with this code - ('player/player.swf','mpl','360','24','9');

But you need to change the mpl for both of them.

Once can be mpl, but the other one should be mpl2

yeah, wonderful! thx!

i also changed the jquery.playlist.js to only create a playlist for players with more than 1 item to play (instead of the default 0 items) so the first player doesn't show the "empty playlist" border ... so now it's like i wanted it to be.

thanks for your help.
nice service.

cheers
norman

NP! :-)