Handle device camera image

Hello everyone, I’m new to the cocos creator and on the html + ts stack. I had a task to get an image from a mobile phone camera. I did not find standard methods for capturing images. On the expanses of the network, I found a js code that I use to create the video element and activate the camera.

if (navigator.getUserMedia)
{
navigator.getUserMedia( // Request the camera.
{ video: true }, // Constraints
( localMediaStream ) => // Success Callback
{
var video = document.querySelector(‘video’);
video.src = window.URL.createObjectURL(localMediaStream);
video.onloadedmetadata = (e) =>
{ /* Do something with the video here. */ };
}
}

Next, I would like every frame to receive data from this element and create a texture. For example, save the data in RenderTexture, then pass the spriteFrame object as an argument to the setTexture method. If there are any ideas or suggestions, I will be very grateful.