JSFiddle - React, Tailwind, and code Playground

HTML

video:
<br>
<video id=video autoplay playsinline width=160px></video>
<br>
canvas:
<br>
<canvas id=canvas width=160 height=120></canvas>
<br>
<div id=logDiv></div>

JavaScript

let countFrames = 0;
function checkFramesCounting()
{
    video.requestVideoFrameCallback(() => {
        logDiv.innerHTML = "video frame count: " + ++countFrames;
        checkFramesCounting();
        canvas.getContext('2d').drawImage(video, 0, 0, 160, 120);
    });
}

navigator.mediaDevices.getUserMedia({ video: true}).then(async s => {
		video.srcObject = s;
    checkFramesCounting();
    await video.play();
    setTimeout(() => video.srcObject.getVideoTracks()[0].enabled = false, 1000);
});