雖然我沒有Captivate的過程中測試了這一點上,我使用了一些文件有關SCORM代碼Captivate的
我創建了四個功能? - 一個是電影開始時,一個是暫停時,一個是當課程即將關閉,需要計算時間和一個格式化scorm的時間,這是一個簡單的HH:MM:SS.S。格式。
Note: that you mentioned total_time or cmi.core.total_time, this is a read only
attribute, a course should send the session time and the LMS computes the
cmi.core.total_time
參考:看here或 here(滾動,直到看到cmi.core.session_time)
添加以下代碼的腳本標籤的末尾:
var mod_elapsedSeconds = 0;
var mod_startTime;
function sco_start(){
if (mod_startTime != 0)
{
var currentDate = new Date().getTime();
mod_elapsedSeconds += ((currentDate - mod_startTime)/1000);
}
mod_startTime = new Date().getTime();
}
function sco_pause(){
if (mod_startTime != 0)
{
var currentDate = new Date().getTime();
mod_elapsedSeconds += ((currentDate - mod_startTime)/1000);
}
mod_startTime = 0;
}
function onB4LMSFinish(){
if (mod_startTime != 0)
{
var currentDate = new Date().getTime();
mod_elapsedSeconds += ((currentDate - mod_startTime)/1000);
var formattedTime = convertTotalSeconds(mod_elapsedSeconds);
}
else
{
formattedTime = "00:00:00.0";
}
Captivate_DoFSCommand("cmi.core.session_time", formattedTime);
}
function convertTotalSeconds(ts)
{
var sec = (ts % 60);
ts -= sec;
var tmp = (ts % 3600); //# of seconds in the total # of minutes
ts -= tmp; //# of seconds in the total # of hours
// convert seconds to conform to CMITimespan type (e.g. SS.00)
sec = Math.round(sec*100)/100;
var strSec = new String(sec);
var strWholeSec = strSec;
var strFractionSec = "";
if (strSec.indexOf(".") != -1)
{
strWholeSec = strSec.substring(0, strSec.indexOf("."));
strFractionSec = strSec.substring(strSec.indexOf(".")+1, strSec.length);
}
if (strWholeSec.length < 2)
{
strWholeSec = "0" + strWholeSec;
}
strSec = strWholeSec;
if (strFractionSec.length)
{
strSec = strSec+ "." + strFractionSec;
}
if ((ts % 3600) != 0)
var hour = 0;
else var hour = (ts/3600);
if ((tmp % 60) != 0)
var min = 0;
else var min = (tmp/60);
if ((new String(hour)).length < 2)
hour = "0"+hour;
if ((new String(min)).length < 2)
min = "0"+min;
var rtnVal = hour+":"+min+":"+strSec;
return rtnVal;
}
改變看起來像這樣的標籤:
<body bgcolor="#f5f4f1" onunload="Finish();">
到:
<body bgcolor="#f5f4f1" onunload="onB4LMSFinish();Finish();">
添加這些功能,你開始和暫停按鈕:
sco_start(); // for starting the video
sco_pause(); // for pausing
正如我所說,我沒有迷人的課程代碼。如果你在某個地方發佈,我可以進一步幫助你。
謝謝..我仍在與Captivate一起實施它,但我知道需要做些什麼才能使其發揮作用。 – sivilian