SCORM API Wrapper updated to auto-handle exit and status

The SCORM API wrapper (v1.1.7) has been updated to automatically set the initial course status and the exit status.

The point of my SCORM API wrapper is to make working with SCORM easier. These two new functions are intended to ensure you follow best practices with your SCORM code while reducing the amount of tedious code you will need to write for your course.

Setting the initial course status

Even though there are many ways to use SCORM, one task every course should handle is changing SCORM’s initial state of “not attempted” (or sometimes “unknown”) to “incomplete”. The logic being that if the learner launched the SCO, the lesson can be considered ‘started’ but not completed yet. To meet this need, the following logic has been added to the wrapper:

  • Upon connection to the LMS, the wrapper will automatically request the course status.
  • If the course status is “not attempted” or “unknown”, the wrapper will instruct the LMS to set the status to “incomplete”.
  • If the reported status was anything other than “not attempted” or “unknown”, the wrapper will not make any changes.

The wrapper does not automatically handle setting a completion status at the end of a course.

This feature is compatible with both SCORM 1.2 and SCORM 2004, and is enabled by default.

In some cases, you might not want the course to be set to incomplete until after some kind of action has been taken within the course. If that’s the case, you can disable the feature by simply adding this line of code to your JavaScript before calling pipwerks.SCORM.init():

pipwerks.SCORM.handleCompletionStatus = false;

Setting the exit status

As I mentioned in my previous post, using cmi.core.exit (SCORM 1.2) and cmi.exit (SCORM 2004) is a good idea, and one that’s easily overlooked. If you don’t explicitly set the exit status to “suspend” for an incomplete course, the LMS is supposed to consider the course complete, and make the suspend_data unavailable. Simply stated, forgetting to set the exit status can really muck things up!

To help ensure your exit status is always set, I’ve added the following logic to the wrapper:

Upon terminating the course session (pipwerks.SCORM.quit()):

  • If the exit status has already been set by the course, do nothing.
  • If the exit status has not been set, check the course status, then:
    • If the course has been set to completed (and/or “passed” in SCORM 1.2), then automatically set the exit mode to “logout” (SCORM 1.2) or “normal” (SCORM 2004).
    • If the course has not been set to completed (and/or “passed” in SCORM 1.2), we assume the learner will be coming back to complete the course at a later time. Therefore, we will automatically set the exit mode to “suspend”.

This feature is compatible with both SCORM 1.2 and SCORM 2004, and is enabled by default. If you wish to disable the feature for any reason, simply add this line of JavaScript to your code before calling pipwerks.SCORM.init():

pipwerks.SCORM.handleExitMode = false;

Get the latest version of the wrapper

You can download the latest version of the wrapper (and other goodies) from the downloads page.

New SCORM ebook coming soon!

I'm writing an ebook explaining how to build an HTML-based SCORM course. Subscribe to be notified when it's ready, as well as receive early bird pricing and some free goodies!

No spam, no sharing your email address, unsubscribe at any time. Powered by ConvertKit
Advertisements

8 Replies to “SCORM API Wrapper updated to auto-handle exit and status”

  1. Thanks for this wrapper Philip, it has made integrating SCORM into this lesson for my client much simpler than I thought it was going to be.

    I do have one question on it however. When the trainee closes the page via the ‘X’ button or alt-f4 etc, I want to set certain parameters in the lms (session_time, exit, etc). I have an onUnload event calling a function that calls some of the function in the SCORM wrapper, but nothing seems to save. (I am testing in the Reload player).

    I was wondering if you had any pointers to get this to work? Also, if this is not a “standard” implementation (this is the first time Ive worked with SCORM) how would something like this be handled?

    Thanks

  2. Michael,

    If your targeting the IE browser, such as used by DoD as the standard, you can use a BeforeUnload event to do a Setvalue of your variables and then commit, although an LMS finish/terminate is by default considered a commit action, sometimes onunload events are lost in transit as the LMS is closing the SCO session. For in IE, I believe the BeforeUnload event must fire before the OnUnload event, this gives the browser enough time to help ensure all cmi.data is committed properly. Just a suggestion.

    1. ‘passed’ is only accepted when using cmi.success_status, not cmi.completion_status. see the official SCORM RTE documentation on the ADL site for specifics.

  3. hi philip!
    Im trying the Scorm 2004 with Flash AS3 for Moodle.
    It works great! But I have a problem to set the total time.
    In flash I have a timer, and when you click a “Finish” bottom I put:

    success=scorm.set(“cmi.session_time”,”myTimer”);
    console(“scorm.set(‘cmi.session_time’, ‘myTimer’): ” +success);

    In the console appers – session_time – false.

    Do you know how it works?

    GRACIAS !

    Emiliano – Argentina

Comments are closed.