Skip to main content
Inspiring
February 15, 2018
Question

How to advance to next slide at end of event video?

  • February 15, 2018
  • 1 reply
  • 3368 views

I have a responsive Captivate 2017 project and on one slide I have an event video. I'd like for the project to remain on the slide with the video until the video is done playing, then automatically move to the next slide. I always make custom nav buttons for my projects, so the slide has a 'next' button and a 'previous' button on it, that pause the slide after 3 secs (the extent of the slide timeline).

I also have the video hidden on entering the slide, with a custom play button with an action to show the video. The video is set to autoplay and the timing is set to duration of the video.

My on enter action for the slide is an execute javascript action and in the javascript window I have -

cp.hide("introVideo");

document.getElementsByTagName("introVideo")[0].addEventListener('ended',myFunction,false);

function myFunction(e) {

window.parent.window.cpAPIInterface.next();

}

I'm not sure if my function for moving to the next slide is correct. Though, I also tried just writing

cp.nextSlide():

in my function and that did not work either.

Any advice??

Thanks.

This topic has been closed for replies.

1 reply

maxk87987829
Participant
July 23, 2019

I am also trying to advance the slide when the video ends as well. I am using Captivate 2019 on a MacBook Pro. I have tried this and it doesn't work.

window.cpAPIInterface.getElementsByTagName("VideoAction")[0].addEventListener('ended', yourFunction, false);

function yourFunction(e) {

window.cpAPIInterface.next();

}

When debugging locally in Chrome, the error seems to be the property .getElementsByTagName

If anyone has done this before successfully, advice would be greatly appreciated.

LuisXIV
Participating Frequently
July 24, 2019

Hello Maxk

Try document.getElementById("NameOfVideoc");

Get the element with the specified ID: NameOfVideo is the name that you supply in the properties.

You need to add a 'c' in your javascript to the end of the object's ID.

Captivate assigned a name based on the  instance name of the text caption,smart shape,video, etc...

Look in the CPM.js. file in assets/js/CPM.js to find the id.

https://helpx.adobe.com/captivate/using/common-js-interface.html

Luis

LuisXIV
Participating Frequently
July 24, 2019

Hello maxk,

correction:

synchronized video only, for event video check the following article

Timeline - Advanced Workflows - Captivate blog

the video player being used is dashjs-player ( more info at Dash Industry Forum)

"The event video is controlled by its control panel".

Execute the following Javascript code on the slide.

document.getElementsByTagName(“video”)[0].addEventListener(‘ended’,yourFunction,false);

function yourFunction(e) {

cp.show(“nextBtn”);

}

Luis