0
어떻게하면 선택한 패키지 안에 mp3 파일을 재생할 수있는 다음 코드의 디렉토리를 설정할 수 있습니까?패키지에있는 mp3 파일을 재생하는 방법은 무엇입니까?
FileInputStream fis = new FileInputStream("song.mp3");
또 다른 간단한 질문 : 다음 코드에 대한 일시 중지 단추를 어떻게 추가합니까?
try {
FileInputStream fis = new FileInputStream("song.mp3");
Player playMP3 = new Player(fis);
playMP3.play();
} catch (Exception exc) {
exc.printStackTrace();
System.out.println("Failed to play the file.");
}
일시 중지하려면, 당신은 가능성이'플레이 수 있도록 다른 스레드에서 플레이어를 재생해야합니다() '방법은 차단하지 않습니다. 그러면 PLayer는 필요할 때 호출 할 수있는'pause()'메소드를 갖기를 바랍니다. –