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.
1 parent cf94f56 commit d5a3087Copy full SHA for d5a3087
src/dom/dom.js
@@ -2438,7 +2438,15 @@ p5.prototype.createCapture = function(...args) {
2438
catch(err) {
2439
domElement.src = stream;
2440
}
2441
- }, console.error);
+ }).catch(e => {
2442
+
2443
+ if (e.name === 'NotFoundError')
2444
+ p5._friendlyError('No webcam found on this device', 'createCapture');
2445
+ if (e.name === 'NotAllowedError')
2446
+ p5._friendlyError('Access to the camera was denied', 'createCapture');
2447
2448
+ console.error(e);
2449
+ });
2450
2451
const videoEl = addElement(domElement, this, true);
2452
videoEl.loadedmetadata = false;
0 commit comments