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

Forums

/

PlayerReady not working

3 replies [Last post]

I've tried to modify this example:
http://home5.inet.tele.dk/nyboe/flash/mediaplayer4/JW_API_xmpl_4-2-1-0.html

That page online shows the print configuration at start. The same source pasted into a blank document shows the video but the event PlayerReady isn't fired and the links for "show" and "hide" cnfiguration don't work. How is possible?
I'm using:
- firefox 3.0.10.
- swfobject 2.1
- JW FLV Media Player 4.4

This works for me:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

  <head>

    <title>Configuration Print - JWMP v4.5.x swfobject v2.1</title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>

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

      function playerReady(obj)
      {
        player = gid(obj.id);
        printConfig();
      };

      function printConfig()
      {
        var cfg = player.getConfig();
        var txt = '';

        for(var itm in cfg)
        { 
          txt += '<li>' + itm + ': ' + cfg[itm] + '</li>';
        }
        gid('cnfg').innerHTML = txt;
      };    

      function hideConfig()
      {
        gid('cnfg').innerHTML = '';
      };

      function gid(name)
      {
        return document.getElementById(name);
      };

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

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

      var attributes =
      {
        id:                      'playerID',  
        name:                    'playerID'
      };

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

  </head>

  <body>

    <a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">JW FLV Media Player</a>
    <br>
    Get the configuration data.
    <br>
    <div id="playercontainer"><a id="player" href="http://www.adobe.com/go/getflashplayer">Get Flash to see this player.</a></div>
    <br>
    <a href="#" onclick="printConfig(); return false;">Print the configuration data</a>
    <br>
    <a href="#" onclick="hideConfig(); return false;">Hide the configuration data</a>
    <br>
    <br>
    <ul id="cnfg">
    </ul>

  </body>

</html>

I dicovered that it works only if i put the files online. All the day i was testing locally going crazy.

That's correct. The JavaScript API (and other stuff) only works online.