获取视频截图

1、使用canvas对video元素进行截图

function  getVideoFrame(video){
 const canvas = document.createElement("canvas");
 canvas.width = video.videoWidth;
 canvas.height =video.videoHeight;
 canvas.getContext("2d").drawImage(video, 0, 0);
 return canvas.toDataURL("image/png");
}

 

posted @ 2023-05-31 11:53  webHYT  阅读(47)  评论(0)    收藏  举报