Storyline Player Javascript interaction


So I'm working with Javascript to create custom functionality in my slides.  

I have gone over the best practices here:

This give several good examples of javascript functions but I am unsure of what the api for the articulate player is and what all I can access.

Specifically I would to access some sort of seekTo(Time) type function.

Is there something similar to either of these out there?



71 Replies
Dave Cox

Hi Stephanie,

In the top line of your code, you declare the var scoreReportjs and retrieve the valuse from the articulate player. Once you declare a variable, you don't want to use the var keyword with it again. Remove the "var" keyword from the lines in your if then else statement. Declaring that as a variable again inside the if then statement causes javascript to treat it as a new local variable, and the contents of the original variable is ignore.

After you update the value of your variable with your if then statement, you need to update the articulate playe variable. To update your the articulate variable your statement needs to tell articulate when variable to update. Try this statement:


Another thing you can do to help debug your code, is to press F12 while the player is in your browser to open the developer tools. Select the console tab and view any javascrtip errors that may have occured. This will help you narrow the problem down in your code.

I hope this helps,


Dave Cox

Dave Cox

Sometimes it helps to get it down to the simplest actions, and then build from there. 

Try changing your last line to:


This should set your value to 1.

If that doesn't work, try:

GetPlayer().SetVar("scoreReport", 1);

Make sure the variable name of your variable in the course matches the variable name that you use here, including capitalization. Javascript interprets upper and lower case as different letters.

Also, I'm assuming the your variable is numeric? If it is text, change the statement to:

GetPlayer().SetVar("scoreReport", "1");

If you can get this statement to work, then you can go back and work out the rest of your code.

If you still can't get it to work, if you can post your project here I can take a look at it for you.



Dave Cox

If you declare a variable inside a function, it will be local to the function. If you declare it outside of the function, it will be global. Also, any variable that you declare in the variables panel in the storyline story will be global to both storyline, and to your javascript. 

If you are writing your javascript wholly within the trigger dialoge, I don't know think the variable will persist from one trigger to the next, but I haven't verified it. I suggest if you are doing this, store your variable in the storyline variables using setVar().

Crystal Horn

Hi Marisa!  I'm so glad the community helped you out here!  We support the published output without any modifications so that we can be sure that every feature of your course works well.  Fortunately, the forums have a wealth of information, especially when it comes to workaround and modifying your output.  Happy to see that these older threads are still beneficial.

James HIll

I know this is an old thread, but it seems like the topic I'm looking for. We're trying to access a storyline variable in javascript. I've tried the above with player.getVar and var p = getPlayer().getVar

But it tells me that getPlayer is undefined, getVar I can't find as a function in the js files, and also player is undefined.

Is this feature not available anymore (we have storyline 2).

Leslie McKerchie

Hi Christian,

The reply by Mark is a bit dated and I'm not sure if he's still subscribed here.

JavaScript is certainly not my specialty, but we have some brief documentation here related to Storyline 360. 

Please feel free to share what you would like to accomplish and I'm sure someone in the community can pop in to assist.