Danielcik
Danielcik
CC#
Created by Danielcik on 1/2/2023 in #help
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);
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?
1 replies