Playing SCORM on Android devices

后端 未结 3 1513
无人及你
无人及你 2021-01-22 04:18

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 wer

相关标签:
3条回答
  • 2021-01-22 04:31

    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.

    0 讨论(0)
  • 2021-01-22 04:47
    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.

    0 讨论(0)
  • 2021-01-22 04:51

    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.

    0 讨论(0)
提交回复
热议问题