该代码可从Intellij运行。但是,当我制作神器时,事实并非如此。 mp4文件在项目中,我这样访问它:
URL url = getClass().getResource("/procedure/pictures/Berekening.mp4");
File file = new File(url.getPath());
文件保存在包含文件的对象的列表中
helpList.add(new HelpChoise("Berekening","uitleg ",file));
然后我使用Media > mediaView > MediaPlayer
播放文件。
(helpChoiseList = ListView
)
Media media = new Media(helpChoiseList.getSelectionModel().getSelectedItem().getFileName().toURI().toString());
MediaPlayer player = new MediaPlayer(media);
player.setAutoPlay(true);
mediaView.setMediaPlayer(player);