我正在与JavaFX Mediaplayer挣扎。我有几个视频是mp4(h264和aac),它在我的Mac上运行良好,但它不能在我的任何Windows PC上播放。它不会抛出任何错误,它只是不起作用。屏幕变白了,就是这样。这有什么特别的原因吗?我正在调用“mediaPlayer.play()”,我安装了适用于Windows的Media Feature Pack。提前谢谢。
String path = Settings.currentDir() + File.separator + "files" + File.separator + filename;
Media media = new Media(new File(path).toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaPlayer.setAutoPlay(false);
MediaView mediaView = new MediaView(mediaPlayer);
mediaView.setFitWidth(width);
mediaView.setFitHeight(height);
mediaPlayer.setMute(true);
StackPane borderPane = new StackPane();
borderPane.setMinSize(width, height);
borderPane.getChildren().add(mediaView);