Spaces:
Runtime error
Runtime error
<script> | |
const ws = new WebSocket("ws://localhost:8000/ws"); | |
navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => { | |
const mediaRecorder = new MediaRecorder(stream); | |
mediaRecorder.ondataavailable = (e) => ws.send(e.data); | |
mediaRecorder.start(250); // Send chunks every 250 ms | |
}); | |
ws.onmessage = (event) => { | |
document.getElementById("output").textContent += event.data + " "; | |
}; | |
</script> | |
<div id="output"></div> |