Saola-AP pausing / playing multiple timelines

Hello,
I’m using the below to pause/play my Active Presenter and Saola items:
var Saola = prez.object(‘Web Object_14’).frameNode.contentWindow.AtomiSaola;
var saolaDoc = Saola.topDocs[0];
saolaDoc.getTimeline(‘Timeline’).play(); (or pause in the other function)

problem is that I have 2 saola timeline:

  • timeline plays until 2 minutes then pauses and starts the vessel timeline
  • vessel timeline plays alone for 1 minutes and then restart the main timeline whilst still playing.

How can I pause / play with these 2 items in parallel?
e.g. if I have a button which plays both timelines and use it before the vessel timeline has started playing - it will start playing too early…
or if I use it during the time when the vessel timeline is playing and the other one is paused - it will resume both.

Any suggestions?

Thanks,
Michael

Hi Michael,

You should not resume a timeline if it’s not paused by you.
Please try the following code to see if it helps:

var timeline1 = saolaDoc.getTimeline('Timeline_1');
var timeline2 = saolaDoc.getTimeline('Timeline_2');  // vessel timeline

// play
if (timeline1.pausedByMe /* was paused by me */
  || (timeline1.getTimestamp() == 0 && !timeline1.isPlaying()) /* or first start */) {
  delete timeline1.pausedByMe;
  timeline1.play();
}
// timeline 2 is started by timeline 1 => should only resume it, not start it
if (timeline2.pausedByMe) {
  delete timeline2.pausedByMe;
  timeline2.play();
}

// pause
if (timeline1.isPlaying()) {
  timeline1.pausedByMe = true;
  timeline1.pause();
}
if (timeline2.isPlaying()) {
  timeline2.pausedByMe = true;
  timeline2.pause();
}

Regards

Hi,
i split this code between by 2 buttons and it seems to be working perfectly!
Great - thanks a lot!

1 Like