Forum Discussion
lmsAPI Functionality in HTML5 Output
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.
- AdamTrosperCommunity Member
Technically, every variable gets tracked to the LMS, but it's just a matter of whether or not the LMS can report on it in a readable fashion. Assuming you are using SCORM, everything gets stored in SuspendData, but quiz elements get stored as Interactions, which is why the LMS can report on the data more robustly. I would try Googling "Storyline Submit Interactions" and see what you can find as far as that goes. You might be able to restructure the questions to all be submitted as interactions, but then use the Complete Course method that Karuna suggested for the results.
- AstutisArtic013Community Member
I think the questions are currently being submitted as interactions, as they're using the built in quiz functionality. However, for them to work I need to track using quiz results, which overrides any complete course trigger or JavaScript code.
I may just have to sacrifice the success criteria, as everything else is working fine.
Thanks everyone for the suggestions and help though.
- StevenPascoe-ccCommunity Member
Hi, can anyone help me?
This code works for Scorm 1.2.
How do I convert this to Tin Can?var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;// all done if no parent
else if (win.parent == win) return null;// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);Appreciated!
- AdamTrosperCommunity Member
Hey Hila!
It sounds to me like you are trying to do something that is better reserved for calls outside of the courseware itself (perhaps calls/reports that should be happening from the LMS instead). Without knowing exactly what you are trying to accomplish, what data schema the external system is expecting, etc., etc., etc., it's hard to know where to even start.
I think if I were in your shoes, I would contact someone at the external system and see what data/parameters they are even looking for, and in what format they need it sent. I would recommend reaching out to them to get more info on what they are expecting, and maybe ask them if they have a preference between AICC, SCORM 1.2, SCORM 2004, or something else entirely. They should be able to help you determine the best approach that you should take.
In terms of converting between SCORM 1.2, SCORM 2004, AICC... I'm assuming you are doing this in Storyline, since you are on a Storyline forum. It should be a simple change in the Publish settings (LMS tab).
- JoeFrancisCommunity Member
A learner's email address isn't part of the SCORM 1.2 or 2004 data model.
SCORM Run-Time Reference Guide
If your LMS uses the learner's email address as the student ID (cmi.core.student_id / cmi.learner_id), you would be able to pull that. But the last few enterprise LMS' I've been on either use the Employee ID or the next available ID in the database as the Student ID.
- PaulSchneiderCommunity Member
For #1 and #2 - I thought those are system variables built into Storyline - so no javascript is needed - but I could be wrong.
- ChrisPimCommunity Member
Hi,
I am using Moodle and Storyline 360
I have this code which works for Flash - get username. This populates a field in Storyline with variable %newName%
-----------------------
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];player.SetVar("newName", newName);
--------------------------------
It used to work in Storlyine 2 for HTML5 but does not anymore with Storyline 360
How would I use your workaround with var lmsAPI = parent;
...in my code above so it works in HTML5 and Flash on Moodle?
Any help greatly appreciated.
Chris
- AdamTrosperCommunity Member
I would try updating it like this:
var player = GetPlayer();
var lmsAPI = parent;
var myName = lmsAPI.GetStudentName();
...This is going to work 99% of the time.
- ChrisPimCommunity Member
OK I tried this...
var player = GetPlayer();
var lmsAPI = parent;
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);With no success in Moodle. Any suggestions?
Chris
- ChrisPimCommunity Member
Yes SCORM 1.2 HTML ouitput only
I tried:
-------------------
var player = GetPlayer();
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);---------
Sadly still not working. Thanks for trying.
I know nothing abot Moodle really. What would I need to ask my Moodle developers to check and find out? This would be very helpful for the next step.
Chris
- AdamTrosperCommunity Member
In the code you tried, did you include the function from my previous post?
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}