Search code examples
javastreamingmp3

ID3v2 library for streaming mp3 files?


Hey,can anyone guide me to the easiest java mp3 library for reading ID3v2 tags.

Update 1:

I forgot to mention that I need to stream the mp3 on a seek bar and therefore need a mp3 library which can read length by downloading minimum content.


Solution

  • I've used mp3agic in the past.

    Simple enough?

    Mp3File mp3file = new Mp3File("SomeMp3File.mp3");
    System.out.println("Length of this mp3 in seconds is: " + mp3file.getLengthInSeconds());
    if(mp3file.hasId3v2Tag()) {
       ID3v2 id3v2tag = mp3file.getId3v2Tag();
       System.out.println("The artist in the ID3v2 tag is: " + id3v2tag.getArtist());
    
       id3v2tag.setArtist("A new artist");
       mp3file.save("ASavedMp3File.mp3");
       System.out("Saved mp3 file with new name and artist set to 'A new artist'");
    }