diff --git a/.env.example b/.env.example
index 23d018ea..4746e566 100644
--- a/.env.example
+++ b/.env.example
@@ -299,8 +299,9 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
-MARHUN_CAMERAS = "Doccamera"
+MARHUN_CAMERAS_CHROME = "Doccamera"
+MARHUN_CAMERAS_FIREFOX = "jSsq68fCLg2guCV2FaFzvXXiKBqbPA25DaQAWWotfqY="
WABOT_API=https://md.wabot.my/api/send.php
WABOT_INSTANCES_ID=63C26B7AAD21A
-WABOT_TOKEN_KEYS=cbee7e95cf3ffbfa0531d5fddfd44f87
\ No newline at end of file
+WABOT_TOKEN_KEYS=cbee7e95cf3ffbfa0531d5fddfd44f87
diff --git a/config/marhun_camera.php b/config/marhun_camera.php
index a3c2f753..cbefd17e 100644
--- a/config/marhun_camera.php
+++ b/config/marhun_camera.php
@@ -1,7 +1,6 @@
array_map(fn ($camera_label) => trim($camera_label), explode(',', env('MARHUN_CAMERAS'))) ?? 'Doccamera'
-
+ 'marhun_cameras_chrome' => array_map(fn ($camera_label) => trim($camera_label), explode(',', env('MARHUN_CAMERAS_CHROME'))) ?? 'Doccamera',
+ 'marhun_cameras_firefox' => array_map(fn ($camera_label) => trim($camera_label), explode(',', env('MARHUN_CAMERAS_FIREFOX'))) ?? "jSsq68fCLg2guCV2FaFzvXXiKBqbPA25DaQAWWotfqY="
];
diff --git a/public/js/marhun-photo-capture.js b/public/js/marhun-photo-capture.js
index eb0da36b..9c1913e7 100644
--- a/public/js/marhun-photo-capture.js
+++ b/public/js/marhun-photo-capture.js
@@ -98,12 +98,20 @@ function marhunPhotoCapturerFactory(modal_selector) {
});
- const filtered = available_cameras.filter(camera => {
- return marhun_camera_config.includes(camera.label);
+ const filteredCameraChrome = available_cameras.filter(camera => {
+ return marhun_camera_config_chrome.includes(camera.label);
})
+ const filteredCameraFirefox = available_cameras.filter(camera => {
+ return marhun_camera_config_firefox.includes(camera.deviceId);
+ });
+
+ if(filteredCameraFirefox.length > 0){
+ return filteredCameraFirefox.at(-1);
+ }
+
// Get the first available priority referencing to env
- return filtered.at(-1);
+ return filteredCameraChrome.at(-1);
}
function selectCamera(listOfCameras) {
@@ -118,14 +126,20 @@ function marhunPhotoCapturerFactory(modal_selector) {
function composeConstraint(camera) {
+ let constraints = {
+ width: {min: 640, ideal: 1920},
+ height: {min: 400, ideal: 1080},
+ aspectRatio: {ideal: 1.7777777778},
+ };
+
if(camera.deviceId !== ''){
- constraints = { deviceId: { exact: camera.deviceId } };
+ constraints.deviceId = { exact: camera.deviceId };
return navigator.mediaDevices.getUserMedia({ video: constraints });
}
if(camera.groupId !== ''){
- constraints= { groupId: { exact: camera.groupId } };
+ constraints.groupId = { exact: camera.groudId };
return navigator.mediaDevices.getUserMedia({ video: constraints });
}
@@ -140,7 +154,6 @@ function marhunPhotoCapturerFactory(modal_selector) {
initiateTakeMarhunPhoto: function () {
if ('mediaDevices' in navigator && navigator.mediaDevices.getUserMedia) {
-
function showCaptureMarhunModal() {
let modal = document.querySelector(modal_selector);
diff --git a/resources/views/marhun/marhun.blade.php b/resources/views/marhun/marhun.blade.php
index 4795abeb..4e66248a 100644
--- a/resources/views/marhun/marhun.blade.php
+++ b/resources/views/marhun/marhun.blade.php
@@ -1,12 +1,14 @@
@extends('layouts.app')
@push('additional_scripts')
-
+
+