Looping several videos

https://editor.p5js.org/guillermo_d/sketches/jMAtBLViX
Hello!! I have three videos in this sketch, but i only get the first one to loop. I need to make a loop with the three videos. I’ve been trying different options and can’t find a solution. Can anybody help me?
thanks

I don’t know

did you call videoEnded() ?

:wink:

Hi @uili,

on setup do just …

  // ...
  videos = [conejo49, conejodis, conejosv];
  for (let video of videos) {
    video.size(230, 230); // Establecer tamaño
    video.onended(videoEnded); // Asignar evento al finalizar el video
  }
  videos[currentVideoIndex].show();
  videos[currentVideoIndex].play();
  // ...

and for videoEnded simply …

function videoEnded() {
    videos[currentVideoIndex].stop(); // Ocultar los videos
    videos[currentVideoIndex].hide(); // Ocultar los videos
    currentVideoIndex = (currentVideoIndex + 1) % videos.length;
    videos[currentVideoIndex].show();
    videos[currentVideoIndex].play();
}

Cheers
— mnse