You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var videoId = 'videoel'; <--
var scaleFactor = 1;
var snapshots = [];
/**
* Captures a image frame from the provided video element.
*
* @param {Video} video HTML5 video element from where the image frame will be captured.
* @param {Number} scaleFactor Factor to scale the canvas element that will be return. This is an optional parameter.
*
* @return {Canvas}
*/
function capture(video, scaleFactor) {
if (scaleFactor == null) {
scaleFactor = 1;
}
var w = video.videoWidth * scaleFactor;
var h = video.videoHeight * scaleFactor;
var canvas = document.createElement('canvas');
canvas.width = w;
canvas.height = h;
var ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, w, h);
return canvas;
}
/**
* Invokes the <code>capture</code> function and attaches the canvas element to the DOM.
*/
function shoot() {
html2canvas(document.querySelector("#capture")).then(canvasr => {
document.body.appendChild(canvasr)
});
var video = document.getElementById(videoId);
var output = document.getElementById('output');
var canvas = capture(video, scaleFactor);
canvas.onclick = function () {
window.open(this.toDataURL());
};
snapshots.unshift(canvas);
output.innerHTML = '';
for (var i = 0; i < 4; i++) {
output.appendChild(snapshots[i]);
}
}
The text was updated successfully, but these errors were encountered:
There are 2 canvases (is that the correct plural???) that are lying over the video tag. So you would need to merge the video with the overlay canvas. This should work by drawing the content of the canvas with the ID 'webgl' (Line 110) in your newly formed canvas element.
Hi, i was trying take a shot using this code in https://www.auduno.com/clmtrackr/examples/face_mask.html but the screen show only WebCan without mask, could you helpme?¿
CODE:
The text was updated successfully, but these errors were encountered: