你好朋友我想在 JavaFx 中播放视频我尝试下面的代码
public class Video extends Application {
@Override
public void start(Stage stage) throws Exception {
String s=System.getProperty("/home/ubuntu/NetBeansProjects/Video/src");
File f=new File(s, "/media/video.flv");
Media m=new Media(f.toURI().toString());
MediaPlayer mp=new MediaPlayer(m);
MediaView mv=new MediaView(mp);
StackPane root=new StackPane();
root.getChildren().add(mv);
stage.setScene(new Scene(root,400,400));
stage.setTitle("Video");
stage.show();
mp.play();
}
public static void main(String[] args) {
launch(args);
}
}
我收到类似 MediaException: MEDIA_UNAVAILABLE : /media/video.flv 的错误(没有这样的文件或目录)
我用什么方法解决?