Go
Not registered? Sign up!

playerReady not called in 4.4.192

Google Translate
23 posts | return to the Bug Reports forum | get the rss feed for this thread

Apr. 01, 2009zach

I've downloaded the latest JW player, 4.4.192 licensed version... and the player is being embedded fine through embedSWFObject, but the playerReady function isn't being called.

This is what its embedding, so I don't think its a script access problem:

<object id="player1" width="720" height="405" type="application/x-shockwave-flash" name="player1" data="/includes/javascript/video/player.swf">
<param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<param name="flashvars" value="autostart=false&controlbar=over&skin=/includes/javascript/video/dangdang.swf/>
</object>

Apr. 01, 2009lefTy

Are you testing this on a Linux client?

v4.4.192 works well for me, embedded with swfobject v2.2. No problems calling the playerReady() function.

Apr. 02, 2009ivan

I have the same problem. I'm using v 4.4.192 with wfobject v2.1 on suse 11.1. The playerReady() functions isn't being called and i can't access the player with document.getElemtentById('playerID'). Can you plaese help me

Apr. 02, 2009zach

I am testing on a linux client, ubuntu specifically, w/ sfwobject 2.1 as well... FF 3.08

Apr. 02, 2009lefTy

@zach,

For Linux, add the flashvar id=player1 to match the name and id in your object code. Jeroen added the id flashvar specifically for Linux.

Apr. 02, 2009zach

that did the trick... odd since it worked in older releases without... but thanks!


EDIT: Actually... is this a bug? why doesn't it use the fields in the id/name? I only ask because I will have to go through and change all my videos because I need to utilize this value through javascript...

Apr. 02, 2009ivan

I founded myself about an hour ago and now everything is working just fine. Anyway @lefTy thanks for the help:)

Apr. 03, 2009KissGround

Hi all,

Ivan, can you explain how do you do, to resolve your problem ?!?

Thank a lot, KissGround

Apr. 08, 2009ivan

@KissGround you have to add id flash var with the same value as the embeded object id and name. Here's my code. Hope it will help!

function createPlayer() {
var flashvars = {
id: "jwplayer",
controlbar: "over",
autostart:true
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}
var attributes = {
id:"jwplayer",
name:"jwplayer"
}

swfobject.embedSWF("/swf/player.swf",
"videoplaceholder", "480", "360", "9.0.115",
false, flashvars, params, attributes);
}

May. 19, 2009ankle

"For Linux, add the flashvar id=player1 to match the name and id in your object code"

This is a horrible bug/workaround! Where is this documented on the Javascript API pages?

May. 19, 2009kissMe

@ankle,

I guess you missed it here: http://developer.longtailvideo.com/trac/wiki/FlashVars#API

Next time, read the documantation more carefully before you post and make a fool of yourself.

May. 21, 2009ankle

@kissMe: True, right at the bottom of the page it says
"id (ply): ID of the player within the javascript DOM. Useful for javascript interaction. This is automatically set for Windows / MAC, but under Linux you'll have to set the flashvar. "

But it doesn't mention this on the main API page at <http://developer.longtailvideo.com/trac/wiki/FlashAPI>, nor does it say in big letters anywhere that playerReady just won't fire on Linux unless the id flashvar is set.

I'm not being difficult, just trying to help prevent anyone else spending a long time wondering why the player isn't doing anything at all.

May. 21, 2009aymen

oufff!!!!! yes This is a horrible bug !!!!!!!!!!!!!!!!!!!!!!
thank's IVAN wink

May. 21, 2009kissMe

 
   RTFM

Jun. 23, 2009Carl

I just encountered this *bug* too - and ye, just because it's documented, doesn't mean it isn't a bug.

And I agree with ankle that it is even poorly document - nothing on the API page, nothing in the tutorials. Gah.

The worst part is it would go completely uncaught until production were dev done on windows/mac.

Jun. 23, 2009kissMe

 
    ROFL

Jul. 28, 2009Fibonacci

"RTFM"

I've RTFM, and nowhere in the FM does it say that playerReady will not be called unless the flashvar id is set.
Also, why is it automatically detected on Windows and Mac, but not GNU/Linux?

Jul. 28, 2009kissMe

@Fibonacci,

Guess you also skipped this part of the manual: http://developer.longtailvideo.com/trac/wiki/FlashVars#API

Next time, read the documantation more carefully before you post and make a fool of yourself.

Jul. 28, 2009Fibonacci

@kissMe,

I still don't see anywhere that playerReady will not be called unless the flashvar id is set, or why is it not automatically set on GNU/Linux.

Next time, read the documantation more carefully before you post and make a fool of yourself.

Jul. 28, 2009kissMe

Calling playerReady() is not crucial to the use of the JavaScript API.

It's just a convenient way of knowing when the player reference object is available.

You can still do a loop, checking for the player reference object.
Then, when the player reference object is available, start using the JavaScript API.
It yields the same functionality as playerReady().

As for why, go ask Adobe why the automatic ID retrieval through ExternalInterface.objectID doesn't work on Linux.

Jul. 30, 2009Not Having Fun

Still cannot get the call for playerReady - any other ideas? I put id in flashvars. Thanks

function createPlayer() {
var flashvars = {
id:"player1",
file:"/playlists/uriplaylist.xml",
autostart:"true",
bufferlength:"10",
controlbar:"none",
autostart:"true",
displayclick:"none",
icons:"false",
quality:"false",
repeat:"list",
stretching:"exactfit"
}
var params = {
allowfullscreen:"false",
allowscriptaccess:"never"
}
var attributes = {
id:"player1",
name:"player1"
}
swfobject.embedSWF("/flvplayer/player.swf", "placeholder1", "823", "535", "9.0.115", false, flashvars, params, attributes);
alert('Player Created ');
}

function playerReady(thePlayer) {
alert('Player Ready Function');
player = document.getElementById(thePlayer);
addListeners();
}

Jul. 30, 2009lost

 
Guaranteed working code.

Demo Page:

    http://willswonders.myip.org:8074/Not%20Having%20Fun.html

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

<html>

  <head>

    <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

    <script type="text/javascript">
      var flashvars =
      {
        id:                    'playerID',
        file:                  'playlist_jwchapters.xml',
        autostart:             'true',
        bufferlength:          '10',
        controlbar:            'none',
        displayclick:          'none',
        icons:                 'false',
        quality:               'false',
        repeat:                'list',
        stretching:            'exactfit'
      };

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

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

      swfobject.embedSWF('player-4.6.248.swf', 'player', '823', '535', '9.0.124', false, flashvars, params, attributes);
    </script>

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


      function playerReady(obj)
      {
        player = gid(obj.id);
alert('Player ID: ' + player.id);
        addListeners();
      };


      function addListeners()
      {
        playlist = player.getPlaylist();

        if(playlist.length > 0)
        {
          player.addModelListener('STATE', 'stateMonitor');
        }
        else
        {
alert('Try Again!');
          setTimeout("addListeners();", 100);
        }
      };


      function stateMonitor(obj)
      {
alert('State: ' + obj.newstate);
        if(obj.newstate == 'COMPLETED')
        {
          //...drop out of fullscreen
          this.window.focus();

          //...load a new page
          window.location = 'http://yahoo.com';
        }
      };


      function gid(name)
      {
        return document.getElementById(name);
      };
    </script>

  </head>

  <body>

    <div id="playercontainer" class="playercontainer"><a id="player" class="player" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Adobe Flash Player to see this video.</a></div>

  </body>

</html>

Oct. 21, 2009aotianlong

my god.

i spent a lot of time to resolve this problem.

!!!

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.