【问题标题】:How to resume scorm 2004 where we left previously?如何从我们之前离开的地方恢复scorm 2004?
【发布时间】:2021-04-07 04:10:10
【问题描述】:

嗨,

我正在开发基于 scorm 的项目,我要玩 scorm 2004 软件包。课程正在播放
并使用 LMS 函数(LMSFinish()、commit()..etc)正常捕获数据。
现在我要实现另一个函数,即恢复用户离开的包上次。

cmi 数据示例

scoid:"1234"

数据[cmi.completion_status]:"不完整"

数据[cmi.exit]:"挂起"

数据[cmi.location]:"page3"

希望你能帮忙。

【问题讨论】:

    标签: javascript scorm scorm2004 canvas-lms


    【解决方案1】:

    通常使用“cmi.suspend_data”,因此您可以存储字符串(JSON 或其他分隔符格式,如果您想要或需要结构)来恢复答案。
    'cmi.location' 有 1000 个字符供您存储一个字符串,它可以像“3”或“page3”一样简单。

    您在内容演示/播放器中的导航需要能够响应要前往的位置。您可以使用 suspend_data 将学生的答案恢复到他们离开时的状态。

    如何决定是否“恢复”有点棘手,因为除了 'cmi.entry' = 'ab-initio' 之外的任何东西都是简历。一些 LMS 系统返回空白或“恢复”,因此您知道在使用时获取您的“cmi.location”和“cmi.suspend_data”。

    这是您必须编写的所有代码,或者您可以在我的 Wiki 上阅读一下。 https://github.com/cybercussion/SCOBot/wiki.

    【讨论】:

    • 嗨,马克,SCOBot 很棒,非常感谢您提供的信息。
    • @Mark 有没有办法弹出 Player bultin Resume 对话框?我保存了暂停的数据以及位置,然后能够检索它们并从它们离开的地方继续,但我希望它显示 bultin Resume 对话框。这可行吗?
    • @user2866746 你是如何恢复使用 Scobot 我试图达到同样的效果,但我仍然无法恢复。我只是保存暂停的数据而不是位置。你能帮忙吗?
    • @user2866746 我没有包含用于确认希望恢复先前会话的事件。从技术上讲,一旦他们之前暂停,就会执行一系列平台检查以验证内容正在恢复的事实,因为 LMS 平台有时会跳过设置cmi.entry。 SCOBot主要检查suspend_data长度是否>大于0,然后检查cmi.entry值@第1069行。github.com/cybercussion/SCOBot/blob/master/QUnit-Tests/js/scorm/…
    【解决方案2】:

    我对简历有一些解决方法,并且正在为我工​​作。我保存了suspended_data,然后检索了该数据,以便玩家恢复该位置。

    【讨论】:

      【解决方案3】:

      @kishor-koshti 你是怎么做到的,我的意思是,告诉玩家从给定位置恢复? 我能够捕获suspended_data,但我不知道下次启动该课程时如何将其设置回来。 我在 javascript 上的 API 对象似乎是只读的。

          <html>
      <head>
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta charset="utf-8" />
          <meta name="viewport" content="width=device-width, initial-scale=1" />
      </head>
      <body>
          <style>
              body { margin: 0; }
          </style>
          <script type="text/javascript">
              var API = {};
      
              function setupScormApi() {
                  API.LMSInitialize = LMSInitialize;
                  API.LMSGetValue = LMSGetValue;
                  API.LMSSetValue = LMSSetValue;
                  API.LMSCommit = LMSCommit;
                  API.LMSFinish = LMSFinish;
                  API.LMSGetLastError = LMSGetLastError;
                  API.LMSGetDiagnostic = LMSGetDiagnostic;
                  API.LMSGetErrorString = LMSGetErrorString;
              }
              function LMSInitialize(initializeInput) {
                  console.log("LMSInitialize: " + initializeInput);
                  // invokeCSharp("LMSInitialize: " + initializeInput);
                  return true;
              }
              function LMSGetValue(varname) {
                  console.log("LMSGetValue: " + varname);
                  //invokeCSharp("LMSGetValue: " + varname);
                  return "";
              }
              function LMSSetValue(varname, varvalue) {
                  console.log("LMSSetValue: " + varname + "=" + varvalue);
                  // invokeCSharp("LMSSetValue: " + varname + "=" + varvalue);
                  return "";
              }
              function LMSCommit(commitInput) {
                  console.log("LMSCommit: " + commitInput);
                  // invokeCSharp("LMSCommit: " + commitInput);
                  return true;
              }
              function LMSFinish(finishInput) {
                  console.log("LMSFinish: " + finishInput);
                  // invokeCSharp("LMSFinish: " + finishInput);
                  return true;
              }
              function LMSGetLastError() {
                  console.log("LMSGetLastError: ");
                  // invokeCSharp("LMSGetLastError: ");
                  return 0;
              }
              function LMSGetDiagnostic(errorCode) {
                  console.log("LMSGetDiagnostic: " + errorCode);
                  // invokeCSharp("LMSGetDiagnostic: " + errorCode);
                  return "";
              }
              function LMSGetErrorString(errorCode) {
                  console.log("LMSGetErrorString: " + errorCode);
                  // invokeCSharp("LMSGetErrorString: " + errorCode);
                  return "";
              }
      
              setupScormApi();
          </script>
          <iframe id="frm1" src="./Content/index_lms.html" style="width: 100%; height: 100%"></iframe>
      </body>
      </html>
      

      【讨论】:

      • SCO 通常设置其cmi.locationcmi.suspend_data。并非所有 SCO 都这样做或必须这样做。主要取决于它们是如何编码的。有些甚至会对他们的suspend_data 进行base64,因此没有设置结构,因为SCORM 中的所有内容都是关于这两个命名空间的字符串。我还将指出 LMSCommit 更符合 SCORM 1.2 与 2004。SCORM 1.2 将是 cmi.core.lesson_location 并且您被限制为 255 个字符。然后cmi.suspend_data 限制为从 64000 减少到 4096 个字符。breakdown
      【解决方案4】:

      Mehonder 的执行解决方案

      // story_content/user.js

      let lastSlideLoaded = ''; //global variable
      function Script1() {
          if (lastSlideLoaded == '') {
              lastSlideLoaded = 'X';
              var ACT_firstID = window.globals.parsedParams["last_slide"]; //URL Argument
              if (!ACT_firstID == (null || "" || "0")) {
                  Jump_Slide(ACT_firstID); //Set Slide
              }
          } else {
              SetLastSlide(); 
          }
      }
      
      function SetLastSlide() {
      // send to last slide info to server//
          var xhttp = new XMLHttpRequest();
          var PACKID = window.globals.parsedParams["pack_id"];
          var LASTID = window.DS.presentation.playerProps.attributes.CurrentSlideId;
          var lastSlideURL = "/services_index.php?page=last_slide&pack_id=" + PACKID + "&last_slide=" + LASTID;
          xhttp.open('GET', lastSlideURL, true);
          xhttp.send();
      }
      
      function Jump_Slide(Target_Slide) {     
      // trigger slide change event //                              
          g = DS.pubSub;              
          p = DS.events;              
          i =  "_player." + Target_Slide;              
          g.trigger(p.request.NEXT_SLIDE, i, "_current")
      }

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多