jeudi 22 janvier 2015

Play Base64 encoded audi file in java

I have a string that contains a base64 encoded mp3 file. I want to decode that file then play it.



File file = new File("song.wav");
byte[] bytes = FileUtils.readFileToByteArray(file);

String encoded = Base64.encodeToString(bytes, 0);
byte[] decoded = Base64.decode(encoded, 0);
AudioInputStream audioIn = AudioSystem.getAudioInputStream(/*what do i do here?*/);
Clip song = /*what do i do here?*/;
song.start;


I now i have the byte array ready. How can I use this decoded byte array to play music using clip or audioinputstr


Aucun commentaire:

Enregistrer un commentaire