Spaces:
Sleeping
Sleeping
Update index.html
Browse files- index.html +11 -8
index.html
CHANGED
@@ -40,14 +40,17 @@
|
|
40 |
const output = document.getElementById('output');
|
41 |
const captureButton = document.getElementById('capture');
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
51 |
|
52 |
captureButton.addEventListener('click', () => {
|
53 |
// Draw the video frame to the canvas
|
|
|
40 |
const output = document.getElementById('output');
|
41 |
const captureButton = document.getElementById('capture');
|
42 |
|
43 |
+
navigator.mediaDevices.getUserMedia({
|
44 |
+
video: {
|
45 |
+
facingMode: { exact: "environment" }
|
46 |
+
}
|
47 |
+
})
|
48 |
+
.then(stream => {
|
49 |
+
video.srcObject = stream;
|
50 |
+
})
|
51 |
+
.catch(err => {
|
52 |
+
console.error("Error accessing the camera: ", err);
|
53 |
+
});
|
54 |
|
55 |
captureButton.addEventListener('click', () => {
|
56 |
// Draw the video frame to the canvas
|