You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by jc...@apache.org on 2022/09/28 21:37:57 UTC
[cordova-plugin-camera] 01/01: fix(browser): use navigator.mediaDevices.getUserMedia CB-12064
This is an automated email from the ASF dual-hosted git repository.
jcesarmobile pushed a commit to branch CB-12064
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git
commit 250dd45957e8a2162e3c3dab81ef7cdb9bc337ec
Author: Julio César <jc...@gmail.com>
AuthorDate: Wed Sep 28 23:37:29 2022 +0200
fix(browser): use navigator.mediaDevices.getUserMedia CB-12064
---
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..df610d9 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 :(');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org