A revised SCORM API wrapper

I’ve been a longtime user of the ADL wrapper (with code from the late Claude Ostyn), and to be honest, it’s pretty much met my needs. But I was never completely comfortable with the wrapper for two reasons: 1) The code is hard to read with confusing and overly complicated looking variable names, and 2) the code made heavy use of global variables, which in this Web 2.0 world is a big no-no. Global variables can easily cause conflicts with other scripts and script libraries, and should be avoided as much as possible.

This past week I decided to roll up my sleeves and make a new SCORM API wrapper that takes care of these issues. [ Download wrapper | Documentation ]

Examples of the wrapper in action

I have successfully tested the wrapper with the ADL test suites for SCORM 1.2 and SCORM 2004 rev 3.

Update April 23, 2008: all downloads and demonstration files have been relocated. See the SCORM page for more info.

Feedback?

Now, mind you, I’m not saying the wrapper is perfect — there are still some changes I’m considering — but I think it’s a step in the right direction. I’d love to hear your thoughts on the revised wrapper, especially if you’ve had a chance to test-drive it.

What’s a wrapper?

A “SCORM API wrapper” is a buffer (aka ‘proxy’ or ‘middleman’) that prevents your SCORM course from making direct calls to the SCORM Run-Time Environment (RTE) located on your learning management system.

(For those less familiar with the concept of APIs: API stands for “application programming interface.” An API allows 3rd party developers to tap into specific features of a program or service. For instance, Flickr has become famous for allowing independent developers to create web-based applications that tap into Flickr’s photo hosting services using the Flickr API.)

Why use a wrapper?

There are two really good reasons to use a SCORM API wrapper: 1) advanced error-checking, and 2) ease of maintenance.

Error-checking

If you try to make a call to the SCORM RTE before the course has been initialized (turned on), your call will fail. This means if you try to request the course status or student’s name, your request will not work, and you will most likely NOT receive any error messages telling you what happened.


//This will fail silently if you don't use error-checking
var myvalue = api.GetValue("cmi.suspend_data");

By using a wrapper, you can build ‘checks’ into your code that ensure certain criteria are met before performing a specified action. For instance, the wrapper can ensure your course is properly connected to the SCORM RTE before asking the RTE to give you data.


if (connectionIsActive){
   var myvalue = api.GetValue("cmi.suspend_data");
}

You can also add debugging alerts and statements to help you figure out what has happened when something goes wrong:


if (connectionIsActive){
   var myvalue = api.GetValue("cmi.suspend_data");
} else {
   alert("api.GetValue() failed because the API connection is inactive.");
}

Maintenance

Another great reason to use a wrapper is ease of maintenance. The SCORM RTE has been steadily evolving over the years; for the last few years, the dominant version has been 1.2. However, version 1.3 (later renamed “2004”) has been gaining ground, thanks largely to mandates by the US military that require all e-learning courses used in military training be SCORM 2004-conformant. That’s a LOT of courses, and those big-money contracts are increasing the pace of SCORM 2004 support in both courseware and learning management systems.

What if you hard-coded your SCORM 1.2 calls into your course? SCORM 1.2’s nomenclature is very different from SCORM 2004. This means you’d have to dig into all of your courses and replace every single SCORM 1.2-specific reference to the newer SCORM 2004 nomenclature. Yuck.

What would be easier is using a wrapper to control the SCORM nomenclature for you. Consider this SCORM 1.2 call wrapped in a custom function:


function saveData(){
   api.LMSCommit("");
}

When you change your course from SCORM 1.2 to SCORM 2004, all you’d need to do is change the call in the function from api.LMSCommit("") to api.Commit(""). The code used in your course would be the same (saveData("")), and you’d only need to update your code in one place. This makes upgrading much less painful.

OK, I’m sold on the value of wrappers. Where do I get one?

Chances are you’re already using a wrapper, but probably not to its potential. The ADL has some sample wrappers available on their website, and most commercial SCORM products come with wrappers.

My revision to the ADL wrapper is intended to make it even easier to use and troubleshoot. Best of all, it’s free. 🙂 Give it a whirl! All I ask is for you to give me some feedback; let me know if it works on your particular LMS, or if you have suggestions for improvements.

Update: all demonstration files have been relocated. See the SCORM page for more info.

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

9 Replies to “A revised SCORM API wrapper”

  1. What about if the LMS SCORM adapter has both objects? win.API and win.API_1484_11?

    Than the first found (win.API_1484_11) will be used for communication, and in case you have SCORM 1.2 package, and you are sending SCORM 1.2 commands, than this communication fails.

    Maybe a switch for LMS SCORM API search direction could help.

  2. @michal

    Good catch on the zip file. I knew about it but thought I had fixed it. 😛

    RE: the api, the SCORM 1.2 RTE documentation states that the SCORM 1.2 API should be named API, while the SCORM 2004 documentation states the SCORM 2004 API should be named API_1484_11.

    The ADL’s SCORM 1.2 documentation (SCORM_1.2_RunTimeEnv.PDF, section 3.3.5.1) states: “The API adapter must be accessible via the DOM as an object named ‘API’.”

    The ADL’s SCORM 2004 documentation (SCORM_RunTimeEnv.PDF, section 3.2.1) states: “To provide for an interoperable means to locate the API Instance, the LMS’s API Instance must be accessible via the DOM as an object named API_1484_11.”

    Why API_1484_11? “SCORM describes the IEEE 1484.11.2-2003 Standard for Learning Technology – ECMAScript Application Programming Interface for Content to Runtime Services Communication as used in SCORM.” (emphasis added)

    The imsmanifest.xml file informs the LMS which version of SCORM will be used for a course.

    There *is* the possibility an LMS that supports both SCORM 1.2 and SCORM 2004 will make both versions of the API visible to the course, but I don’t think this is the intended behavior, and this can only be tested by taking the wrapper from LMS to LMS.

    I’ll certainly test this as much as I can. If you (or anyone reading this) finds this to be the case, please let me know!

  3. Our LMS is Saba 5.3 sp2, and it supports 2004 – so we have both of the APIs visible. But the AS2/SCORM 1.2 version failed until I changed your JS wrapper to only use the win.API and not win.API_1484_11.

    It wouldn’t even import the AS3/2004 demo file. I’m fairly certain that the 2004 features of this LMS are limited – I’m only just now starting to look into them.

  4. @matt

    thanks for the info.

    i was afraid this might happen, so i’ve been considering modifying the wrapper to include an “override” setting that lets you programatically select which version of SCORM your course is using.

    i’ll see if i can get it done later today or maybe tomorrow.

  5. Hi Philip:

    I’m trying to build a .Net LMS and am having trouble figuring out how to create an API Adapter object that can be called by the content. Do you known any code samples that might help me get started?

    Regards,
    Roger

  6. You could try deconstructing something like the Reload SCORM Player:
    http://www.reload.ac.uk/new/scormplayer.html

    Basically the SCORM API — the connection between the course and the LMS — is required to be JavaScript. How you get the data from JavaScript into your database is up to you. I know people have often used web services and AJAX, but I don’t deal with the server-side stuff much, so I’m probably not the best person to ask. 🙂

    I do know that the SCORM documentation doesn’t specify any of the backend stuff aside from some database particulars (naming conventions for data fields, data types, size constraints). They tried to remain agnostic in terms of server-side scripting and programming languages.

  7. I have used Articulate Presenter. I have Designed PPT and published it I got an put as ZIP file as scorm 2004, scorm 1.2 and AICC so i ahve now SCORM 1.2 or 2004.

    But now i want to now about Scorm Wrapper. now we have PPT, WRF and WMV format Webinars we want a Scorm Wrapper.

    Help me out what it dose in which format and where do we get i found a website for Scorm Wrapper

    http://www.scorm.com/scorm-explained/scorm-resources/simple-api/

    Its price is too high. this there any software to Wrap the content for LMS please help me out…

    Am getting only about what is SCORM and SCORM WRAPPER am not getting information about Scorm Wrapper software or where we can get it Please help me out…

  8. @dinesh that’s a big task. i will not be able to help you, sorry.

    if you don’t want to pay someone to build you a SCORM wrapper for plain content, you’ll need to learn more about SCORM and create your own wrapper. the official SCORM documentation is at http://www.adlnet.gov. scorm.com has excellent resources, and you might find some of Claude Ostyn’s material useful, too.

Comments are closed.