fix(browser): use navigator.mediaDevices.getUserMedia (#810)

This commit is contained in:
jcesarmobile 2022-09-30 00:59:27 +02:00 committed by GitHub
parent d0d46c151c
commit d0545c879f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 :(');