We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I am trying to use processing to show 6 videos in total. The screen is split into 3 even sections where when keys are pressed, 3 videos appear, then when additional keys are pressed another 3 videos appear but replace the 3 that were there.
The code below does work where the initial 3 appear and the following 3 do too but when I press the keys for the 1st 3 videos again, they seem to play behind the last ones that were played.
I am completely new to processing so not sure if I am doing this right...any help would be appreciated.
` // imports the video library import processing.video.*;
// These strings point to the path of the video on my computer String Video1 = "...path to video"; String Video2 = "...path to video"; String Video3 = "...path to video"; String Video4 = "...path to video"; String Video5 = "...path to video"; String Video6 = "...path to video";
// Class created for each video Movie mov1; Movie mov2; Movie mov3; Movie mov4; Movie mov5; Movie mov6;
void setup() {
// creates the size of the window size(1280, 720);
// creates the videos to be played in the window. It uses the classes created above and uses the path strings to direct to the video mov1 = new Movie(this, Video1); mov2 = new Movie(this, Video2); mov3 = new Movie(this, Video3); mov4 = new Movie(this, Video4); mov5 = new Movie(this, Video5); mov6 = new Movie(this, Video6); }
void draw() {
// these instructions size the videos to be viewed on screen. image(mov1, 0, 0, width/3, height); image(mov2, 427, 0, width/3, height); image(mov3, 854, 0, width/3, height); image(mov4, 0, 0, width/3, height); image(mov5, 427, 0, width/3, height); image(mov6, 854, 0, width/3, height);
}
void movieEvent(Movie m) {
m.read();
}
void keyPressed() {
if (key == 'a') { mov1.play(); mov1.volume(0); }
if (key == 's') { mov2.play(); mov2.volume(0); }
if (key == 'd') { mov3.play(); mov3.volume(0); }
if (key == 'f') { mov1.stop(); mov4.play(); mov4.volume(0); }
if (key == 'g') { mov2.stop(); mov5.play(); mov5.volume(0); }
if (key == 'h') { mov3.stop(); mov6.play(); mov6.volume(0); }
}`