onEnded problem

Hi, i have a problem with event handler onEnded in my video Box, i want to show an image on video end but it doesn’t work!

This is my code…


$w ( “#videoBox3” ). onEnded (() => {
$w ( ‘#image36’ ). show ()
});

Have you put it inside $w.onReady?

$w.onReady(() => {
//here
})

Is this working now as I want to do the exact same thing.

One thing I can’t quite figure out is where is #image36 “kept”. That is where is this image on the page before the video is played? Is it hidden? Is it somewhere random on the page? Is it behind the videobox?

Thanks
Victor

If you want to show an image when the video ended. You can just put the image in front of the video box. And load it as collapsed (you can select it from the element properties panel).

And in your code expand the image when video is ended:

$w.onReady(() => {
  $w("#video").onEnded(() => {
    $w("#image").expand();
  });
});

If there is a possibility that user can start the video again also add a code that will collapse the image when video is played.

brilliant thanks very much!

One thing is … if I would like to “re-click” on the video the image is now in the way and does not allow me to click again. Is that correct?

Victor

If you stop the video yes you will see the image in front of the video so you won’t be able to play the video again.