Skip to main content
Participant
May 28, 2025
Question

Using embedded video component to trigger animation

  • May 28, 2025
  • 1 reply
  • 237 views

I am trying to make it so on my stage, I dragged in a video component, set the path to a video using the component parameters, and when the video is at say 10 seconds, one layer isn't visible and another one is. Then at say 24 seconds into the video, that layer isn't visible and another one is etc. I couldn't find a good answer to how to use JavaScript to have this functionality so if anyone has some pointers that would be great! I have tried createjs.Ticker but that doesn't seem to like me and I always get console errors.

 

At the moment I have an array with all my cue points and which layer it makes visible (they're all hidden initially). All my attempts so far have resulted in nothing happening at all.

 

I see a lot of responses like, you can do it manually (as in using Adobe Animate's frames), but I need the animations to be triggered when the actual video is at a certain point. 

 

Thanks!

1 reply

kglad
Community Expert
Community Expert
May 28, 2025

html5 or as3?

Participant
May 28, 2025

HTML5!

kglad
Community Expert
Community Expert
May 29, 2025

when currentTime is 10, 24 etc, do what you want:

 

var videoPlayer;
checkInitF();
function checkInitF() {
if (videoPlayer) {
videoPlayer.ontimeupdate = function() {
f();
}
} else {
videoPlayer = $("#videoPlayer")[0];  // videoPlayer is component instance name
setTimeout(checkInitF, 100);
}
}
 
function f(){
// videoPlayer.currentTime -  do whatever
}