GithubHelp home page GithubHelp logo

pipwerks / scorm-api-wrapper Goto Github PK

View Code? Open in Web Editor NEW
354.0 43.0 125.0 53 KB

The pipwerks SCORM API Wrapper

Home Page: http://pipwerks.com

ActionScript 20.17% JavaScript 60.64% AngelScript 19.19%

scorm-api-wrapper's Introduction

Created by Philip Hutchison, January 2008
https://github.com/pipwerks/scorm-api-wrapper

Copyright (c) Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/

Inspired by APIWrapper.js, which was a demo file created by the ADL and Concurrent Technologies Corporation.

The SCORM.API.find() and SCORM.API.get() functions are based on ADL code, which was modified by Mike Rustici (http://www.scorm.com), then further modified by Philip Hutchison.

WARNING: Use at your own risk! These files are provided as-is with no implied warranties or guarantees.

##Background

These wrappers are intended to make your life easier so you don't need to be a SCORM expert to add SCORM support to your e-learning course.

The SCORM API wrappers are an abstraction layer that makes adding SCORM code to your course a much simpler, less confusing task. They provide simple logic and error-checking for your course's SCORM code, and include some auto-handling, such as setting cmi.exit (aka cmi.core.exit) when exiting a course.

The SCORM API Wrappers come in three varieties:

  • JavaScript
  • ActionScript 2 (AS2)
  • ActionScript 3 (AS3)

All three wrappers are SCORM version-agnostic, and will work with both SCORM 1.2 and SCORM 2004. Both of the ActionScript wrappers require the JavaScript wrapper; the AS wrappers use ExternalInterface to invoke functions contained in the JavaScript wrapper. If the JS wrapper is not present, the ActionScript wrappers will not work.

The ActionScript wrappers use ExternalInterface to communicate with JavaScript. ExternalInterface will not work in a local environment unless you change your Flash Player security settings.

scorm-api-wrapper's People

Contributors

allanhortle avatar danielghost avatar moloko avatar pipwerks avatar pklingem avatar robinmalburn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scorm-api-wrapper's Issues

Calling Quit Method Shouldn't Force 'cmi.exit' to 'normal'

The connection.terminate() method overrides developer set cmi.exit if completion_status is complete etc. While this makes some sense, for many use cases we need to specifically KEEP suspend_data after completing the course. Is there anyway of doing this with this wrapper?

Licensing information missing

I'm potentially interested in using your wrapper (or a fork/reimplementation) in an open source project, but I'm wary of the legal ramifications with regards to licensing (or rather, the lack thereof). While the headers provide ample documentation as to where the code comes from, it still bugs me that a mature package such as this one lacks a licence.

As a matter of fact, during my research I've seen several npm packages that may or may not be derived from your wrapper (but are, more likely than not, related to the original ADL code). Rustici's stance on open source software makes me wary, as well.

I'm aware of this MIT-licensed project on github which explicitly cites this library as an inspiration/prior art (which is a good thing imo).

Seeing as this project is pretty old and you don't have much free time, would you still consider taking a closer look and, if possible, add a license.md file?

Issue with Permission denied to access property 'API'

Hi,

I'm having an issue with your SCORM_API_wrapper.js. I've installed your pipwerks.scorm component via Bower and it is located in Bower_components.

When your script calls the pipwerks.SCORM.API.find method it's throwing an error which breaks my HTML content player (course).

The error is triggered whenever a call to "window.top.opener.API" is made. The message that appears in the console is "Error: Permission denied to access property 'API' "

The really bizarre thing is that I have used this script before on another project and it works fine (in the same LMS too). The only difference is the fact it's not using it as a bower component and the main javascript is slightly different.

Do you have any idea why this is happening? Your help would be appreciated.

This happens in both Firefox and IE 11. I haven't checked it in any other browsers yet.

Please, please help me.

General Argument Error (201) with scorm.set("cmi.progress_measure", "0.4");

Hello,

I have an issue with the scorm API wrapper when I want to update the course's percentage.
I think I'm currently using the 2004 version.

scorm.set("cmi.progress_measure", "0,4");
scorm.save();

When running on CrossKnowledge's test platform, I've got this error in the bottom console (not the DevTools one!)

[2015-05-06 15:04:38] LMSSetValue("cmi.progress_measure", "0.4")
[2015-05-06 15:04:38] ERROR: (201) Invalid argument error
[2015-05-06 15:04:38] LMSCommit("")

Do you have any ideas why? Maybe I'm not using the 2004 version so "cmi.progress_measure" is not available? (http://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/)

Thank you for your time.

Scorm player

I'm trying to develop a scorm player that sends to mysql, has anyone done anything like this? Thank you.

Official npm package would really help

Hey Philip,

I know that somebody already made an npm package, and it seems to be up to date and all. But having an official "pipwerks" package, preferably using an org like "@pipwerks/scorm-api-wrapper," would help identify the real deal. I always end up "researching" which package it was that you mentioned a million years ago. And I see that you already have an account on npm. So this shouldn't be too much of a hassle. I'd love to help, but there is clearly nothing that I can do here, right?

In any case, thanks for the many years of your unrelenting service to this small community and for making this package in the first place! What would I do without it?

Take care!
Nicolas

Package game into SCORM

Hi, first of all thank you for making this awesome api wrapper.
I just wanna ask how you guys success to upload your package to SCORM engine,
I have never been succeed when tried to upload my game to it, by the way i am using moodle.

My package game is .zip file

Any help would be appreciated
Thanks

SCORM 2004 4th Edition

Hi,

I am having problems with this edition of SCORM 2004. The 3rd edition is working perfectly.

However, with this one, It looks like not getting well the API.

Here's the log screenshot running the course on Scorm Cloud.

seleccion_004

SCORM Cloud - 1.2 errors

After testing on SCORM Cloud the Example 1.2 version has a fatal error. Details of Parser errors below:

An item element was found that references a resource/submanifest with the identifier 'SCO_Resource_01' that does not exist.

The external metadata referenced at /courses/463303XQOD/SCORM1.2versione0daf84d-da83-4e4e-a3ca-36bd988ed7a6/0/SCORM 1.2 version\imsmetadata.xml could not be opened. The specific exception was: java.io.FileNotFoundException: /courses/463303XQOD/SCORM1.2versione0daf84d-da83-4e4e-a3ca-36bd988ed7a6/0/SCORM 1.2 version (Is a directory)

The 2004 version works fine though with completion status of passed once the form is submitted.

Track scorm progress and need inquiry regarding lms and lrs

pls can u help me, i have a query regarding scorm package

I'm reaching out with a query regarding your expertise with SCORM (Sharable Content Object Reference Model). Specifically, we have a SCORM zip file and are interested in tracking logs when this file is played. Could you kindly provide guidance on how to retrieve these logs programmatically?

Additionally, we are curious about the possibility of creating our own Learning Record Store (LRS) using ReactJS. Is it feasible to implement an LRS using this technology stack? If so, could you outline the steps or methods involved in integrating it with our application?

Your insights and expertise would be greatly appreciated. Looking forward to your guidance on these matters and how can i implement it with ur scorm-api-wrapper

Best regards,

Mustufa shaikh

Issue using Blackboard

Hello,
I have been trying to utilize this api to upload a course to Blackboard. I have recreated your sample project and uploaded it successfully to our Blackboard, but when the project loads I repeatedly receive the following error: "The specified resource was not found, or you do not have permission to access it.".
Upon checking my console I am receiving the following error: "ReferenceError: ToolActivityService is not defined". as well as some missing scripts in: "/courses/dwr_open/interface/", one of which is "ToolActivityService.js".

 I may be misunderstand this, as I am a Jr. dev, but our Sr. dev left and I was thown into this. Any help at all would be very appreciated.

LearningApps embedded

Hey guys!

I am looking forward to use some scrom packages on a learning-system. I embedded an existing scrom package from www.learningapps.org they use out of the box this api-wrapper.

But when I load the following page a few errors appears:

https://www.mein-klassenzimmer.de/test/

SCORM.connection.terminate aborted: Connection already terminated. SCORM_API_wrapper.js:913:32
connection.initialize called. SCORM_API_wrapper.js:913:32
SCORM.API.find: Error finding API.
Find attempts: 0.
Find attempt limit: 500 SCORM_API_wrapper.js:913:32
API.get failed: Can't find the API! SCORM_API_wrapper.js:913:32
SCORM.connection.initialize failed: API is null.

Have you got any idea?

StringToBoolean function incorrect result with String() object

Hi,

The LMS I am currently using returns a JavaScript String() object (containing true/false) when calling the various string functions.

When passed to typeof this returns 'object' which is not caught in the UTILS.StringToBoolean function and therefore always returns false.

Simple fix (within the switch statement) is as follows.
...
case "object": return value == "true" ? true : false;
...

Regards,
Jon

Version 2004 Errors

HI,

I'm playing with this in Moodle and have got the course installed as a SCORM Package and it's running. It seems to connect to the API

SCORM.API.find: API found. Version: 2004

Then there is this warning

request.js:2 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

And no connections work after that.

connection.initialize called.
SCORM_API_wrapper.js:837 SCORM.API.find: API found. Version: 2004
SCORM_API_wrapper.js:837 API: [object Object]
SCORM_API_wrapper.js:837 SCORM.data.get('cmi.completion_status')  value: unknown
SCORM_API_wrapper.js:837 SCORM.data.set('cmi.completion_status')  value: incomplete
**request.js:2 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.**
SCORM_API_wrapper.js:837 SCORM.data.get('cmi.core.lesson_status') failed. 
Error code: 401
Error info: Undefinited Data Model
SCORM_API_wrapper.js:837 SCORM.data.get('cmi.core.lesson_status')  value: 
SCORM_API_wrapper.js:837 SCORM.data.get('cmi.core.student_name') failed. 
Error code: 401
Error info: Undefinited Data Model
SCORM_API_wrapper.js:837 SCORM.data.get('cmi.core.student_name')  value: 

I'm using a local version of the latest Moodle for testing. Should I be using SCORM 2004 packages or SCORM 1.2 ?

version on JS library not updated

Due to the recent PR merge the version of the library should be updated at least in the last part which contains the date e.g. 1.1.20150324 or 1.2.20150324

Fix for IE window.top.opener

On line 186 the following code can produce an Access Denied error in IE11:

if(!API && win.top.opener && win.top.opener.document) {

The error occurs when win.top is null--trying to access the opener object of a null object.

The solution is to add a check for win.top, i.e.:

if(!API && win.top && win.top.opener && win.top.opener.document) {

Tutorial

Do you have any tutorials how to use this api?
THanks

Scorm loads slowly

Hi @pipwerks I'm using your scorm wrapper for my course and I realise that scorm object loads really slow on LMS (my case is: CanvasLMS). Any idea about that?
I don't know what is inside scorm that make the course runs slowly. I've tried to upload my course into a server and it running really nice.

Thanks!

No logging in chrome

If you are using chrome if(window.console && window.console.firebug){ returns false and so will never log anything. Is this intentional?

using beforeunload eventlistener in the wrapper

Hello,
i was currently experiencing a problem with the communication between my course and the LMS. It happens, that if you are on a mobile device(iOS in my case), the LMS calls wasn't registered / send when i close the browser window/tab.

While i was testing some things, it seems that the onbeforeunload/onunload isn't supported for Safari on iOS. https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#Browser_compatibility

I had the same experience with Chrome v50 on the same tablet. My fix is this:

if ('onpagehide' in window) {
  //pagehide is support by Safari on mobile devices
  window.addEventListener("pagehide",yourFunction);
} else {
  //use other eventlisteners if pagehide isn't supported
  window.onunload = window.onbeforeunload = yourFunction;
}

This might be interesting for your API-Wrapper, because you are using it too. Please, feel free to test this on your own first. It helped me.

Best,
Martin

Chrome 80

With the release of Chrome 80 there is an issue with sending data when the unload is triggered.
I was wondering if there was going to be an update or if not, any advise on how to solve this would be great?
I am still very new to all this.
Thanks Rick

Add NPM support

Hi there,
Thanks for the great API wrapper.
It would be great if the javascript plugin were available as a NPM package.

When not using SCORM, JS bug if window.opener is set

It seems the wrapper assumes that if window.opener is set, then SCORM is being used.

However if a course is not being used with SCORM, and is opened either via an anchor with target attribute set, or window.open, then window.opener is set in the course and SCORM wrapper throws a JS error.

error accessing win.top.opener

I was getting an error on IE11 (but not Chrome or Firefox) that win.top.opener is undefined.

This is happening on line 119 :

if(!API && win.top.opener && win.top.opener.document) {

This is fixed by adding an additional check for win.top

if(!API && win.top && win.top.opener && win.top.opener.document) {

NPM module

Is there any real explanation why this project isn't published in NPM repo?
It seems like it's ready for it, based on the current package.json.

ps: to be able to publish this the name field must be changed, as the scorm-api-wrapper is already taken by some module which depends on another module (pipwerks-scorm-api-wrapper) which in turn is a module wrapper for this project... What a mess... ^^"

Recognized as Scorm 1.2 in LMS

Cornerstone LMS recognizes it as Scorm 1.2 though it is set to act as 2004. Not sure if this is just a visual thing, but the customers get nervous...
image003

Get files from the sco package

Hi !

I've just started to try the pipwerks scorm api wrapper and I'm facing the following problem: when we have additionnal files (pdf, pps...) packed in our sco along with our swf sco file, how can we "http get" them from our as3 app ?

I've declared several files in the sco package manifest (and included them in the sco package zip) but I don't see how can I fetch them from my as3 code...

Thanks

Tom

SCORM error code 103 prevents wrapper to start properly?

I faced an issue with SCORM_API_wrapper.js: after launching SCO, when pressing backspace, script runs again but the SCORM session is still "Running". In this case, Initialize("") returns "false" and GetLastError() returns "103". However, in such a case, pipwerks.SCORM.connection.initialize() returns false, preventing any further communication with the LMS. Palliatively, I fixed it by checking this case just after Initialize("") and accepting error code 103 within conditional at line 267. Maybe I am doing something wrong, but it does not seem so bacause I should not call Initialize() directly and SCORM_API_wrapper.js is unable to restore its previous state.

ps.: I faced this problem running my SCO in Moodle 2 with Chrome. I did not test this with other LMS or browsers, but it seems to me that the problem really exists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.