How to upload blob from audio recorder?
I've spent all day banging my head on my keyboard trying to upload an audio file to S3/B2 that was recorded from my React app. Then I remembered to try UploadThing.
But I've hit another brick wall. How do I upload a blob with UploadThing? I tried
startUpload([blob])
but it tells me, "Type 'Blob' is missing the following properties from type 'File': lastModified, webkitRelativePath."
(The audio blob comes from https://www.npmjs.com/package/react-audio-voice-recorder.)
My brain is mush now, so can you help me?
Thanks in advance!3 Replies
I don't use uploadThing yet, but my guess would be something like
Well, it seems my problem isn't actually with S3 or UploadThing, it's that I can't seem to convert my blob into any other format that still yields a usable file.
For example:
Returns:
I would expect the converted blob to be the same size as the original blob.
I've tried some kind of base64 string, too. While that's smaller than 74 KB (like in the above example), it's still about 25% bigger and still produces an unusable blob.
I don't think you should use as it does return text, but you are dealing in audio. Maybe try ?