Reputation: 528
Needed to send mediaBlobUrl to the server:
const {
mediaBlobUrl
} = useReactMediaRecorder({
audio: true,
});
Upvotes: 2
Views: 5697
Reputation: 528
Thats how you can get blob from mediaBlobUrl or change mediaBlobUrl to blob:
const handleSave = async () => {
const audioBlob = await fetch(mediaBlobUrl).then((r) => r.blob());
const audioFile = new File([audioBlob], 'voice.wav', { type: 'audio/wav' });
const formData = new FormData(); // preparing to send to the server
formData.append('file', audioFile); // preparing to send to the server
onSaveAudio(formData); // sending to the server
};
Upvotes: 3