We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi! Could you have a look at my code? I used current movie to switch two video (NemoBimboMovie and NemoShapeMovie, but they don't switch. I don't know why. Pleeeease, help me!
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import processing.video.*;
import processing.sound.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class prova_di_oggi extends PApplet {
PImage file;
SoundFile sound1;
SoundFile sound2;
Movie NemoBimboMovie;
Movie NemoShapeMovie;
Movie AdelaideBimbaMovie;
Movie FirstInteractionMovie;
Movie CurrentMovie;
public void setup(){
background (0);
file = loadImage("/Users/MASC/Desktop/prova_di_oggi/data/rettangolo.jpg");
sound1 = new SoundFile(this, "/Users/MASC/Desktop/prova_di_oggi/data/heartbeat.mp3");
sound2 = new SoundFile(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_invito.WAV");
NemoBimboMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_bimbo.mp4");
NemoShapeMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_shape.mp4");
AdelaideBimbaMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/adelaide_bimba.mp4");
FirstInteractionMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/firstinteraction.mp4");
//In CurrentMovie tengo traccia di quale video é in play al momento.
//Il promo dei due video che penso tu voglia far partire sia NemoShapeMovie
CurrentMovie=NemoShapeMovie;
}
public void draw(){
image(NemoBimboMovie, 839,0, 600,854);
image(NemoShapeMovie, 839,0, 600,854);
image(AdelaideBimbaMovie, 0,0, 600,854);
image(FirstInteractionMovie, 839,0, 600,854);
}
public void movieEvent(Movie m) {
m.read();
}
public void keyPressed() {
if (key == '1') {
sound1.play();
image (file,839,0,600, 854);
}
if (key == '2') {
sound2.play();
}
else if (key == '3') {
sound1.stop();
sound2.stop();
}
//Assumo che 'a' significhi che l'utente apra l'altra scatola e debba partire l'altro video
else if (key == 'a') {
double CurrentTime=CurrentMovie.time();//Ottengo a che punto sta il video corrente
CurrentMovie=NemoBimboMovie;
CurrentMovie.jump((float)CurrentTime);
}
//Assumo che 's' significhi quando l'utente si avvicina...Parte il video con la figura
else if (key == 's') {
double CurrentTime=CurrentMovie.time();//Ottengo a che punto sta il video corrente
CurrentMovie=NemoShapeMovie;
CurrentMovie.jump((float)CurrentTime);
}
else if (key == 'p') {
NemoBimboMovie.play();
}
else if (key == 'd') {
AdelaideBimbaMovie.play();
}
else if (key == 'f') {
FirstInteractionMovie.play();
}
}
public void settings() { size(1439,854); }
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "--present", "--window-color=#666666", "--stop-color=#cccccc", "prova_di_oggi" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}