Shazam

FREEMIUM
Verified
By Api Dojo | Updated 5 days ago | Music
Popularity

9.8 / 10

Latency

1,878ms

Service Level

99%

Health Check

N/A

Back to All Discussions

What mimeType should i use in mediaRecorder(js) to get base64?

Rapid account: Holongyinronald
holongyinronald
a year ago

const onsuccess = (stream) => {
const options = {
audioBitsPerSecond : 44100*16,
mimeType: ‘text/plain’
}
const mediaRecorder = new MediaRecorder(stream, options);
recorder = mediaRecorder;

recorder.start(); // Starting the record

recorder.ondataavailable = (e) => {
    // Converting audio blob to base64
    let reader = new FileReader()
    reader.onloadend = () => {
        console.log(reader.result);
        // You can upload the base64 to server here.
    }

    reader.readAsDataURL(e.data);
}

}

My code

Rapid account: Asifuzzamanbappy
asifuzzamanbappy Commented a year ago

@holongyinronald

were you able to make it to work?!

im facing something similar, im using “mediaDevice” recording from browser, and storing it as a “blob” and then converting it to “base64” before sending it to “api server” but getting “unsupported / no matches” response back

any feedback or suggestion is appreciated regarding this matter, happy coding 😃

Rapid account: Apidojo
apidojo Commented a year ago

Hello,

I am sorry that I cannot help you with coding. You may check the tutorial at https://rapidapi.com/apidojo/api/shazam/tutorials
There is embedded example, you may use the sample to compare the one generated from your code.

Regards.

Join in the discussion - add comment below:

Login / Signup to post new comments