A video in a symbol. I would like that a button reads the video from the 20th second

  1. I import a 20 sec video.
  2. I convert it as a symbol and create a timeline that I call “Chap20”
  3. I create a Custom Behaviour that I also call “chap20” and that will read the Chap20 timeline from 0:20:00
  4. Then on the main scene, I create a button and I call the CB.
  5. When I preview, the button does not go the 20th second of the video.

Is the runtime of the video independent of the timeline where it is placed?

To set a video element to a certain time, you would need to give it an Element ID, and then target it:

var mediaElement = document.getElementById("myVideo");

Next, you would need to use this function to jump to a specific time:

mediaElement.currentTime = 20;

If you also wanted to play that video at the 20 second mark, you would need:

mediaElement.play();

The video can be either a regular element or in a symbol (and controlled via custom behavior (JavaScript function) or regular JavaScript function as long as the video is on that scene.

But if you play a 20 second video starting from 20 seconds, it won’t really do anything since that’s the end of the video (so maybe I’m not understanding your question?).

Thank you.

I meant:

  1. I import a 20 sec video.
  2. I convert it as a symbol and create a timeline that I call “Video”
  3. I create a Custom Behaviour that I also call “videoAt10” and that will read the Chap10 timeline from 0:10:00
  4. Then on the main scene, I create a button and I call the CB.

OK, will try it.

It works!

Thank you.

1 Like