Forum Discussion
SL3 Javascript GetPlayer() function not defined in HTML5 output
Hi forum.
I created a game a while back for SL2, my external JS file gets and sets a bunch of Storyline variables using GetPlayer, SetVar and GetVar.
With the release of SL3, I have published this same game out, the Flash version works fine, the HTML5 version however, does not work. I am getting a ReferenceError on GetPlayer.
Does anyone know what the function to grab the SL player has changed to? I have gone through most of the given code, but I can't find any direct references to it anymore.
23 Replies
- GaryKenyonCommunity Member
Running GetPlayer(), well after the course has finished loading, appears to work. This seems to be an issue with the way that the HTML5 output runs its JS files.
Another thing to note, SL3 now uses Booleans correctly. SL2 would use strings for bools, this means that when you grab the variable using js and check whether it's true or false, you would need to use "true" or "false". No longer in SL3.
Little things like the above should be shared with the community, otherwise we spend our already limited time trying to fix things that we shouldn't have to.
Hi chiefy,
I know we've got a few reports with our team of issues with some JS triggers and HTML5 not working as they did in Storyline 2.
We're still digging into those - but I'd like to get our team looking at your example too. Can you reach out and share with our Support Engineers here?
- GaryKenyonCommunity Member
Good morning.
I sent a support ticket, detailing the issue. I think it could be something to do with the way that SL3's HTML5 output loads it's JS files.
Thanks Chiefy for sending that along! I see that Eloisa reached out for your case and I'll follow along as well.
- FrankSiegel-c2eCommunity Member
Did this ever get resolved? I have the same issue. The story works fine in Articulate, but when we run in our environment (in an iFrame), when executing the JavaScript statement:
var player = window.parent.GetPlayer();
we get the following message in the web console:
window.parent.GetPlayer is not a function
The function is defined in app.min.js
Can you give me an update? Thanks
Hi Frank,
Eloisa was waiting for some additional information from Chiefy.
We do know of some issues with certain JS triggers for player functions not working as they did in Storyline 2, and it's specific to the HTML5 output.
Have you tried your JS outside of an iFrame? Perhaps using Amazons S3 or upload to Tempshare would help narrow down the issue.
- FrankSiegel-c2eCommunity Member
It was the iFrame. We viewed the page source, pulled the iFrame tag out and pasted that into the browser and the JavaScript worked fine. Turns out that since it's an iFrame:
window.parent.GetPlayer()
won't cut it.windows.GetPlayer()
works.So you might want to share this. Thanks
Thanks Frank for sharing that here!
- GuillaumeTEIX-bCommunity Member
Hi everyone,
Is there any update about this issue? (I mean SL3 HTML5 and JS files)
I get the same "ReferenceError" as Chiefy when using GetPlayer() command, as well as lmsAPI and other commands that used to work flawlessly with SL2 HTML5 publications.
Thanks !
Hi Guillaume,
We're still looking into the issues with the JS code and how it's working in Storyline 3 and 360. We'd be happy to take a look at your course too and how it's behaving. Can you reach out to our Support team here?
Related Content
- 6 months ago