Код: Выделить всё
var canvas: HTMLCanvasElement = document.createElement("canvas");
canvas.width = video.getInternalPlayer().width;
canvas.height = video.getInternalPlayer().height;
console.log("captureVideoFrame passed first step ...");
if (playerRef.current) canvas?.getContext('2d')?.drawImage(playerRef.current.getInternalPlayer().video, 0, 0);
< /code>
Но я получаю ошибку на последней строке: < /p>
Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or OffscreenCanvas or SVGImageElement or VideoFrame)'.
at captureVideoFrame (Player.tsx:187:58)
at myOnTimelineFileClickCallback (Player.tsx:135:9)
at onFileClick (Timeline.tsx:2252:38)
Подробнее здесь: https://stackoverflow.com/questions/797 ... eactplayer
Мобильная версия