C#C
C#3y ago
Danielcik

Weird ToBase64String behavior

I have an mp3 file, which is perfectly normal, and plays fine.

I use this code to convert it to a base64 string:

 Byte[] bytes = await File.ReadAllBytesAsync("video.mp3");
        String file = Convert.ToBase64String(bytes);


When I try to play it as an audio in JS, it only plays 3 seconds, and then skips to the end.
I also tried to use https://base64.guru/converter/decode/file to see if it will be different, I paste the base64 string, but it isn't, it plays 3 seconds, then stops.

What am I doing wrong?
Decode Base64 to file online using a free decoding tool
Was this page helpful?