1
DOM에서 모든 비디오를 가져오고 각 비디오의 스크린 샷을 찍은 다음 각각을 다른 캔버스에 넣으려고합니다. JSFiddle 여기동영상에서 캡쳐 화면을 가져 와서 캔버스와 JS에 넣으십시오.
이 내 시도하지만이 오류 제공합니다
Uncaught TypeError: Cannot read property 'getContext' of undefined
어떤 생각 나는이 문제를 해결할 수있는 방법을?
var videoArray = [];
var canvasArray = [];
var c = jQuery('<canvas/>',{'width':373.64,'height':227.88}); //set canvas
jQuery('body').append(c); //append canvas to body
// push each video into an array
jQuery('video').each(function(){
videoArray.push(this);
});
//push each canvas into an array
jQuery('canvas').each(function(){
canvasArray.push(this);
});
//for each video in the array, take a snapshot of the video at position i and draw it
for(var i = 0; i < videoArray.length; i++){
canvasArray[i].getContext("2d").drawImage(videoArray[i], 0, 0, 300,200);
}
html 마크 업을 포함 할 수 있습니까? –
@Raghvendra Kumar 내가 JSFiddle을 업로드했는지 확인 https://jsfiddle.net/f21xxuw9/ – Sivvio