|
楼主 |
发表于 2023-6-15 22:18:44
|
显示全部楼层
四川省泸州市
function API() {
}
var currentTime = 0;
$(function () {
//window.parent.postMessage("60,,,"+currentTime,'*');
API.LMSGetValue = function (e) {
if (e == "cmi.core.lesson_location") {
window.parent.postMessage("5,,,"+currentTime,'*');
return currentTime;//首次播放返回 0 ,之后返回上一次保存在数据库的值
}
return "true";
}
API.LMSInitialize = function (e) {
return "true";
}
API.LMSSetValue = function (e, f) {
if (e == "cmi.core.lesson_location") {
currentTime = Math.round(f);
}
if (e == "cmi.core.session_time") {
var period = 60;
console.log(new Date()+"_session_time_f="+f);
if(IEVersion()>9){
var arr = f.replace('-', '').split(".")[0].split(":");
var period = Math.round(arr[0]) * 60 * 60 + Math.round(arr[1]) * 60 + Math.round(arr[2]);
if (period == 0) return "true";
}
if(false)period=0;
console.log(new Date()+"_postMessage="+period+"|"+currentTime);
window.parent.postMessage(period+",,,"+currentTime,'*');
}
return "true";
}
API.LMSCommit = function (e) {
return "true";
}
API.LMSFinish = function (e) {
return "true";
}
API.LMSGetLastError = function (e) {
return 0;
}
});
|
|