Fix to be usable to firefox

- Firefox can only detect lower resolution capability of camera, adding the min resolution in the camera constraints enables it to work in firefox
This commit is contained in:
Afiq Hamzah
2023-05-25 13:49:47 +08:00
committed by afiq.hamzah
parent b5c092b73a
commit 82e631a5d1
+4 -3
View File
@@ -95,7 +95,6 @@ function marhunPhotoCapturerFactory(modal_selector) {
let enumerateDevices = () => navigator.mediaDevices.enumerateDevices()
.then(devices => devices.filter(x => x.kind === 'videoinput'))
.then(x => {console.log; return x;});
getUserMedia();
@@ -159,8 +158,9 @@ function marhunPhotoCapturerFactory(modal_selector) {
function composeConstraint(camera) {
let constraints = {
width: { exact: 3200 },
height: { exact: 1800 },
width: { min: 1280, max: 3200 },
height: { min: 720, max: 1800 },
aspectRatio: {exact: 1.7777777778},
};
if (camera.deviceId !== '') {
@@ -198,6 +198,7 @@ function marhunPhotoCapturerFactory(modal_selector) {
}
function streamCameraView(stream) {
console.log(stream.getVideoTracks()[0].getSettings())
let modal = document.querySelector(modal_selector);
let videoTagPreview = modal.querySelector('.video-tag-overallmarhun.video-preview');
let videoTagData = modal.querySelector('.video-tag-overallmarhun.video-data');