Forum Discussion
DarrylPalaub492
3 years agoCommunity Member
SL360: Javascript GetPlayer() function is not defined
Hi, Everyone.
How to get a variable value from the storyline 360 using external javascript with GetPlayer, SetVar, and GetVar, but it doesn't work. It always gives an error like this "Uncaught Ref...
Jürgen_Schoene_
Community Member
my first idea was waiting with "window.setTimeout", like
function updateDOM(){
var player = GetPlayer();
...
}
function waitStorylineReady(){
console.log("wait", typeof GetPlayer );
if( typeof GetPlayer === "undefined" ){
window.setTimeout( waitStorylineReady, 1000 );
} else {
updateDOM();
}
}
waitStorylineReady();
but this doesn't work
storyline needs the function "window.globalProvideData( ... )" to start
you have moved the function to "frame-english.js", "frame-tagalog.js" (for later loading)
-> now storyline doesn't start, "GetPlayer" is never initialize, waiting is useless
(the waiting animation is a simple css animation without javascript)
Jürgen
DarrylPalaub492
3 years agoCommunity Member
This makes sense thanks for this, I tried putting the GetPlayer code at the end of the function "window.globalProvideData( ... )" but still GetPlayer is not working.