Hi, I am a student and struggling to figure out what is wrong with my programme. It is simply to play/pause a video at the press of the space bar however it doesn’t seem to continue not playing when the spacebar is released?
Here is the code:
import processing.video.*; //
Movie myVideo; // 
void setup() {
   
  ;
  myVideo = new Movie(this, "transit.mov");
  surface.setResizable(true);
  surface.setSize(640,360);
  background(0);
  myVideo.loop();
    
}
//this function selects which video to read ( in this case there's only one)
void movieEvent(Movie m) { 
  myVideo.read();  
}
void draw() {    
  image(myVideo, 0, 0); //
  
  if(keyPressed == false){
  if (key == ' '|| key == ' '){
    myVideo.play(); //
    }
     }
    else if (keyPressed == true){
    if (key == ' '|| key == ' '){
    myVideo.pause();
    }
    }
}
If anyone could help that would be amazing thanks!