Skip to content
Advertisement

Decode Base 64 audio file Mp3 into playable Mp3

I am converting the audio MP3 file and storing it as base64 in database using WEB API, now I am fetching the base64 file using ajax and I am getting the base64, the problem is how can I convert the base64 file back to mp3 file and play it using JavaScript.

This if for demo I am using input file, I am getting base64 file from server

JavaScript
JavaScript

This function “contvertBase64toBinaray” using for converting base64 to Binary, I have binary file, need to save as mp3 from this below binary

JavaScript

Advertisement

Answer

Use window.atob function to decode your base 64 data.

This question shows you how you can play the mp3 in JS.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement