【问题标题】:How can I get the title of the current song playing in java using the jacomp3 api如何使用 jacomp3 api 获取在 java 中播放的当前歌曲的标题
【发布时间】:2017-08-26 02:18:08
【问题描述】:

所以我正在用 java 制作一个 MP3 播放器,除了一首歌结束时,一切正常。我没有得到当前正在播放的歌曲的标题。现在我有它是用户必须跟踪,所以他们需要知道歌曲何时结束,以便他们可以跳过并显示标题。我正在使用 jaco mp3player api,但如果有其他类似的 java api 可能会更好,请建议。到目前为止,这是我唯一喜欢的 api,但我不介意重新开始我的项目。

这是我的播放和暂停的工作方式,正如您所见,我通过查看存储歌曲的数组列表来获取歌曲名称。

// Check if ppTracker is 1 and allow the user to pause
    if (ppTracker == 1) {
        // Change the image icon
        btnPlaynPause.setIcon(unpressPause);
        //songName = musicAccess.getSongName();
        //displaySong.setText(songName);
        displaySong.setText(music.get(mTracker).getSongName());
        player.play();
        System.out.println("Size "+player);

        // Check if ppTracker is 2 and allow the user to resume or play
    } else if (ppTracker == 2) {
        // Change the image icon
        btnPlaynPause.setIcon(unpressPlay);
        player.pause();
        // Reset the tracker back to 0
        ppTracker = 0;
    }

【问题讨论】:

    标签: java mp3


    【解决方案1】:

    也许您需要每秒检查几次歌曲并确保标签的文本正确,如果没有相应地更改它?这可以通过几种方法完成,但最简单的可能是使用线程。

    【讨论】:

      猜你喜欢
      • 2017-11-21
      • 2023-04-04
      • 2010-11-22
      • 2020-10-14
      • 2012-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多