var videoElement = $(“video”)[0];
videoElement.play(); //播放控制
videoElement.addEventListener(“canplay”, function (_event) {
var canvas = document.createElement(“canvas”);
canvas.width = videoElement.videoWidth*0.25;
canvas.height = videoElement.videoHeight*0.25;
console.log(videoElement.videoWidth)
canvas.getContext(‘2d’).drawImage(videoElement, 0, 0, canvas.width, canvas.height);
var img = document.createElement(“img”);
img.src = canvas.toDataURL(“image/png”);
$(“#output”).html(img);
console.log(img.src);
});