我的代码 id
public class Video1 extends Application {
private static String arg1;
@Override public void start(Stage stage) {
stage.setTitle("Media Player");
// Create media player
Media media = new Media("/home/ubuntu/NetBeansProjects/VideoPaly/src/videopaly/vid.flv");
javafx.scene.media.MediaPlayer mediaPlayer = new javafx.scene.media.MediaPlayer(media);
mediaPlayer.setAutoPlay(true);
mediaPlayer.setCycleCount(javafx.scene.media.MediaPlayer.INDEFINITE);
// Print track and metadata information
media.getTracks().addListener(new ListChangeListener<Track>() {
public void onChanged(Change<? extends Track> change) {
System.out.println("Track> "+change.getList());
}
});
media.getMetadata().addListener(new MapChangeListener<String,Object>() {
public void onChanged(MapChangeListener.Change<? extends String, ? extends Object> change) {
System.out.println("Metadata> "+change.getKey()+" -> "+change.getValueAdded());
}
});
// Add media display node to the scene graph
MediaView mediaView = new MediaView(mediaPlayer);
Group root = new Group();
Scene scene = new Scene(root,800,600);
root.getChildren().add(mediaView);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
if (args.length > 0) {
arg1 = args[0];
}
Application.launch(args);
}
}
当我运行上面的代码时,我想从 Ubuntu 的资源播放视频,它会给出类似 java.lang.IllegalArgumentException: uri.getScheme() == null 的错误!在线
Media media = new Media("/home/ubuntu/NetBeansProjects/VideoPaly/src/videopaly/vid.flv");
有什么想法吗?