Skip to content

Commit

Permalink
tweak: new blob
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAroo committed Nov 27, 2023
1 parent d04042a commit 115760a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,15 @@ const Playground = () => {
mediaRecorderRef.current.start()

intervalRef.current = setInterval(() => {
console.log("requesting data")
mediaRecorderRef.current?.requestData()
}, 5000)

mediaRecorderRef.current.ondataavailable = (event) => {
if (event.data.size > 0 && socket?.connected) {
socket.emit(SEND_AUDIO_CHUNKS, event.data)
console.log(0, event.data)
const blob = new Blob([event.data], { type: "audio/wav" })
socket.emit(SEND_AUDIO_CHUNKS, blob)
}
}
} catch (error) {
Expand Down

0 comments on commit 115760a

Please sign in to comment.