Video Sound Problem
in
Contributed Library Questions
•
1 year ago
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());
- }
- // if the video is finished
- if(pCare.time() >= pCare.duration()){
- println("Video at the end");
- pCareSwitch=false;
- pCare.stop();
- background(0);
- }
- //
- if(buttonValue==0 ){
- firstActivated = true;
- }
- }
- void movieEvent(Movie m) {
- m.read();
- }
1