Forum Discussion
COLINGRANT-a3ad
2 years agoCommunity Member
GetDuration
Hi. I am trying to use JavaScript to get the duration of a given slide and pass it to Storyline. The SetVar part (where one passes a JavaScript variable to Storyline) works fine, but I cannot seem ...
SamHill
2 years agoSuper Hero
Hi Colin, I've made some experiments, and you can get the current slide duration using this:
var currentSlide = DS.appState.windowManager.windows[0].getCurrentSlide();
var slideDuration = currentSlide.attributes.currentTimeline.attributes.duration;
const player = GetPlayer();
player.SetVar('slideDuration',Number(slideDuration));
You would need to have a variable called "slideDuration", type Number, defined in Storyline.
Duration is returned in milliseconds. For example 10 seconds = 10000.
Disclaimer: This has not been extensively tested. I have tested on a single slide.
MichealMathews
7 months agoCommunity Member
You are my hero for the day!
I've been wrestling with this for hours!
I knew someone else had to have run into this issue.
THANK YOU!