2

I am trying to add voice record feature in a chat application ,I have tried this package react-mic it work fine and it give me this data when I stopped the record enter image description here

I want now to send this as a binary file to the backend I have tried this

  let name = `test.ogg`
  let lastModified = new Date()
  let file = new File([{...audioData.blob,name,lastModified}],name,{
    type:"audio/ogg"
  })

but it didn't work as expected It change it to binary but it is not a valid file because when I try to change it and played it in the browser it didn't work ,I have read alot of articles but nothing help

and for the method I used I have follow this article https://pqina.nl/blog/convert-a-blob-to-a-file-with-javascript/

1 Answer 1

3

I will put this here in case someone want to do the same thing

After trying alot with different packages I used the MediaStream Recording api it is really easy to use and it give me the result I want

This is the url for the documentation https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.