use-media-recorder icon indicating copy to clipboard operation
use-media-recorder copied to clipboard

Specifying a codec for the mimetype results in an error when trying to playback the blob in Safari

Open willdspd opened this issue 3 years ago • 6 comments

With the native MediaRecorder api, you can specify a codec for the mimetype with the following syntax: 'audio/mp4; codecs=mp4a.40.2'. This doesn't seem possible in the blobOptions object based on my tests. In Safari, I get the word 'Error' in the UI of the simple html audio element when trying to playback the blob.

willdspd avatar Feb 01 '22 20:02 willdspd

Hi @williamdespard Apologies for the wait Unfortunately can't debug or patch this since the os im currently on doesn't support safari

Thanks for filing this though Would really appreciate info on anything else you encounter

Feel free to pull request if you have ideas or patches 🤝

{•!•}/

wmik avatar Mar 02 '22 13:03 wmik

Thanks for the response @wmik ! Should this syntax work in other browsers? Or is messing with the codec type not something you've stress tested?

willdspd avatar Mar 02 '22 13:03 willdspd

Haven't stress tested all possible codecs since I'm not sure they're universally supported across browser But we currently have a simple check to warn the user if the codec isn't supported on their browser here:

https://github.com/wmik/use-media-recorder/blob/9b42d31ac25772554591e24edd05f7b6e8ff3ae0/index.js#L271-L274

Here are some useful links in case you're interested in investigating further:

Feel free to experiment and reach out for any further assistance

Cheers

\{•!•}/

wmik avatar Mar 03 '22 06:03 wmik

Sorry for the slow reply @wmik. I'm currently working on a project (using your library) so I don't have the time to look into this right now. But, this may become more of an issue for us in a few weeks/months so I may be able to get around to it then. What is for sure is that your library seems to be the best react hook based implementation of the Media Recorder API, and for anyone using it seriously, specifying codecs and mimetypes in a formalised way is really essential, beyond a hobby project. Great work so far!

willdspd avatar Apr 16 '22 20:04 willdspd

Thanks for the feedback @williamdespard 🤝 Glad it's turning out to be a useful tool 🙇 And I appreciate you taking the time to help make it better 🥳 No rush

Most of the credit goes to the author of react-media-recorder Their work inspired this library

wmik avatar Apr 18 '22 06:04 wmik

Origin story 😂 https://github.com/0x006F/react-media-recorder/issues/12

wmik avatar Apr 18 '22 06:04 wmik