Spaces:
Sleeping
Sleeping
Update select_back_camera.js
Browse files- select_back_camera.js +13 -10
select_back_camera.js
CHANGED
@@ -1,12 +1,15 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
-
}
|
10 |
-
console.error('Error accessing the camera', error);
|
11 |
-
});
|
12 |
|
|
|
1 |
+
async function access_webcam_modified(): Promise<void> {
|
2 |
+
try {
|
3 |
+
const constraints = {
|
4 |
+
video: { facingMode: "environment" }, // Request the back camera
|
5 |
+
audio: include_audio
|
6 |
+
};
|
7 |
+
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
8 |
+
video_source.srcObject = stream;
|
9 |
+
video_source.play();
|
10 |
+
// Other setup code as needed
|
11 |
+
} catch (err) {
|
12 |
+
// Error handling
|
13 |
}
|
14 |
+
}
|
|
|
|
|
15 |
|