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() {
  vid = createVideo("testVid.mp4"); 
  cap = createCapture(VIDEO);

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

function mousePressed() {

global var: int frameMouse=-1;

in mousePressed function : frameMouse= frameCount ;

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