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

Forums

/

Multiple instances of player on one page

10 replies [Last post]

Hello all,

Does anyone has a clue to place multiple instances off the player on one page with different vids? I achieved ;) one vid. But when I multiply the code to another frame in te same page only the first vid is shown. even when I give the second instance a different name.

Thanks in advance

 
Make sure that each player has unique name/id attributes and if you are using swfobject to embed your Flash content, make sure that each container element has a unique id.

Post a link a link to your Test Page so someone can help you further. We can't guess.

Hi Hobbs, I have an example at http://monopunk.verhey-ict.nl/ in the first page on the right I have two players. Of which one doestn work at the webserver. Local on my machine both work but online only one. I have unique names for both players and elements. You can look at the source, or should I post the code for both players here?

Greets,
Peter

 
Put this inside the head element of your HTML document.

    <script src="Media/swfobject.js"></script>

The JavaScript player embedding code must not be wrapped in the division element that SWFObject will write the object element into (for Flash content embedding).

          <!-- Video box -->
          <div class="box video">
            <!-- fragment -->
            <div class="fragment">
              <div id='mediaspace'><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>
            </div>

<script type='text/javascript'>
  var so = new SWFObject('Media/player-viral.swf', 'ply', '190', '120', '9.0.124', '#ffffff');
      so.addParam('allowfullscreen',     'true');
      so.addParam('allowscriptaccess',   'always');
      so.addParam('wmode',               'opaque');
      so.addVariable('file',             '../Media/studio.flv');
      so.addVariable('image',            'layout/images/header/logo.png');
      so.addVariable('backcolor',        '333333');
      so.addVariable('frontcolor',       '888888');
      so.addVariable('lightcolor',       '333333');
      so.addVariable('screencolor',      '333333');
      so.write('mediaspace');
</script>

          <!-- Video box -->
          <div class="box video">
            <!-- fragment -->
            <div class="fragment">
              <div id="mediaspace1"><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>
            </div>

<script type='text/javascript'>
  var s1 = new SWFObject('Media/player-viral.swf', 'ply', '190', '120', '9.0.124', '#ffffff');
      s1.addParam('allowfullscreen',     'true');
      s1.addParam('allowscriptaccess',   'always');
      s1.addParam('wmode',               'opaque');
      s1.addVariable('file',             '../Media/featKosmo.flv');
      s1.addVariable('image',            'layout/images/header/logo.png');
      s1.addVariable('backcolor',        '333333');
      s1.addVariable('frontcolor',       '888888');
      s1.addVariable('lightcolor',       '333333');
      s1.addVariable('screencolor',      '333333');
      s1.write('mediaspace1');
</script>

hi, i'm trying to do this with the windows media player in browser plugin. it is not working. i have unique identifiers.

Hi,

Unfortunately, we cannot provide support for the Windows Media Player browser plugin, as this is not our product.

Best,
-Ethan

Hello,
I also have the problem that a second player won't show.
I tried the solution given above but somehow that doesn't do the trick.
I uploaded a test page with only the players so there's not much code to look at:
http://www.bakkieroet.com/test.php
If someone good have look at it and could tell me what I'm doing wrong here I'd be very happy.
Thanks in advance.

Herman

It looks like the second player is pasted over the first one. If I play the first one I get the sound of the second player.
(BTW: web design is a bit of a hobby, not my job. I'm probably making a very simple mistake here but I've been fooling around with it for a few hours and don't know what I'm doing wrong ;-))

@Herman - your issue is that you have so.write('mediaspace'); and s1.write('mediaspace'); so both players are trying to write to the same div - 'mediaspace', you need to make another div with a different name, like mediaspace2, and then make so.write('mediaspace'); look like so.write('mediaspace2');

That should work.

Thanks Ethan,
Indeed that's the line I overlooked. Now I see it. It works now.
As I thought, a very simple mistake :-D
Kind Regards
Herman

Np! :)