How to switch between two videos and how to determine which video is visualized (active for image())

Hi everyone. I'm very new with Processing and I really need a help! I have two videos and I want to switch between them, choosing which video is shown. The two videos will always be in play, never stop or pause. They're playing at the same time and I can choose which visualize. Is there someone that can help me? Please, I'm very desperate because I have an exam and I'm so confused in using the code! Tks in advance. Here is the initial code that I try to do.

import processing.video.*;

Movie Mov1; Movie Mov2;

void setup(){ size(1280,720); Mov1 = new Movie(this, "nemo_bimbo.mp4"); Mov2 = new Movie(this, "adelaide_bimba.mp4"); }

void draw(){ image(Mov1, 840,0, 440,720); image(Mov2, 0,0, 440,720); }

void movieEvent(Movie m) { m.read(); }

void keyPressed() {

//I don't know how to use switch (key) //case 'a' //PLEASE, help me!

if (key == 'a') {
  Mov1.play();
 }
if (key == 's') {
  Mov2.play();
}

//I don't know how to not visualize anymore the video

if (key == ' ') {

Mov1.stop (); Mov2.stop(); } }

Tagged:
Sign In or Register to comment.