tchvu3 / capacitor-voice-recorder

Capacitor plugin for voice recording
69 stars 57 forks source link

Sending via http post request #31

Closed Zeusmist closed 1 year ago

Zeusmist commented 1 year ago

Hi @tchvu3 , Please how can I go about sending the data returned on recording stop as a file via HTTP post request? I have tried various ways to convert the base64 data into a blob file that can be sent as form data but I think I'm missing something because every day I've tried has either led to an error or a corrupted file that cannot be played.

I would appreciate it if you can give me a summary of how you intended for the data to be transferred via HTTP requests. Thank you in advance.

Zeusmist commented 1 year ago

BUMP @tchvu3 Just a summary would be appreciated.

Zeusmist commented 1 year ago

@tchvu3 I've been able to figure this out: I used the following code below to get the blob

const blob = await fetch( `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}` ).then((res) => res.blob());