Accessing Mobile scorm api object

Accessing Mobile scorm api object

by Ross Smith -
Number of replies: 6

Hi, 

I feel like I am missing something obvious here.  I have a local moodle install (v3.1), on there I have a course with a single scorm activity.  For testing , the scorm activity is a simple html page, which has a bit of javascript which gets the scorm 1.2 api object by looking at the parent window, once it has the scorm object is alerts that is it found.  This works fine in the browser.

In the moodle mobile app I point it to my local site, when I open the course, and after I download the scorm, it seems to fail to get the scorm 1.2 api object.  I set up my local development environment for moodle mobile, and looking at the console it cannot get the scorm api becase of cross domain issues. 


Does anyone have any ideas what I am doing wrong or missing?  Or how I can go about fixing this so my content can access the scorm object.

Any help much appreciated smile

Average of ratings: -
In reply to Ross Smith

Re: Accessing Mobile scorm api object

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Plugin developers Picture of Testers

Hi Ross,

please, can you check first if you are opening the browser using the special flags to avoid the cross domain issues?

https://docs.moodle.org/dev/Moodle_Mobile_development_using_Chrome_or_Chromium#Installation

If it still does not work, please attach here your scorm package

Juan

In reply to Juan Leyva

Re: Accessing Mobile scorm api object

by Ross Smith -

Hi Juan, 

Thanks for replying.  Disabling the special flags for local development removes the cross domain issue for local dev.  If I build the app using ionic and run it on my android device the scorm activity doesn't seem to be able to get the scorm api object because of the cross domain.  Any guesses?  Is it perhaps because I am building via ionic as oppose to phonegap.

I've uploaded my test scorm here, inside is the manifest which pretty much points to a the content html file which I place on my server, which is a simple html with JS which attempts to get the scorm api object.

Thanks again for your help, 

Ross

In reply to Ross Smith

Re: Accessing Mobile scorm api object

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Plugin developers Picture of Testers

Hi Ross,

 Is it perhaps because I am building via ionic as oppose to phonegap.

Does this mean that the SCORM only fails in your custom app? or is it failing in the latest version of the official app downloaded from the store?

Juan

In reply to Juan Leyva

Re: Accessing Mobile scorm api object

by Ross Smith -

Hi Juan, 

Good point - sorry, no, it also fails on the official app from the store (tested on Android).

Thanks again, 

Ross

In reply to Ross Smith

Re: Accessing Mobile scorm api object

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hello Ross,

sorry for the delay in answering. I checked your SCORM package and I saw you include some fixed URLs:

<file href="http://192.168.1.91/moodle_31/content/Ross/test.html" />

You should use relative URLs:

<file href="test.html" />

I changed all the URLs for relative URLs and it works fine now in Android.

Kind regards,

Dani

In reply to Dani Palou

Re: Accessing Mobile scorm api object

by Ross Smith -
Thanks for this Dani - that makes perfect sense - I'm hitting myself for not realizing it.  This doesn't perfectly solve it for me just based on some requirements on where we place our content (probably why I missed this) but it points me right where I need to be to fix it!  :D


Thanks a lot!

Ross