Spaces:
Runtime error
Runtime error
Create index.html
Browse files- index.html +12 -0
index.html
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script>
|
2 |
+
const ws = new WebSocket("ws://localhost:8000/ws");
|
3 |
+
navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => {
|
4 |
+
const mediaRecorder = new MediaRecorder(stream);
|
5 |
+
mediaRecorder.ondataavailable = (e) => ws.send(e.data);
|
6 |
+
mediaRecorder.start(250); // Send chunks every 250 ms
|
7 |
+
});
|
8 |
+
ws.onmessage = (event) => {
|
9 |
+
document.getElementById("output").textContent += event.data + " ";
|
10 |
+
};
|
11 |
+
</script>
|
12 |
+
<div id="output"></div>
|