Documentation

Experience API (TinCan)

mAuthor offers the possibility of exporting each presentation's resources individually to a package that implements the Experience API SCORM Profile. These packages can be later imported back to the platform in case of any emergency event.

Exporting

To perform the export, select the "Export xAPI/offline" option from the drop-down menu Export in the top-right toolbar. The presentation export will run in background, and you will receive a notification email when it is completed. Click on a given link, choose a name for your file, and save it to a convenient place on your computer.

Importing

Check the "Importing" section for SCORM Packages.

Package size

Check the "Page size" section for SCORM Packages.

xAPI SCORM profile package contents

Appart from the standard contents of our SCORM Packages, the xAPI package contains the following:

  • tincan.js – a client library implemented by RusticiSoftware
  • xapi.js – Experience API SCORM Profile implementation on top of tincan.js provided by Learnetic SA
  • index.html – an example of how to embed the whole lesson and send proper xAPI statements

xAPI SCORM profile package initialization

This article defines the allowed methods of launching and initializing the xAPI SCORM Profile. Our solution provides capability to launch "Web-Based Activities" which basically allow the setup through the URL encoded parameters and "Out-of-Band Configuration" by configuring the xapi.js library itself on initialization.

The following parameters are configured by default during export:

  • lessonIRI
  • lessonTitle
  • lessonDescription

The following parameters need to be configured by LMS using one of the methods below:

  • endpoint
  • actor
  • courseIRI
  • entry
  • attemptIRI (if entry is 'resume') – see Supporting the SCORM Temporal Model
  • optionally: auth or username/password
  • optionally: courseTitle
  • optionally: courseDescription

For more information on the above mentioned parameters, please refer to Experience API SCORM Profile, TinCan JS and the following reference on xapi.js.

xapi.js Reference

xAPI

Provides the xAPI convenience class for initialization and usage of tincan js. It helps to prepare and send xAPI statements that conform to the SCORM Experience API profile https://github.com/adlnet/xAPI-SCORM-Profile/blob/master/xapi-scorm-profile.md

xAPI~xAPI

xAPI

Kind: inner class of xAPI

new xAPI(cfg)

xAPI convenience class for initialization and usage of tincan js. It helps to prepare and send xAPI statements that conform to the SCORM Experience API profile. (https://github.com/adlnet/xAPI-SCORM-Profile/blob/master/xapi-scorm-profile.md) Constructor Initializes xAPI SCORM Profile implementation. This implementation depends on the availability of TinCanJS library (https://github.com/RusticiSoftware/TinCanJS) and has been tested with TinCanJS build 0.33.0.

| Param | Type | Description |
| --- | --- | --- |
| cfg | Object | Configuration |
| [cfg.attemptIRI] | String | Needs to be provided if this is a resume attempt action. |
| cfg.courserIRI | String | Uniquely identifies the course. |
| [cfg.courserTitle] | String | Recommended if not provided in params. |
| [cfg.courseDescription] | String | Recommended if not provided in params. |
| cfg.endpoint | String | LRS endpoint URL |
| [cfg.auth] | String | Authorization token for the LRS, will be passed in the "Authorization" header. |
| [cfg.username] | String | If no auth token is provided username and password will be user in basic auth. |
| [cfg.password] | String | If no auth token is provided username and password will be user in basic auth. |
| cfg.lessonIRI | String | Uniquely identifies this lesson in the scope of the course. |
| cfg.lessonTitle | String | |
| cfg.lessonDescription | String | |
| cfg.entry | String | "ab-initio" or "resume" |
| cfg.actor | Object | Identifies the user that attempts this lesson within the scope of the LMS. |
| cfg.actor.account | Object | Recommended if not provided in params. |
| cfg.actor.account.homePage | String | User origin, usually location of the LMS. |
| cfg.actor.account.name | String | User identifier. |

xAPI~getParams()

see http://stackoverflow.com/a/2880929

Kind: inner method of xAPI

xAPI~configFromParams([cfg]) ⇒ Object

Composes cfg object trying to take values from GET params, using defaults if provided, for most values. Others such as lesson description should not be passed through GET params, due to it's length.

Kind: inner method of xAPI
Returns: Object - Config object with parameters fetched form the GET params.

| Param | Type | Description | | --- | --- | --- | | [cfg] | Object | Default configuration | | [cfg.attemptIRI] | String | Needs to be provided if this is a resume attempt action. | | [cfg.courserIRI] | String | Obligatory if not provided in params. | | [cfg.courserTitle] | String | Recommended if not provided in params. | | [cfg.courseDescription] | String | Recommended if not provided in params. | | [cfg.endpoint] | String | LRS endpoint URL | | [cfg.auth] | String | Authorization token for the LRS, will be passed in the "Authorization" header. | | [cfg.lessonIRI] | String | Obligatory if not provided in the params. | | cfg.lessonTitle | String | | | cfg.lessonDescription | String | Recommended if not provided in params. | | [cfg.entry] | String | "ab-initio" or "resume" | | [cfg.actor] | Object | Obligatory if not provided in params. | | cfg.actor.account | Object | Recommended if not provided in params. | | cfg.actor.account.homePage | String | User origin, usually location of the LMS. | | cfg.actor.account.name | String | User identifier. |

xAPI~initializeAttempt()

Initializes an attempt. If no attemptIRI is provided one will be randomly generated. Sends an "initialize" statement using Statement API and updates attempt IRI table in the LRS using State API.

Kind: inner method of xAPI

xAPI~saveAttemptState(state)

Sends current lesson's attempt state for storage in the LRS using State API. Current attemptIRI that identifies this attempt is provided in cfg during initialization or randomly generated.

Kind: inner method of xAPI

| Param | Description | | --- | --- | | state | | | state.location | Integer value defining last visited lesson page number. | | state.state_string | Base64 encoded state string from icPlayer. |

xAPI~getAttemptState(cfg)

Fetch state of the current attempt. Either synchronously or asynchronousy - by providing a callback. Uses State API.

Kind: inner method of xAPI

| Param | Type | Description | | --- | --- | --- | | cfg | Object | Configuration | | [cfg.callback] | function | Provide a callback function for asynchronous usage. |

xAPI~resumeAttempt()

Sends an "resume" statement, attemptIRI has to be provided during initialization.

Kind: inner method of xAPI

xAPI~suspendAttempt(score, [state])

Kind: inner method of xAPI

| Param | Type | Description | | --- | --- | --- | | score | Object | Score object for this attempt. Sent with Statement API. | | score.max_score | Number | | | score.min_score | Number | | | score.raw_score | Number | | | score.scaled_score | Number | | | [score.session_time] | String | | | [state] | Object | Last page index and state string. Sent with State API. | | state.state_string | String | State string as returned by the icPlayer. | | [state.location] | Number | Last page index |

xAPI~completeAttempt(score, [state])

Kind: inner method of xAPI

| Param | Type | Description | | --- | --- | --- | | score | Object | Score object for this attempt. Sent with Statement API. | | score.max_score | Number | | | score.min_score | Number | | | score.raw_score | Number | | | score.scaled_score | Number | | | [score.session_time] | String | | | [state] | Object | Last page index and state string. Sent with State API. | | state.state_string | String | State string as returned by the icPlayer. | | [state.location] | Number | Last page index |

xAPI~terminateAttempt(score, [state])

Kind: inner method of xAPI

| Param | Type | Description | | --- | --- | --- | | score | Object | Score object for this attempt. Sent with Statement API. | | score.max_score | Number | | | score.min_score | Number | | | score.raw_score | Number | | | score.scaled_score | Number | | | [score.session_time] | String | | | [state] | Object | Last page index and state string. Sent with State API. | | state.state_string | String | State string as returned by the icPlayer. | | [state.location] | Number | Last page index |