lmsAPI Functionality in HTML5 Output
Apr 28, 2017
Hey all,
I've been searching through the forums and haven't been able to find anything solid. I'm using Storyline 360, outputting to both HTML5 and Flash to cover my bases, since the audience doesn't have dedicated machines that they are taking this from.
I'm relying heavily on external Javascript that I wrote, which I have tested thoroughly in the Flash version, and it works fine. But when it comes to the HTML5 version, it stops working. I've proven that I'm able to get into the Javascript functions, like I would expect, but it appears that lmsAPI is no longer available to the course.
Are there any similar functions to those of the lmsAPI functions in the HTML5 output?
Specifically, I'm looking for a way to do the following in HTML5:
- Get the StudentID from the LMS.
- Get the StudentName from the LMS.
- Manually call SetStatus("completed"); to pass a completion to the LMS on the last page of the course.
146 Replies
Hi Helene,
SetStatus("completed") only works with the Flash version because the HTML5 version doesn't end up using the lms.js file. So, you will have to bypass that function and directly call the function that the SetStatus function would have called... Try this:
Awesome!!! that worked!
thanks so much!
Hi guys... I am trying to create a certificate on a slide, following the assessment that will pull variables from SCORM (student name / today's date) and then allow me to print.
I've seen people mention to Print that you would need a flash object. Our organization no longer supports Flash at all.
Any help?
Try this:
---------------------------
if (document.location.href.indexOf('html5') < 0) {
GetPlayer().printSlide()
} else {
if(!window.hasPrintStyle){
window.hasPrintStyle = true;
var css = "@media print {div.controls.grid-row.inflexible,div.area-secondary.cs-left.inflexible,header.header-primary.centered-title.extended-height,div.presentation-wrapper:after {display:none !important; visibility:hidden !important;}}";
head = document.head || document.getElementsByTagName('head')[0];
style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet){
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
}
window.print();
}
If that doesn't work, the way that I've printed in the past was to use Execute Javascript to essentially create a new window with the certificate I wanted to print created on it using HTML. The one piece of advice I have about printing is that different browsers handle printing just a little differently, and you will have to account for that. Also, I always include a "print" button on the page that will disappear when clicked, in case they want to print a second copy, the cancel the print job, etc.
Matthew...THANK YOU
Hi, please could you let me know if the bug relating to passing completion status to the LMS with HTML5 output, has been fixed now. Thanks.
Hi Stephanie,
The issue with Javascript code no longer sending completion status to LMS in Storyline 360 and using HTML5 output, is still an open issue based on the changes made to the publishing engine in Storyline. Our team is looking at ways that we could incorporate these features for you and others to use in the future, but in the meantime you'd want to use the built in completion elements from the results slide or publishing properties.
Hi Ashley
Thanks for the information. There was an issue with the built in Scorm reporting for HTML5 courses, which is why I was trying to do down the javascript route. However, I have been contacted by your support team to say that this has been fixed in the update made available this evening. Hopefully that will sort the problem as I am very keen to move to HTML5 output asap due to the ever increasing restrictions on Flash player use.
Thanks again
Sounds great Stephanie. Thanks for the update.
It looks like your email signature came through when you replied via email. You can remove that if needed by clicking ‘Edit’ beneath your response. Here’s a quick Peek video if you need help.
Hi Matthew and Stephanie,
Just a quick clarification here - the issue fixed was Javascript triggers that would set Storyline variables based on using the LMS API. So that would be pulling data from the LMS such as the users' name, etc. This does not change the behavior for setting the completion using Javascript in Storyline 3/360. That is something our team is still looking at based on the changes made to our publishing engine, and ways it could be added as a new feature for Storyline.
Hi Matthew,
It should work as long as it's using the lmsAPI piece. Let me know if you run into any trouble testing it and I can get it connected with our team.
I know its been a while Adam since you responded to this post - but thank you (and Chris) for working through a solution - It has saved me needing to review and update weeks worth of projects.
Thanks!!!
Not a problem! I'm glad this has helped so many people!
I figured once I had a solution figured out, I should share with the community and also reach out to the Articulate team in hopes that they could fix the problem in future releases.
Thank you so much Matt!
Thanks Matthew. for this help
Thanks Adam! you saved my day.
Just found this post and it helped me solve an issue I was having after stripping the Flash from a Storyline 2 published course.
Many thanks
Happy to hear that Steve and thanks for the update!
Hi Matt, hope you're well!
I've been trying to use this when publishing html5 only via scorm2004.
I keep getting a message about blnstatuswasset = false.
Do I need to do anything different to this as I'm using scorm2004? Xxx
BUUUUMMMP!
Adam - much appreciated for your contribution to what is probably the Articulate Hack of the Year - which is a prestigious award considering how many hacks are required.
Speaking of hacks...
Articulate Staffers... has there been any progress on the above mentioned and extremely well articulated feature suggestions? Articulate 360 offers a few wonderful new features (closed captions!!), but to completely break the users' ability to effectively communicate with the LMS is simply madness! Madness I say!
You should add the above mentioned action triggers. It will take a few days for your skilled dev team to do, and will literally retain many paying customers. Ready? Go!
Meanwhile... I think I have the featured workaround working on my Moodle System thanks to Ad-rock's self-calling Javascript function, but I have yet one remaining thorn in my side.
I can't, for the life of me, change the cmi.core.lesson_status to anything other than Failed (SL360, HTML5, Moodle). I can set the score. I can get a li'l tick in the li'l "you did a thing" box in Moodle, but if I view the attempt details, it's cmi.core.lesson_status = failed.
I dunno.
My JS snippet is:
var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
lmsAPI.SetScore(player.GetVar("percentage"), 100, 0);
if (player.GetVar("percentage") >= 70)
{
lmsAPI.SetReachedEnd();
}
That last command, I've also tried:
a) lmsAPI.SCORM_CallLMSSetValue("cmi.core.lesson_status", "completed");
b) SetStatus("complete");
c) lmsAPI.SCORM_SetCompleted();
Any ideas?
Hi Shane,
Thank you for the kind words! My guess is that you might be using a "Passed/Failed" instead of a "Completed/Failed".
I would recommend trying to call the following instead:
lmsAPI.SetPassed();
If you are looking for the different options you should be able to use with lmsAPI, here is the switch statement in the lms.js code, which I used as the basis of the code I wrote:
Good luck!
Hi folks,
Thanks for your feedback here. I wanted to confirm that a new 'Complete Course' Trigger is currently in Beta and is on track to be released in an upcoming Storyline 360 update.
As you'd expect, the new trigger gives you the flexibility to specify all sorts of custom completion criteria from inside Storyline, and sits alongside the slides viewed and results slide as a third way of tracking course completion with an LMS.
We'll keep you posted and let you know once the update is available for download.
- Simon
That's awesome Simon. Apologies for my post being a tad terse. I was in the throes of troubleshooting frustrations.
I solved my problem by the way.
I was getting a persistent "Failed" status and couldn't work out why.
Turns out, even though my publish settings were tracking on Slide Views, an unused Results Slide was unwittingly setting a Mastery Score of 100. So even though the users couldn't navigate to this results slide, the mastery score was being set in imsmanifest.xml and my activity status was being overridden as failed.
As soon as I disabled all options on the results slide, the code mentioned in my post aboved worked as intended.
Looking forward to this SL360 update!
This post was removed by the author