简体   繁体   English

MP3播放器,播放按钮没有声音

[英]MP3 Player, play button has no sound

I'm trying to get an mp3 play button to work using JLayer. 我正在尝试使用JLayer获取mp3播放按钮。 I get no errors but it doesn't play any sound. 我没有错误,但它没有播放任何声音。 I added all the required jar files to the library and followed many tutorials so the code should work but I just don't get any sound. 我将所有必需的jar文件添加到库中并遵循了许多教程,因此代码应该可以工作但我听不到任何声音。 (P/S: I don't have an mp3 plugin) (P / S:我没有mp3插件)

try
{
    JOptionPane.showMessageDialog(null,"Trying");
    FIS = new FileInputStream("C:\\Users\\Jun\\Documents\\NetBeansProjects\\Player\\src\\Songs\\NumaNuma.mp3");
    BIS = new BufferedInputStream(FIS);

    playSong = new javazoom.jl.player.Player(BIS);
    playSong.play();
}
catch(FileNotFoundException | JavaLayerException e)
{
    JOptionPane.showMessageDialog(null,"Error Occured " + e);
}

new Thread()
{
    @Override
    public void run()
    {
        try 
        {
            playSong.play();
        } 
        catch (JavaLayerException ex) {
            JOptionPane.showMessageDialog(null,"Error Occured " + ex);
        }
    }
}.start();

The player works now. 玩家现在工作。 I was trying to play an mp4 that I renamed as an mp3 not fully realising that that wouldn't work until I used an actual mp3 song. 我试图播放一个mp4,我改名为mp3,但没有完全意识到直到我使用了一首真正的mp3歌曲才能发挥作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM