0

I'm trying to encode a blob audio file to base64 in ReactJS , but the following code is producing an error:

submit(blob) {
        console.log("BLOB", blob)
        // var blob = new Blob([blob])
        var reader = new FileReader();
        reader.readAsDataURL(blob);
        reader.onloadend = function () {
            var base64data = reader.result;
            console.log(base64data);
        }

I have tried every trick but I am still getting the error TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.

BLOB: enter image description here

1 Answer 1

1

try doing:

reader.readAsDataURL(blob.blob);

Looks like you need to go one more step to access the actual blob

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.