Hi! I am trying to add play / pause buttons that stop and start my timeline. I can do that part with actions but, the audio in the timeline keeps playing when the timeline is paused. Anyone know how to make the audio pause / play when the timeline is paused?
Thanks!
you will need to use code like.
var myaudio = Z.Audio("moby.ogg");
myaudio.start();
myaudio.pause( );
myaudio.restart( );
Also see docs HERE
Steve
There is no built-in event to detect when a timeline is paused. You can, however, easily make one yourself. Wrap the timeline stop function in another function instead of calling it directly, and invoke an event right after:
function timelineStop() {
symbol.controllers.mycontroller.elements.mytimeline.stop();
symbol.emit(“stop”);
}
Then you can catch the event:
symbol.on(“stop”, () => {
audio.pause();
})
Thanks so much @marcus ! The coding side of things is still knowledge I am trying to acquire and understand. I am uploading a sample file here with buttons a timeline and audio. Can I buy you a coffee for a demonstration of how this is implemented? You can share it back here so others can also benefit from your knowledge. I am also trying to figure out how to jump back on a timeline by a few seconds. Not sure if that is possible but I included the button.
Thanks!
MichaelButtons.zpp (107.5 KB)
Buttons.zpp (107.6 KB)
Eh…you don’t really need to use an event for this, so I didn’t. Attached is your example with the code. The reset button goes back 1 second(1000ms).
Can I buy you a coffee
I vote for coffee being the universal currency. Always appreciated .
Only if it’s Starbucks coffee lol
Steve
Thanks @marcus You rock! PM me your email and I will shoot you over some Starbucks Cash when I get back to my office.
Hey Marcus,
Hope all is well. Quick question. I noticed that when I hit the back button the audio becomes misaligned. Also You have to pause before you go back. Any way around those issues?
Thanks!
Michael