Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupt "mp3" audio is really webm #54

Closed
theDanielJLewis opened this issue Jul 3, 2023 · 7 comments
Closed

Corrupt "mp3" audio is really webm #54

theDanielJLewis opened this issue Jul 3, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@theDanielJLewis
Copy link

Using the sample code, when I set downloadFileExtension="mp3", something is downloaded with a .mp3 file extension, but it's not an MP3. Attempting to play it yields only a loud corrupt sound.

The file is actually still a .webm and changing the extension to .webm makes it playable.

So what's the point of setting the extension to MP3 or WAV if it doesn't actually give an MP3 or WAV? Or is this simply broken?

@samhirtarif
Copy link
Owner

@theDanielJLewis - That is strange, this is something I had thoroughly tested. Thanks for bringing this up though.
Could you please share which browser and OS you were using when this happened?

@samhirtarif samhirtarif self-assigned this Jul 4, 2023
@samhirtarif
Copy link
Owner

I guess I was wrong in assuming the downloaded files actually are mp3 and wav just because they played successfully on windows, android and iOS. They are indeed in webm format, despite creating a new blob with the appropriate audio mime type for downloading.
I'll have to spend some time on this.

@theDanielJLewis
Copy link
Author

I'm guessing it's simply because that's how modern browsers now capture audio.

That I now know it records only in webm means I can find a way to handle the conversion to MP3. In my use case, the audio will be downloaded by someone other than the person who records it.

@samhirtarif
Copy link
Owner

Ah, I see. Sorry for the trouble caused.
I would be interested in knowing if you use some existing package/library for the webm to mp3 conversion.

@samhirtarif
Copy link
Owner

Fixed by Pull request #59
Would require the website to be cross-origin isolated. Otherwise, only webm format can be downloaded

@samhirtarif samhirtarif added the bug Something isn't working label Jul 8, 2023
@AwesomeZaidi
Copy link

@samhirtarif can you include an example of how to make say my website built in say Next JS, cross-origin isolated?

@Overdrive141
Copy link

@samhirtarif can you include an example of how to make say my website built in say Next JS, cross-origin isolated?

https://vercel.com/guides/fix-shared-array-buffer-not-defined-nextjs-react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants