mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 19:22:51 +08:00
fix(browser): use navigator.mediaDevices.getUserMedia (#810)
This commit is contained in:
parent
d0d46c151c
commit
d0545c879f
@ -111,7 +111,11 @@ function capture (success, errorCallback, opts) {
|
|||||||
document.body.appendChild(parent);
|
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);
|
navigator.getUserMedia({ video: true, audio: false }, successCallback, errorCallback);
|
||||||
} else {
|
} else {
|
||||||
alert('Browser does not support camera :(');
|
alert('Browser does not support camera :(');
|
||||||
|
Loading…
Reference in New Issue
Block a user