class SongPlayer{
static void playMP3(String fileName) {
new javafx.embed.swing.JFXPanel();
String uriString = new File(fileName).toURI().toString();
Media m = new Media(uriString);
MediaPlayer mp = new MediaPlayer(m);
mp.play();
}
public static void main(String args[]) throws Exception{
playMP3("Batman.wav");
}
}
我在
处遇到Media cannot be converted to javafx.scene.media.Media
错误
MediaPlayer mp = new MediaPlayer(m);
我不知道这是什么问题。我检查了文档,但MediaPlayer
将Media
个对象作为参数。