Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

SCORM 1.2 player in the Mobile app

From MoodleDocs
Revision as of 20:07, 3 December 2015 by Juan Leyva (talk | contribs)
SCORM 1.2 player in the Mobile app
Project state In Progress
Tracker issue https://tracker.moodle.org/browse/MOBILE-938
Discussion {{{discussion}}}
Assignee {{{assignee}}}


Introduction

SCORM module support in the mobile app is one of the most requested features by users, specifically, the ability to play SCORM packages offline in the mobile app including synchronization of the tracking data once the device is online again.

In this document we are going to do a brief analysis about what will be needed to implement in both the Mobile app and Moodle code to add support to play SCORM packages.

Moodle Mobile

The current Moodle Mobile app is an HTML 5 application that uses other common web technologies. It is a client application that uses REST protocol web services to send and get information from the Moodle installation. Recently, we have started working on another version of this Moodle Mobile app using Ionic framework with AngularJs to overcome the current mobile application’s technical problems.

What is SCORM?

SCORM stands for Sharable Content Object Reference Model. It is a common standard introduced by Advanced Distributed Learning. Those standards facilitate the use of SCORM based content in any management system without any hassle. SCORM consists of two main parts: Run Time Environment and Content Aggregation Model.

Run Time Environment

This describes how the content of the SCORM package should behave when it is loaded by a learning management instance. In this project, we will mainly tackle this section. The run time environment consists of 8 main functions that facilitates the access to the LMS.

Content Aggregation Model

This describes how a person who is creating SCORM packages should package that content according to the SCORM standards.

The 8 main functions in the run time environment need to be implemented as a Javascript API. Since we are doing this project using AngularJs, this should be done by fixing it to an Angular Module. This Angular module will have all the necessary controllers and services to handle communication between an external SCORM package and the Moodle site.

Functionalities

The minimum functionalities to be supported would be:

Support for SCORM 1.2 packages only Support for zip SCORM packages only (no alternative methods for adding SCORM contents) Complete support for the SCORM 1.2 API runtime Support for playing packages offline

Technical Overview

There are currently several Javascript SCORM players with basic support for SCORM 1.2:

The aim of this project is to improve and package inside an AngularJS module one of those players and include it in the official Moodle Mobile app. We are talking about AngularJS because the new version of the official Mobile app (Moodle Mobile 2) will be build using the Ionic framework that is based in AngularJS

In order to be able to support playing SCORM files from a Moodle site in the app, we need to develop new code in both Moodle and Moodle Mobile and also do some changes in the current code:

In Moodle:

A new set of external functions in the SCORM module to be used as Web Services by the app in order to:

  • Retrieve a list of all the SCORM modules inside a course
  • Retrieve tracking information from a particular user in a SCORM package (e.g. list of attempts, current attempt status, etc..)
  • Send tracking information of a particular user in an existing SCORM package

Some modifications in the current SCORM module (described below) to allow teachers to choose if they want make a SCORM module available to mobile users and then allow downloading full SCORM packages.

In Moodle Mobile:

A generic AngularJS SCORM player module that should be able to parse the imsmanifest.xml file, display the SCORM and navigation TOC and implement a local SCORM runtime A new addon for the SCORM module that will contain the AngularJS SCORM player and will perform tasks like downloading the SCORM zip package, retrieving the SCO tracking information from Moodle and synchronizing the results.

Moodle requirements

SCORM module changes

In order to make possible to play SCORM packages in online and offline modes, the Mobile app needs to download the complete zip SCORM package and extract to the local sdcard/storage system. This means that we need to add support to downloading the zip packages via the SCORM pluginfile callback, but this presents some problems: There are several ways for adding SCORM packages into a course, we are going to support only zip packages uploaded and those downloaded via URL to a zip (filesystem repositories won’t be supported either).

Privacy/security: Sometimes, teachers or administrators don’t want to share the complete zip packages, we will need a new SCORM module setting called “Allow to download complete SCORM packages” or something similar so a teacher can disable the zip packages download at any time. For existing packages this option should be disabled, but for new it should enabled by default. Package size: Sometimes SCORM packages are huge; the storage capacity in mobile devices is limited so it will be necessary to detect the zip package and the free space available in the device

The Mobile app will notify the user if the SCORM package is supported, checking if the package was uploaded or downloaded via URL, if the “Allow to download complete SCORM packages” is enabled, and if there is enough free space in the device.

Why is it mandatory to download the complete zip SCORM package?

The app does not support SSO to Moodle, so it won’t be possible just to embed the SCORM player into an iframe We can try to parse the imsmanifest.xml and then display in an iframe the requested files pointing to the Moodle pluginfile.php file, but this presents two problems:

We’ll need to parse/pre-process all the HTML files to fix the links to point to http://yourmoodle.com/webservice/pluginfile.php/zz/yy/file.html?token=authtoken We will be sending lots of requests to the Web Server, exposing the authentication token (since it’s needed to validate the user credentials)

New external functions

mod_scorm_get_scorms_by_courses Parameters: list of course ids Returns: A list of SCORM packages module settings in the specified courses, including only the settings the user may see (according to his permissions). This external function will also return information like the size of the zip package and a md5 hash to detect if the package has been updated. Via this external function, we will be able to check if the SCORM package can be downloaded and played in the app.

mod_scorm_get_scorm_attempts Parameters: scormid and userid Returns: A list containing information of all the attempts done by the specified user id This will be used to know the current attempt status for the user (last attempt, etc..)

mod_scorm_get_scorm_scoes Parameters: scormid Returns a list of scoes inside the specified scorm

mod_scorm_get_scorm_default_values Parameters: userid, attempt Returns all the user tracks for all the scorm scoes (including objectives and interactions) This will be used for preparing the API runtime data

mod_scorm_insert_scorm_track Parameters: scoid, userid, attempt, element, value Inserts track information about a SCO Returns: true or false (success or not)


Moodle Mobile requirements

SCORM player

The SCORM player will be an AngularJS module integrated in a Mobile app addon. It will be responsible for: Parsing the imsmanifest.xml file in order to display the available Organizations and Structures inside the package. Displaying a basic SCORM player with a basic menu tree. Implementing a basic runtime support in order to retrieve the SCOs tracking information (including objectives and interactions) and sending tracking information too.

The SCORM player will be an agnostic AngularJS player that will communicate with the Mobile app SCORM add-on via the SCORM runtime.

Moodle Mobile SCORM addon

A new addon for the SCORM module that will contain the AngularJS SCORM player and will perform the following tasks: Downloading and synchronizing the SCORM zip package Unzipping the package into the device persistent storage Populating the SCORM SCO’s default tracking information Storing and synchronizing tracking information with Moodle via Web Service

In order to do that, the SCORM player (AngularJS module) will have to communicate with the addon via the API runtime (functions LMSInitialize, LMSGetValue, LMSSetValue)

Use cases

Online

Scenario:

A teacher has created a Moodle course including 3 SCORM packages: two packages uploaded via zip and a second package pointing to a imsmanifest.xml file via URL. One of the uploaded packages is around 250MB, the other one around 20MB The teacher has allowed the two uploaded packages to be accessed via the Mobile app. A student opens the course using the Mobile app. He can see listed the 3 SCORM packages, but when he tries to open the linked package he gets a warning message saying that this SCORM package is not compatible with the app. When he tries to open the SCORM package (the one that is around 250MB) he gets a new warning about the size of the SCORM and the current free space (300MB), therefore the user cannot download this package. Finally, he tries to open the last SCORM package, and he sees that this package is compatible with the device. When the user opens the package in the app, the following happens: The app checks if the package was already downloaded, if so, it checks if the checksum is still valid; if it’s not, it downloads the package again. If the package was not downloaded, the app downloads it. The app via the mod_scorm_get_scorm_attempts WS tries to resolve the current attempt for the user (resume, start a new one) The app then retrieves the list of SCOes inside the package via mod_scorm_get_scorm_scoes, and the SCORM SCOes default data via mod_scorm_get_scorm_default_values When this information is ready, the app launches the player that via LMSInitialize will initialize the first SCO data The student does some activities inside the SCORM and some information is stored via LMSSetValue. Once he has finished (or every time LMSCommit happens or iv scorm->autocommit is enabled), the information is stored in Moodle via the mod_scorm_insert_scorm_track Web Service

Offline:

The use case is similar, main differences are: The user needs to previously access to the activity when he is online so the package is downloaded (if the user is offline and it’s the first time he is accessing, he won’t be able to play the package) Once the user opens the SCORM, the app will detect that the mobile device is offline so the app won’t try to synchronize the package, and the attempt information (and scoes and scorm_default_values) will be retrieved from cache or from the app storage (the last values stored will be used). The tracking information will be stored in Moodle and will be synchronized once the user is online.

Synchronization problems

What happens if the attempt already contents data? The scorm_scoes_track has a timemodified field, and only new information will be stored (this will be reported to the user as a problem).

Limitations

  • Support only for uploaded packages, remote zip packages and zip packages in any type of repository supported by Moodle
  • Does not support remote imsmanifest.xml packages or file system repository unzipped SCORMS
  • Does not support opening packages outside the app (in a complete new browser for example)
  • Does not support javascript popups via window.open (Mobile device limitation)