0

我创建了这个简单的代码来打开一个 mp3 文件:

import java.io.IOException;

import com.mpatric.mp3agic.InvalidDataException;
import com.mpatric.mp3agic.Mp3File;
import com.mpatric.mp3agic.UnsupportedTagException;

public class Gestore {

    public static void main(String[] Args) throws UnsupportedTagException, InvalidDataException, IOException {
    
        Mp3File mp3file = new Mp3File("SomeMp3File.mp3");
        System.out.println("Length of this mp3 is: " + mp3file.getLengthInSeconds() + " seconds");
        System.out.println("Bitrate: " + mp3file.getBitrate() + " kbps " + (mp3file.isVbr() ? "(VBR)" : "(CBR)"));
        System.out.println("Sample rate: " + mp3file.getSampleRate() + " Hz");
        System.out.println("Has ID3v1 tag?: " + (mp3file.hasId3v1Tag() ? "YES" : "NO"));
        System.out.println("Has ID3v2 tag?: " + (mp3file.hasId3v2Tag() ? "YES" : "NO"));
        System.out.println("Has custom tag?: " + (mp3file.hasCustomTag() ? "YES" : "NO"));
    
    }

}

当我尝试执行时,出现错误:

Exception in thread "main" java.io.IOException: Negative seek offset
    at java.io.RandomAccessFile.seek(Unknown Source)
    at com.mpatric.mp3agic.Mp3File.initId3v1Tag(Mp3File.java:251)
    at com.mpatric.mp3agic.Mp3File.init(Mp3File.java:80)
    at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:55)
    at com.mpatric.mp3agic.Mp3File.<init>(Mp3File.java:42)
    at Gestore.main(Gestore.java:12)

我尝试用谷歌搜索这个错误,但我无法解决。

4

0 回答 0