Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +13 -9
templates/index.html
CHANGED
|
@@ -175,15 +175,19 @@
|
|
| 175 |
});
|
| 176 |
}
|
| 177 |
const FPS = 22;
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
socket.on('response_back', function(image){
|
| 189 |
const image_id = document.getElementById('image');
|
|
|
|
| 175 |
});
|
| 176 |
}
|
| 177 |
const FPS = 22;
|
| 178 |
+
|
| 179 |
+
// Update this code snippet in your existing frontend script
|
| 180 |
+
|
| 181 |
+
setInterval(() => {
|
| 182 |
+
var type = "image/jpeg"; // Fix the typo in 'image/jpg'
|
| 183 |
+
var video_element = document.getElementById("videoElement1");
|
| 184 |
+
var frame = capture(video_element, 1);
|
| 185 |
+
var data = frame.toDataURL(type);
|
| 186 |
+
|
| 187 |
+
// Emit the image data to the backend using 'stream_frame' event
|
| 188 |
+
socket.emit('stream_frame', data);
|
| 189 |
+
}, 10000/FPS);
|
| 190 |
+
|
| 191 |
|
| 192 |
socket.on('response_back', function(image){
|
| 193 |
const image_id = document.getElementById('image');
|