Activate webcam x seconds after mouse is pressed (frameCount)

Hi all,

I want to play a video and a few seconds into the video, I want the webcam to activate for 5 seconds and disappear again. I got it working to the point where the video plays and the webcam activates after 600 frames, but I want the webcam to activate 600 frames AFTER the mousePressed.
Is there a way I can count from the point the mouse is pressed?
This is my code so far:

let vid;
var cap;

function setup() {
  createCanvas(1920,1080);
  vid = createVideo("testVid.mp4"); 
  vid.hide();
  cap = createCapture(VIDEO);
  cap.hide();
}

function draw() {
  background(0);
  image(vid, 10, 10);
  if (frameCount > 600){
    image(cap,100,100, 320, 240);
}
 if (frameCount > 900){
   cap.hide();
 image (vid, 0,0);
 }
}

function mousePressed() {
  vid.loop(); 
  
}

global var: int frameMouse=-1;

in mousePressed function : frameMouse= frameCount ;

then in draw() say if (frameCount - frameMouse > 600 && frameMouse>0) ....