Forum Discussion
Custom resume functionality Storyline
Hello SamHill,
Thank you so much for your advise!
I'd really appreciate if you could share the example, so I have a direction to start.
Hi Miguelvanden090 I had a look for anything I could share, and the best I have, which will definitely get you started is a psuedo SCORM 1.2 API. This one was used to run content locally, and so always provided static values for things like student name, id, time etc. This could definitely remain as is, but it could be worth while to modify the code so it pulls the user data from your database, where there is information you could logically put in there. The key SCORM data model you need to work with is the suspend_data, as this stored all of the resume data for Storyline course.
This script would need to be initialised before the Storyline content. The constructor should retrieve any dynamic data from the database first, and then when the Storyline SCORM content runs, this API must be findable by the find API algorithm. Placing the API in the parent, or opener (if appliable) should do the trick, but the API must always be available while the content is running. It will depend on how the courses are presented to the user the method you would use, but a common one is adding the script to and HTML page, which just contains an iframe that loads the SCORM content into it. The API is then easily findable in window.parent.
The data I would recommend that you make dynamic, in the interest of the SCORM course running and resuming as expected is:
#lesson_status (initialised as "not attempted", updated by the content to "incomplete" and then set to "pass/failed/completed" depending on course configuration)
#entry (not set by content, but should be updated to "resume" once run for the first time)
#suspend_data (set by the content - key data for resuming the content)
As mentioned, you could also consider #student_name (formatted "Lastname, Firstname") and student ID (just a unique ID such as email address, or system generated ID).
// Pseudo-SCORM 1.2 API Class
class API {
// Private fields for encapsulation
#core_children = "student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,exit,session_time";
#student_id = "defaultID";
#student_name = "";
#lesson_location = ""; // I'm pretty sure Storyline doesn't use this. Most SCORM courses use this to store location, but Storyline uses suspend_data.
#credit = "credit";
#lesson_status = "not attempted";
#entry = "ab-initio";
#score_children = "raw";
#score = "";
#exit = "";
#session_time = "";
#total_time = "0000:00:00.00";
#suspend_data = "";
#launch_data = "";
#comments = "";
constructor() {
// You need to pull all dynamic data from the database and update the instance variables
// #student_id (optional)
// #student_name (optional)
// #lesson_status (can be left as "not attempted" if not set)
// #suspend_data
// #entry (can be left as "ab-initio" if suspend_data is empty, or "resume" if suspend_data is not empty)
}
// cookie = course title to make it unique to this course + cmi + data
LMSSetValue(cmi, data) {
// console.log('LMSSetValue: '+cmi+' : '+data);
switch(cmi) {
case "cmi.core.lesson_location":
this.#lesson_location = data;
break;
case "cmi.core.lesson_status":
this.#lesson_status = data;
break;
case "cmi.core.score.raw":
this.#score = data;
break;
case "cmi.core.exit":
this.#exit = data;
break;
case "cmi.core.session_time":
this.#session_time = data;
break;
case "cmi.suspend_data":
this.#suspend_data = data;
break;
case "cmi.comments":
this.#comments += data;
break;
}
// **** Now you must update the database with the new values **** //
}
LMSGetValue(cmi) {
let data;
switch(cmi) {
case "cmi.core._children":
data = this.#core_children;
break;
case "cmi.core.student_id":
data = this.#student_id;
break;
case "cmi.core.student_name":
data = this.#student_name;
break;
case "cmi.core.lesson_location":
data = this.#lesson_location;
break;
case "cmi.core.credit":
data = this.#credit;
break;
case "cmi.core.lesson_status":
data = this.#lesson_status;
break;
case "cmi.core.entry":
data = this.#entry;
break;
case "cmi.core.score._children":
data = this.#score_children;
break;
case "cmi.core.score.raw":
data = this.#score;
break;
case "cmi.core.total_time":
data = this.#total_time;
break;
case "cmi.suspend_data":
data = this.#suspend_data;
break;
case "cmi.launch_data":
data = this.#launch_data;
break;
case "cmi.comments":
data = this.#comments;
break;
}
// console.log('LMSGetValue: '+cmi+' : '+data);
return data;
}
LMSInitialize(str) {
return true;
}
LMSCommit(str) {
return true;
}
LMSFinish(str) {
return true;
}
LMSGetLastError() {
return 0;
}
LMSGetErrorString(error) {
return;
}
LMSGetDiagnostic(error) {
return;
}
}
Related Content
- 5 months ago
- 5 months ago