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('')}`; diff --git a/public/js/marhun-photo-capture.js b/public/js/marhun-photo-capture.js index 23fc6412..eb0da36b 100644 --- a/public/js/marhun-photo-capture.js +++ b/public/js/marhun-photo-capture.js @@ -117,8 +117,18 @@ function marhunPhotoCapturerFactory(modal_selector) { } function composeConstraint(camera) { - var constraints = { deviceId: { exact: camera.deviceId } }; - return navigator.mediaDevices.getUserMedia({ video: constraints }); + + if(camera.deviceId !== ''){ + constraints = { deviceId: { exact: camera.deviceId } }; + return navigator.mediaDevices.getUserMedia({ video: constraints }); + } + + + if(camera.groupId !== ''){ + constraints= { groupId: { exact: camera.groupId } }; + return navigator.mediaDevices.getUserMedia({ video: constraints }); + } + } return getCameraList()