Video Playback Problem

Hi. I’m trying to make it so this sketch plays videos upon clicking the images, but so far I have not been able to make the videos play at all, let alone swap between them freely.

var immol;
var i = 'Immolation1.mp4';
var erf;
var venus;
var vv1;
var vv2;
var vv3;
var v1;
var v2;
var v3;
var f1;
var f2;
var f4;
var f3;

function preload(){
  immol = createVideo(i,onLoad);
  erf = createVideo(['erf.mp4']);
  venus = createVideo(['venus.mp4']);
  //immol.size(640, 336)
  //erf.size(640, 336)
  //venus.size(640,336)


}

function setup() {

  immol.loop();
  immol.hide();
  immol.showControls();
  erf.loop();
  erf.hide();
  erf.showControls();
  venus.loop();
  venus.hide();
  venus.showControls();
  //fill('black');
//createCanvas(640, 336);
noCanvas()
}

function draw() {
background(0);
v1 = createImg('Immolation.jpg');
v1.position(660, 40);
//image(immol, 0, 0);
v1.mousePressed(immol);
v2 = createImg('erf.PNG');
v2.position(660, 140);
//
v3 = createImg('venus.PNG');
v3.position(660, 240);
//
}
function onLoad() {
  immol.play()
}

why not start from a working example?
https://editor.p5js.org/p5/sketches/Dom:_Video

1 Like