SCORM 1.2 API Examples/Tutorials
Asked Answered
T

4

7

I have spent a considerable amount of time searching for SCORM 1.2 API tutorials/examples, which turns out to be quite a difficult task.

The only sample I have found is this: http://www.vsscorm.net/2009/05/30/ground-rules/

It is a solid tutorial but I would like to find some more information from other sources.

All suggestions are appreciated.

Talion answered 2/3, 2015 at 19:8 Comment(0)
B
15

Like Andrew mentioned it is really hard to fully implement SCORM yourself. I believe Moodle doesn't even support Scorm 2004.

AICC is extremely easy to implement by comparison but it harder to do redirects on completion etc.. and has less functionality.

In my system I have implemented the minimum set of functionality to support simple courses generated with tools like Articulate. Different courses call the api in a different order or get/set different values in the model so you would want to test any new course formats closely. This is what I found to be the hardest part is compensating for the different behavior exhibited by different courses.

The vsscorm you mentioned is actually the best step by step explanation I have found on how to implement the server side I think he got up to 60 posts as he implemented more and more.
http://www.vsscorm.net/

Once you get it communicating with the server the Rustici docs and Run-Time API reference is very helpful for referencing model value descriptions and default values
http://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/

Pipwerks has some interesting tools and blog posts though they are mostly focused on course creation.
http://pipwerks.com/downloads/

Also the ADL docs but it's been a long time since I looked at them. http://www.adlnet.gov/scorm/scorm-version-1-2/

If you download the Scorm 1.2 version (Basic Run-Time Calls) and place the code posted below in an html file in the root of the course then open that page in the browser via a web server it will make the course think it's inside an LMS enough to not complain and will log all the api calls it makes.
http://scorm.com/scorm-explained/technical-scorm/golf-examples/

<html>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script>
        var API = {};

        (function ($) {
            $(document).ready(setupScormApi());

            function setupScormApi() {
                API.LMSInitialize = LMSInitialize;
                API.LMSGetValue = LMSGetValue;
                API.LMSSetValue = LMSSetValue;
                API.LMSCommit = LMSCommit;
                API.LMSFinish = LMSFinish;
                API.LMSGetLastError = LMSGetLastError;
                API.LMSGetDiagnostic = LMSGetDiagnostic;
                API.LMSGetErrorString = LMSGetErrorString;

                window.open("shared/launchpage.html", "popupname","resizable,scrollbars,status");
            }
            function LMSInitialize(initializeInput) {
                displayLog("LMSInitialize: " + initializeInput);
                return true;
            }
            function LMSGetValue(varname) {
                displayLog("LMSGetValue: " + varname);
                return "";
            }
            function LMSSetValue(varname, varvalue) {
                displayLog("LMSSetValue: " + varname + "=" + varvalue);
                return "";
            }
            function LMSCommit(commitInput) {
                displayLog("LMSCommit: " + commitInput);
                return true;
            }
            function LMSFinish(finishInput) {
                displayLog("LMSFinish: " + finishInput);
                return true;
            }
            function LMSGetLastError() {
                displayLog("LMSGetLastError: ");
                return 0;
            }
            function LMSGetDiagnostic(errorCode) {
                displayLog("LMSGetDiagnostic: " + errorCode);
                return "";
            }
            function LMSGetErrorString(errorCode) {
                displayLog("LMSGetErrorString: " + errorCode);
                return "";
            }
            function displayLog(textToDisplay){
                var loggerWindow = document.getElementById("logDisplay");
                var item = document.createElement("div");
                item.innerText = textToDisplay;
                loggerWindow.appendChild(item);
            }
        })(jQuery);
    </script>
    <div id="logDisplay">
    </div>
</html>
Blum answered 4/3, 2015 at 3:56 Comment(3)
It's weird that none of these LMS functions are expected to be asynchronous.. Are you supposed to make synchronous http calls just so you could return the correct value or?Blackpoll
@pootzko Yes they work synchronously. Synchronous calls were not frowned upon in October 2001 when the 1.2 spec was defined. Keeping a client side dictionary of values for fast get/set and a queue of changes that are flushed to the server on LMSCommit and LMSFinish would likely minimize blocking.Blum
Heh, thanks for the reply. Yes I know this was ok in 2001, but considering how popular the standard is, I would think it would get updated at some point. Oh well. :)Blackpoll
R
2

Are you looking to create a SCORM player or are you creating courses? We have some great course samples here:

http://scorm.com/scorm-explained/technical-scorm/golf-examples/

We also have some good documentation on our site as well:

http://scorm.com/scorm-explained/scorm-resources/

Let me know if you have specific questions, we can certainly try to get you on a path.

Thank you,

Joe
[email protected]

Renshaw answered 2/3, 2015 at 20:33 Comment(1)
A SCORM player. I don't have any specific questions, just looking for tutorials/examples/code similar to the link I have posted.Talion
C
1

I think the main difficulty is parsing the specificaion. Most of SCORM 1.2 is optional, so you can pick and choose what and how much of it you want to support. Triggering error codes, diagnostic messages, validating or not. All decisions you can make. But from a JavaScript perspective its about as easy as Nathan shows, with the exception you need to construct your CMI Object which you can do using JSON as an example.

I set up a similar mimic for running locally here https://github.com/cybercussion/SCOBot/blob/master/QUnit-Tests/js/scorm/SCOBot_API_1484_11.js with SCORM 2004 in mind. The name spaces between the two versions changed so it's not a 1:1. This does not include all the rich rules, validations and error messages commonly thrown by a true runtime, and it wasn't meant to.

Building out a complete Runtime API can be time consuming. You commonly need to blend in Test Driven Development, and shake out the hundreds of pages of the specification.

  1. Set up your API
  2. Set your student attempt
  3. Load your content
  4. Wait for user interactivty
  5. You'll need to post your student attempt on LMSCommit(''). This means commonly a synchronous Ajax Post to your backend. I've seen other LMS systems take a non-cached approach where every LMSGetValue/SetValue is a round trip to the server. SCORM didn't really dictate what was a best practice here, but that much chatter leads to an insane amount of DNS Lag (beach balls, hour glasses) and a weakened user expierience.

There are a lot of use cases, but I wouldn't talk you out of checking it all out. Good knowledge to have regardless.

Compatriot answered 4/3, 2015 at 18:1 Comment(0)
H
0

Building a SCORM player is hard. Are you sure you want to build a SCORM player at this stage of the SCORM specification's lifecycle, especially since there are plenty of commercial and even open source options already in existence? For the open source options, the players are generally embedded into an Open Source LMS so would need to be extracted (or you could just used the OS LMS!)

You may find it beneficial to look up Tin Can API which is a new specification designed to replace SCORM before you invest a lot of time on this. SCORM support is still important in today's world, but knowing about Tin Can might affect your SCORM player build/buy decision; if you're going to be using it for a shorter period of time it makes less sense to build your own.

Heartbeat answered 3/3, 2015 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.