Hey guys, I'm doing a project in processing where I use the Video library to play a video when a sensor in processing captures movement.
The problem is that everytime I run the sketch the audio starts immediatly without the video showing and then keeps looping. But if the sensor captures movement the video actually appears, so that part I think it's well implemented.
I made the video in After Effects, which is basically a video wall with a lot of clips from youtube and I'm exporting it as a quicktime movie, I've tried different codecs but the problem continues.
Does anyone have a clue of what could be happening?
Here it's the code I'm using
import processing.serial.*;
import cc.arduino.*;
import processing.video.*;
Movie pCare;
Arduino arduino;
boolean pCareSwitch=false;
boolean firstActivated = true;
int counterStart = 0;
void setup() {
background(0);
size(1920, 1080,P2D);
arduino = new Arduino(this, Arduino.list()[0], 57600);
pCare=new Movie(this, "comp1.mov");
pCare.stop();
arduino.pinMode(12, arduino.INPUT);
// wait 10 seconds before start
for(int i = 0; i < 10; i++){
delay(1000);
int buttonValueTest = arduino.digitalRead(12);
println("loading " + buttonValueTest);
}
println("START");
}
void draw() {
int buttonValue = arduino.digitalRead(12);
//println(buttonValue);
// when the sensor is first activated
if (buttonValue==1 && firstActivated == true) {
println("Play Video");
pCareSwitch=true;
firstActivated = false;
pCare.play();
pCare.jump(0.0);
}
// now the video starts
if(pCareSwitch==true){
image(pCare, 0, 0,1920, 1080);
println("The Movie is " + pCare.duration() + " long and now its at: " + pCare.time());
Hi guys, I'm kinda new with programming and as well with processing, but I'm trying to develop a project where a video starts playing when a mouse button is pressed and it stops when the button is pressed again...but if I pressed one more time the video would start from the beginning and so on.
I tried using the stop() function but then if I use it I don't know how can I play it back again once the button is pressed.
Basically the idea was: Press - Starts, Press- Stops, Press- Stars again from the beginning, Press- Stops...and so on.
Maybe it's a simple thing to do (or not), but until now I didn't figure it out.
Any ideas? Suggestions?