Skip to main content
Participant
November 15, 2022
Question

Control Event Video timing with Javascript?

  • November 15, 2022
  • 2 replies
  • 1082 views

I notice with Slide Videos you can control the start and stop point of the video, however I cannot find a feature that allows this with Event Videos. Also, you can only have one Slide Video per slide and I need a second video to play on the same slide. All of our video source files have a required leader and trailer that I need to skip over in Captivate. I'm guessing the solution lies within Javascript. Is there any way that you can control the start and end points within an Event Video?

This topic has been closed for replies.

2 replies

TLCMediaDesign
Inspiring
November 17, 2022

This script will get the videos and set the start time to 10 seconds for each video and pause it at 15 seconds. Change the 10 and 15 to the start and end times of your videos:

 

var vids

const myTimeout = setTimeout(getVideo, 1000);

function getVideo() {
vids = document.getElementsByTagName("video");
vids[0].currentTime = 10;
vids[0].addEventListener("timeupdate", endVideo1)
vids[1].currentTime = 10;
}

function endVideo1()
{
if ( vids[0].currentTime > 15 )
{
vids[0].pause();
}
}

function endVideo2()
{
f ( vids[1].currentTime > 15 )
{
vids[1].pause();
}

Participant
November 17, 2022

Thank you, I will test this when I get a chance. Do you replace "video" with its Captivate component name or file name? Also, is there a way to set the variables in this up like Shared Actions or will each slide require its own unique script?

TLCMediaDesign
Inspiring
November 17, 2022

No, you leave it as video"

Lilybiri
Legend
November 15, 2022

Do you embed the videos? If you stream them from YouTube or Video, you can use the functionality of those platforms to reach your goal: control the start point and the duration which is defined by the end point.

Participant
November 15, 2022

They will not be streamed.

Lilybiri
Legend
November 16, 2022

Sorry, I hope that the JS experts will pop in. Event video plays independently from Captivate's timeline.