Update marhun camera implementation

- add implementation to use camera with groupId if cameras with device label are unavailable
This commit is contained in:
afiq.hamzah
2023-01-03 11:09:25 +08:00
parent 99a6df9d7c
commit d0dabbda0c
+12 -2
View File
@@ -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()