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

Forums

/

Load file or playlist from link problem

2 replies [Last post]

First, I'm NOT an experienced web designer. Although I've done a few sites and know enough about HTML and javascript to do some basic stuff, I rely on sample code and 3rd party programs to create drop-down menus and the like.

What I'm trying to create is an HTML player page where I can load various videos from image links into one player. This needs to be inserted into an existing DHTML web page template.

The problem I'm having is that I can successfully copy/paste the sample code from the tutorial into a blank page, but when pasting that same code into the .dwt page template, the following happens:

1. In IE, the JWPlayer won't load and instead I see the "Get flash to see this player" text. I have the latest version of Flash so this isn't the problem. The rest of the page works fine.

2. In Firefox, the JWPlayer loads and the links work fine. But my drop-down javascript menu stops working.

Here's the test page: http://www.videomi.com/Flash_load_test2.htm

I'm using JWPlayer 4.5 demo, SWFobject 2.1. I've read and re-read the related posts on the forums, but nothing seems to work. Am I going about this the wrong way?

Thanks

Internet Explorer doesn't like JavaScript loading code lines that are broken into multiple lines.

swfobject will take care of monitoring the DOM loading and create the object element for embedding Flash content at the correct time, so there is no need to wrap your player embedding code in a function that is called with onload().

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

    <script type="text/javascript">
      var player = null;

      function playerReady(obj)
      {
        player = document.getElementById(obj.id);
      };

      var flashvars =
      {
        file:              "http://content.bitsontherun.com/videos/3ta6fhJQ.flv",
        id:                "player1",
        autostart:         "true"
      };

      var params =
      {
        allowfullscreen:   "true", 
        allowscriptaccess: "always"
      };

      var attributes =
      {
        id:                "player1",  
        name:              "player1"
      };

      swfobject.embedSWF("player.swf", "placeholder1", "320", "196", "9.0.124", false, flashvars, params, attributes);
    </script>

  </head>

  <body>

Ahh...I see. I had the entire bit of code (to load/embed the player) in the wrong place too.

It now works. Thanks for the help.

But one question. Why is the tutorial sample code written the way it is if IE doesn't like it?

Not a big deal as this site is tremendous. Just curious.