JavaScript Issues with GetPlayer()

If you've used some of my (and others') examples with JavaScript, where we added additional code in the user.js file, and now it's not working, this might be something to check on:

If you added var p = GetPlayer(); in your user.js file, for example, it used to grab the player fine.

In Storyline 360, you're might be getting an error. The problem is that the file itself, user.js is loaded and executed earlier than GetPlayer() is available. (Granted, this method is not supported. If you add JS within Storyline, those calls will work.) As a workaround, you may have to use jQuery document ready to wait for page load, or add a silly SetTimeout function to start executing the the code with a couple of seconds delay (really unreliable way of handling but works). 

Anyone having similar issues with solutions previously working?

1 Reply