Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Control Event Video timing with Javascript?

Community Beginner ,
Nov 15, 2022 Nov 15, 2022

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?

TOPICS
Advanced , Audio and video , Editing
907
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2022 Nov 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

They will not be streamed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 16, 2022 Nov 16, 2022

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 17, 2022 Nov 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();
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 17, 2022 Nov 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 17, 2022 Nov 17, 2022
LATEST

No, you leave it as video"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources