TypeError: Illegal constructor.
See original GitHub issueHi, I get the following error:
TypeError: Illegal constructor.
when I do the following:
const detection = await faceapi.detectSingleFace(video);
video is basically an HTML element (document.getElementById(“video-stream”)) I also tried passing an id to the faceapi.detectSingleFace, same error.
I am using node v10.15.0, webpack, babel and React.
I had an error about tensorflow saying that fs module could not be resolved, but I guess this is not related. Just in case…
Here is the full code:
async function detectFaces(video, canvas, width, height) {
window.logger.log("detectFaces");
const detection = await faceapi.detectSingleFace(video);
console.log(detection);
}
function loadVideo(video, canvas, width, height) {
window.logger.log("loadVideo");
navigator.mediaDevices.getUserMedia({
video: {
width : width,
height: height
}
}).then(function(stream) {
video.srcObject = stream;
video.play();
video.onloadedmetadata = function() {
detectFaces(video, canvas, width, height);
}
}).catch(function(error) {
console.log(error);
});
}
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to solve "Uncaught TypeError: Illegal constructor"
The Illegal constructor error is thrown when a class extends HTMLElement, but is instantiated like a regular class. Using classes that inherits from ......
Read more >Illegal constructor with EcmaScript 6 - javascript - Stack Overflow
So, new UserAvatar will fail with Illegal constructor. To fix it, define it first: customElements.define('tom-user-avatar', UserAvatar);.
Read more >Uncaught TypeError: Illegal constructor in Chrome when a ...
I'm running into a frustrating problem with some custom elements I'm defining and am hoping for some bread crumbs from someone with a...
Read more >1186698 - PeerConnection.js: TypeError: Illegal constructor
The answer is that an error is reported to the web console (and to the page's onerror handler), just without useful location information....
Read more >HTML : Only on Chrome I got this error: Uncaught TypeError
HTML : Only on Chrome I got this error: Uncaught TypeError : Illegal constructor [ Beautify Your Computer ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes , I put this in my code and it works: faceapi.env.monkeyPatch({ Canvas: HTMLCanvasElement, Image: HTMLImageElement, ImageData: ImageData, Video: HTMLVideoElement, createCanvasElement: () => document.createElement(‘canvas’), createImageElement: () => document.createElement(‘img’) })
You must set options for that like tinyModel or Yolyo