Documentation

SCORM 1.2

This export allows creating offline zip packages with a selected lesson. It contains only the files required to launch the latest icplayer version from mAuthor and additional scripts in index.html file.

Additionally to HTML5/offline format, it has scripts accessing the SCORM communication.

Package structure

/
    icplayer/ - folder with newest icplayer
    javascript/ - folder containing scripts required to launch addons from icplayer and mAuthor additional scripts for index.html file
    pages/ - folder containing main.xml file describing whole content and lesson pages xmls
    resources/ - folder containing media files used by lesson
    index.html - initial launching file for lesson
    imsmanifest.xml - SCORM manifest
    metadata.xml - xml file with lesson metadata

index.html

This is the main initial file to boot the exported package. It contains a portion of scripts required by the player to launch a lesson and some mAuthor additional scripts' functionalities.

<script type="text/javascript" src="javascript/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="icplayer/icplayer.nocache.js"></script>
<script type="text/javascript" src="javascript/semi-responsive-layout-chooser.js"></script>
<script type="text/javascript" src="javascript/screen.js"></script>

Scripts included in the mAuthor export packages:

jquery-1.7.1.min.js - jQuery script for addons
semi-respoinsive-layout-chooser.js & screen.js - additional mAuthor scripts for changing lesson layout depending on device screen.
icplayer.nocache.js - boot file for player application to load icplayer

You can download these scripts here: Scripts

Booting script

function ocOnAppLoaded() {
    player = icCreatePlayer('_icplayer');
    player.load('pages/main.xml', parseInt(location));
    ...

    scorm = getScorm();
    var result = scorm.initializeScormCommunication(window);
    if (result === false) {
        scorm = getScorm_1_2();
        scorm.initializeScormCommunication(window);
    }
    var savedState = scorm.loadState();
    if (savedState) {
        player.setState(savedState);
    }
    var location = scorm.loadLocation();
    if (location === false) {
        location = '0';
    }

}

This part of a script is required to load a lesson with configuration written in main.xml file. The second part of the script that comes after the 3 dots represents the SCORM communication.

function doUnload() {
    var end = new Date().getTime();

    // This ensures that Player knows to update score before leaving page, event for score type FIRST.
    if (player.hasOwnProperty('forceScoreUpdate')) {
        player.forceScoreUpdate();
    }

    var ps = player.getPlayerServices();
    var utils = new PlayerUtils(player);
    var presentation = utils.getPresentation();
    var score = utils.getPresentationScore(presentation);
    for(var i = 0; i < score.paginatedResult.length; i++){
        var s = score.paginatedResult[i];
        scorm.setPageName(i, 'Page_' + s.page_number);
        scorm.setPageMinScore(i, 0);
        scorm.setPageMaxScore(i, 1);
        scorm.setPageRawScore(i, s.score);
        scorm.setPageScaledScore(i, s.score);
    }

    var _rawscore = score.scaledScore * 100;
    var rawscore = Math.round(_rawscore);

    scorm.setMinScore(0);
    scorm.setMaxScore(100);
    scorm.setRawScore(rawscore);
    scorm.setScaledScore(_rawscore/100);
    scorm.setSessionTime(end - start);
    scorm.saveState(player.getState());
    scorm.saveLocation(ps.getCurrentPageIndex());
    scorm.setCompleted();
    scorm.terminateScormCommunication();
    scorm.commitScormCommunication();
}

The scorm communication is used in doUnload function which sends the lesson state and score before closing the lesson.