From 99a6df9d7cb3d5ebe44476efb2982e02819f8dfa Mon Sep 17 00:00:00 2001 From: "afiq.hamzah" Date: Tue, 3 Jan 2023 11:06:36 +0800 Subject: [PATCH] Update marhun camera debugger - Fix debugger by showing groupId of camera if the camera label is not available --- public/js/marhun-photo-capture-debugger.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/public/js/marhun-photo-capture-debugger.js b/public/js/marhun-photo-capture-debugger.js index 7ba6bcea..8a4e9bdc 100644 --- a/public/js/marhun-photo-capture-debugger.js +++ b/public/js/marhun-photo-capture-debugger.js @@ -13,9 +13,26 @@ function marhunPhotoCapturerDebugger() { const generateCameraListing = (cameras) => { let title = "Available cameras: "; - let content = cameras.map((camera, index) => { + let mapCameraWithDeviceId = (index, camera) => { index = index + 1; - return `${index}. ${camera.label}\n`; + return `${index}. deviceLabel : ${camera.label}\n`; + } + + let mapCameraWithGroupId = (index, camera) => { + index = index + 1; + return `${index}. groupId : ${camera.groupId}\n`; + } + + let content = cameras.map((camera, index) => { + if(camera.deviceId !== ''){ + return mapCameraWithDeviceId(index, camera); + } + + if(camera.groupId !== ''){ + return mapCameraWithGroupId(index, camera); + } + + }); return `${title}\n${content.join('')}`;