Remove deprecated on determining camera on browser chrome/firefox implementations
This commit is contained in:
Vendored
+20
-15
@@ -27,8 +27,8 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
|
||||
let isfirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
if (isfirefox) {
|
||||
canvas.width = 1280;
|
||||
canvas.height = 720;
|
||||
canvas.width = 1920;
|
||||
canvas.height = 1080;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
getCamera: function () {
|
||||
function getCameraList() {
|
||||
let getUserMedia = () => navigator.mediaDevices.getUserMedia({ video: { width: 3256, height: 2440 } });
|
||||
|
||||
let enumerateDevices = () => navigator.mediaDevices.enumerateDevices()
|
||||
.then(devices => devices.filter(x => x.kind === 'videoinput'))
|
||||
getUserMedia();
|
||||
@@ -128,12 +127,17 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
|
||||
});
|
||||
|
||||
const filteredCameraChrome = available_cameras.filter(camera => {
|
||||
return marhun_camera_config_chrome.includes(camera.label);
|
||||
let isfirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
if (isfirefox) {
|
||||
return available_cameras.slice(-1);
|
||||
}
|
||||
|
||||
const filteredCamera = available_cameras.filter(camera => {
|
||||
return marhun_camera_config.includes(camera.label);
|
||||
})
|
||||
|
||||
// Get the first available priority referencing to env
|
||||
return filteredCameraChrome.at(-1);
|
||||
return filteredCamera.at(-1);
|
||||
}
|
||||
|
||||
function selectCamera(listOfCameras) {
|
||||
@@ -150,17 +154,11 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
let constraints = null;
|
||||
|
||||
constraints = {
|
||||
width: { exact: 3200 },
|
||||
height: { exact: 1800 },
|
||||
width: { min: 1280, ideal: 3200, max: 3200},
|
||||
height: { min: 720, ideal: 1800, max: 1800 },
|
||||
frameRate: 30,
|
||||
};
|
||||
|
||||
let isfirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
if (isfirefox) {
|
||||
constraints = {
|
||||
width: { exact: 1280 },
|
||||
height: { exact: 720 },
|
||||
};
|
||||
}
|
||||
|
||||
if (camera.deviceId !== '') {
|
||||
constraints.deviceId = { exact: camera.deviceId };
|
||||
@@ -168,10 +166,17 @@ function marhunPhotoCapturerFactory(modal_selector) {
|
||||
|
||||
}
|
||||
|
||||
if (camera.groupId !== '') {
|
||||
constraints.groupId = { exact: camera.groupId };
|
||||
return navigator.mediaDevices.getUserMedia({ video: constraints });
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return getCameraList()
|
||||
.then(selectCamera)
|
||||
.then(x => { console.log(x); return x; })
|
||||
.then(composeConstraint);
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user