设置当前帧为封面

<input type="file" id="input" @change="chooseVideoInput" class="uploadVideo_input">

var video = document.getElementById("video");
var canvas = document.createElement("canvas");
var scale = 1;
canvas.width = video.videoWidth * scale;
canvas.height = video.videoHeight * scale;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
var img = document.createElement("img"); // 创建img
img.src = canvas.toDataURL("image/png"); // 设置图片src

  

posted @ 2018-07-26 09:37  世界,太精彩  阅读(336)  评论(0编辑  收藏  举报