Opencv.js how to get a frame from cv.read and past to a API od face recognition?

Hello,

I have a python code to face recognition working fine. but now I am trying to implement a webpage that will capture a frame using opencv.js and them execute a ajax POST passing this frame capture to my recognition API.

My question is: are there any way in javascript to create a var frame variavel as Frame = cv.read() por example and this Frame passing to my API?

I tried to get da Frame variable value and when I am debugging daesnt happend.

this is my code example

let video = document.getElementById(‘videoInput’);
let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let dst = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let cap = new cv.VideoCapture(video);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            src.delete();
            dst.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        Frame = cap.read(src); #Here I tried to get de value but cap.read doesn not set the Frame variable  
        let frameleitura = Frame 
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

please try to follow the opencv.js tutorials as close as possible

(e.g. cap.read(src) reads an image into src, and returns a bool from grab)