We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bcb77cf + ef9af73 commit 1b140e3Copy full SHA for 1b140e3
src/dom/dom.js
@@ -2438,7 +2438,14 @@ p5.prototype.createCapture = function(...args) {
2438
catch(err) {
2439
domElement.src = stream;
2440
}
2441
- }, console.error);
+ }).catch(e => {
2442
+ if (e.name === 'NotFoundError')
2443
+ p5._friendlyError('No webcam found on this device', 'createCapture');
2444
+ if (e.name === 'NotAllowedError')
2445
+ p5._friendlyError('Access to the camera was denied', 'createCapture');
2446
+
2447
+ console.error(e);
2448
+ });
2449
2450
const videoEl = addElement(domElement, this, true);
2451
videoEl.loadedmetadata = false;
0 commit comments