I am using google colab to capture webcam video. I am using Promises to start and end the video on click. I want to stop capturing video every 5 seconds using a Promise.
// start recording
await new Promise((resolve) => {
capture.onclick = resolve;
});
recorder.start();
capture.replaceWith(stopCapture);
// use a promise to tell it to stop recording
// I want to stop recording every 5 seconds here instead of on click
await new Promise((resolve) => stopCapture.onclick = resolve);
recorder.stop();