From d0545c879ff89e01130418b0c7cf91d4d3a0b522 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 30 Sep 2022 00:59:27 +0200 Subject: [PATCH] fix(browser): use navigator.mediaDevices.getUserMedia (#810) --- src/browser/CameraProxy.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/browser/CameraProxy.js b/src/browser/CameraProxy.js index 662ee7f..b75ff60 100644 --- a/src/browser/CameraProxy.js +++ b/src/browser/CameraProxy.js @@ -111,7 +111,11 @@ function capture (success, errorCallback, opts) { document.body.appendChild(parent); }; - if (navigator.getUserMedia) { + if (navigator.mediaDevices.getUserMedia) { + navigator.mediaDevices.getUserMedia({ video: true, audio: false }) + .then(successCallback) + .catch(errorCallback); + } else if (navigator.getUserMedia) { navigator.getUserMedia({ video: true, audio: false }, successCallback, errorCallback); } else { alert('Browser does not support camera :(');