Copy link to clipboard
Copied
So the client wants each slide to show the elapsed time and the total course duration (they don't want to use what's already displayed in the TOC because the TOC is hidden and they want the time info to always be visible).
So, I've implemented an advanced action that takes place upon entering each slide. Here is the javascript:
var frames = window.cpAPIInterface.getVariableValue("cpInfoFrameCount");
var speed = window.cpAPIInterface.getVariableValue("cpInfoFPS");
var start = window.cpAPIInterface.getVariableValue("cpInfoCurrentFrame");
frames = frames/speed;
var ss = frames.toFixed(0);
var convertSeconds = function(sec) {
var hrs = Math.floor(sec / 3600);
var min = Math.floor((sec - (hrs * 3600)) / 60);
var seconds = sec - (hrs * 3600) - (min * 60);
seconds = Math.round(seconds * 100) / 100;
seconds = String(seconds).padStart(2, '0');
window.cpAPIInterface.setVariableValue("var_sec_duration",seconds);
window.cpAPIInterface.setVariableValue("var_min_duration",min);
}
convertSeconds(ss);
start = start/speed;
var cur_ss = start.toFixed(0);
var set_cur_time = function(sec) {
var hrs = Math.floor(sec / 3600);
var min = Math.floor((sec - (hrs * 3600)) / 60);
var seconds = sec - (hrs * 3600) - (min * 60);
seconds = Math.round(seconds * 100) / 100;
seconds = String(seconds).padStart(2, '0');
window.cpAPIInterface.setVariableValue("var_sec_elapsed",seconds);
window.cpAPIInterface.setVariableValue("var_min_elapsed",min);
}
set_cur_time(cur_ss);
And then on the slide I display " $$var_min_elapsed$$:$$var_sec_elapsed$$ / $$var_min_duration$$:$$var_sec_duration$$ "
This works really well on both Chrome and Edge, but on IE 11, for some reason it just shows 0:0, no matter what slide you're on.
Any ideas re: what could be going wrong here?
Copy link to clipboard
Copied
It's some DOM jQuery messup in IE.
Have you tried to use $$cpInfoCurrentTime$$. Somthing like: Var timer = $$cpInfoCurrentTime$$ - ($$cpInfoCurrentTime$$ - 1 sec);