I'm trying to play one of two videos based on sensor from Arduino (for a University project)
The issue is that I can't see any of the videos in Processing but I only hear the audio.
I rendered the videos using the H264 codec and they are in Full HD. I am using Processing 4.1.1.
This is my attempt at playing back video based on sensor values:
import processing.serial.*;
import processing.video.*;
Movie movie1, movie2;
boolean playing = false;
char previousIn;
Serial mySerial;
String myString = null;
int nl = 10;
float myVal;
void setup() {
size(1000, 1000);
frameRate(25);
String myPort =Serial.list()[2];
mySerial = new Serial(this, myPort, 9600);
movie1 = new Movie(this, "Final_Clips_HD.mp4");
movie2 = new Movie(this, "Final_Clips_HD_2.mp4");
}
void movieEvent(Movie movie) {
movie.read();
}
void draw() {
while (mySerial.available() > 0) {
myString = mySerial.readStringUntil(nl);
if (myString != null) {
myVal = float(myString);
println(myVal);
if (myVal > 10 && myVal < 20) {
movie1.play();
movie2.stop();
myVal = previousIn;
if (myVal == previousIn) {
movie1.jump(0);
}
}
image(movie1, 0, 0, width, height);
//fill(0,255,0);
if (myVal < 10 && myVal > 0) {
movie2.play();
movie1.stop();
myVal = previousIn;
if (myVal == previousIn) {
movie2.jump(0);
}
}
image(movie2, 0, 0, width, height);
}
}
}