Playing SCORM on Android devices

僤鯓⒐⒋嵵緔 提交于 2019-12-02 04:25:06

问题


I've got few questions about Android and SCORM. In both areas I'm pretty new and I only spent one evening digging the web in search of some answers.

Topics I found were about synchronizing SCORM package with LMS but I do not need that. I'm just wondering how to PLAY (and just play, no need for any syncing or tracking) SCORM package on android device (Lenovo tablet with Android 4+ OS). If I try to make my own application which allows to browse local SCORM packages, will I be able to launch SCORM by using WebView component?

I found this tutorial:

http://support.scorm.com/entries/21826060-RSOfflinePlayer-Developer-Tutorial

which has section:

Playing Content and Syncing Results

where I found some interesting source code about configuring this WebView component in order to play SCORM content, but I'm not really sure if I need RSOfflinePlayer.jar for this.

I've also heard, that if device supports Flash, I will be able to launch SCORMs with Browser - is it true?

Maybe you know some application which can do that? Or library which could help?

Is there anyone with experience in:
1) Java SCORM API:

would paste URL, but I need more reputation

2) Celine

https://code.google.com/p/celine-scorm/

Any help will be appreacieted, not only by me but also by children with different kinds of diseases (we are just students trying to help them).


回答1:


Javier is almost right. I will nonetheless try to explain this again. Maybe you will gather more information from this.

Every SCO is basically a zipped webpage. You have to unzip it and look for imsmanifest.xml, find the initial file in there (index.html, player.html, something like this). It will NOT be located under resources. You first have to look at Organizations > Organization > Item > Identifierref, which will give you an ID. Then you have to look at Resources > Resource with the above ID > href value. This is the file you're looking for.

Example (index.html is the file you need):

<organizations default="someorg">
  <organization identifier="someorg">
    <title>Some Title</title>
    <item identifier="CourseItem01" identifierref="SCO_Resource_01" isvisible="true">
      <title>SCO Title Here</title>
    </item>
  </organization>
</organizations> 
...
...
<resources>
  <resource identifier="SCO_Resource_01" type="webcontent" adlcp:scormtype="sco" href="index.html">
    <file href="index.html"/>
    <file href="SCORM_API_wrapper.js"/>
...

Once you found it, just open it in WebView and it'll try to connect to SCORM API in the parent window. You'll have to provide some dummy functions to fool it into thinking that it did connect to LMS and carry on as usual. Otherwise it will either fail or throw alerts at you.




回答2:


I don't have any Android experience, but I have some experience working with SCORM.

To play a SCORM object, you need to open the right file inside the right environment, the right file is stated in the imsmanifest.xml file, that will be always in the top level of the zip package, you have to look for something like this:

<resources>
  <resource identifier="546468" type="webcontent" href="index.htm" adlcp:scormtype="sco">
    <file href="index.htm" />
  </resource>
</resources>

This means that you have to open index.htm in the top level, in general you have to look for the first resource with adlcp:scormtype="sco" (if you need more details, read the SCORM spec).

When this page loads, it will look for the API object, it must be in the parent window, or parent frame, you will need a dummy SCORM API, something like:

function ScormAPIClass()
{   
    this.GetLastError = function (){return 0};
    this.GetErrorString = function (param){return ""};
    this.GetDiagnostic = function (param){return ""};
    this.SetValue = function (element, value){
                                              //you need something else here
                                              return true};
    this.GetValue = this.SetValue = function (element){
                                                       //you need something else here
                                                       return true};
    this.Initialize = function (param){return true};;
    this.Terminate = function (param){return true};
    this.Commit = function (param){return true};;
    this.version = "1.0";
}


window.API_1484_11 = new ScormAPIClass();

The SCORM objects will assume that you API works, so, if the set and get functions are not real this can generates errores depending on the object logic. Also, I did not tested the code, is only to give you an idea of what you need.

I hope this help you.




回答3:


  1. First you have to understand structure of Scorm.

  2. You can see Scorm package is a zip file containing several folders right and a manifest file.

  3. First you have to unzip that zip package of Scorm and then you have to parse that imsmanifest.xml file and maintain two lists one containing titles and other addresses of html files corresponding to that title.

  4. I have used sax2r2 parser to parse that manifest file and got that two array lists one containing title and other addresses of html files.

  5. Later you just have to fill up you IOS list with titles array, and when user click on any title of that list get the position of list and retrieve the address of html files corresponding to that title from addresses array list.

  6. finally you can open html file in webview of your IOS, make sure have enabled parameters required for open scorm html5 file.

In android I have enabled and set these values this is java code but it may help you.

WebViewClient webViewClient = new WebViewClient();
    webView.setWebViewClient(webViewClient);
    webView.clearCache(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.setInitialScale(1);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.clearHistory();
    webView.getSettings().setAllowFileAccess(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl("file://" + open_scorm.scorm_path
            + open_scorm.scorm_name + "/" + open_scorm.href.get(0));

webView is used to open html/html5 files in android and i have enabled above settings in android, these settings are by default in android, may be in ios you just have to load that html file and dnt have to enable all these values.

In above you can see I am retrieving href.get(0) which is first html5 file of scorm.

In simple words you just have to unzip scorm , parse imsmanifest.xml file and get data of it and use it to open/parse scorm.



来源:https://stackoverflow.com/questions/19392554/playing-scorm-on-android-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!