Forum Discussion
Pause, Seekbar, and Next Button Issues with Multi-Layer Slides
Hi. I don't have a solution for the seekbar (yet) but I had a similar problem where I needed layers to pause/resume if the built-in pause/play button was clicked. You would think there would be a system "paused" variable--that would make it so easy--but there doesn't seem to be one (exposed to use anyway).
What I came up with is a JavaScript trigger that detects when the slide is paused based on some player attributes I noticed exploring the web dev panel. When it sees the button change it sets a Storyline variable I named pauseLayer. Then a second trigger executes when pauseLayer changes and will pause a layer's timeline when it's true or resume it when it's false. It works in the Modern and Classic player styles (for now--I'll keep an eye on things as they keep pushing updates; hopefully they won't change what that attribute is called in future versions.)
I'm attaching an example file. What I was doing was "animating" a character using state changes, but I put the triggers in their own layer, which makes it easy to copy this characters throughout my project. The triggers are on on the animation triggers layer.
The JavaScript for detecting pause/play clicks is this:
/*
This code detects if the Player pause button is pressed.
A second trigger will pause/unpause the animation trigger layer.
*/
let pauseLayer = getVar("pauseLayer");
const playButt = document.getElementById('play-pause');
function pauseOrPlay() {
const pawsed=playButt.getAttribute('aria-pressed');
if (pawsed=='false') {
setVar("pauseLayer",false);
} else {
setVar("pauseLayer",true);
}
}
playButt.onclick=function(){
pauseOrPlay();
}
I hope you find this useful. The seekbar behavior would be great but that's a challenge for another day.