user1809940
user1809940

Reputation:

Issuse in playing Video in Javafx

I tried

public class Video3 extends Application{

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage stage) throws Exception {
Group root = new Group();
Scene scene = new Scene(root, 1280, 1024, Color.BLACK);
File file = new File("/home/ubuntu/NetBeansProjects/VideoPaly/src/videopaly/vid.flv");
String path = file.toURI().toASCIIString(); 
URI uri = new URI(path);
root.getChildren().add(MediaViewBuilder.create().mediaPlayer(MediaPlayerBuilder.create()
                        .media(new Media(path)).build()).build());
stage.setScene(scene);
stage.show();
}
}

When i run above Code it will show me black window ,how can i solve i?

Upvotes: 3

Views: 918

Answers (1)

clyde
clyde

Reputation: 824

I ran into a similar problem going between Windows 7, Ubuntu and XP runtime environments. Looks like you're running in Ubuntu. What version? In Linux and Windows versions Vista and older, codecs are not included by default.

I'd bet that you don't have the proper codecs required to play the media in question.
Have a look at the following:

Here, scroll down to 'JavaFX Media' at the bottom of the page, and it should help you find what you need. http://www.oracle.com/technetwork/java/javafx/downloads/supportedconfigurations-1506746.html

Some more helpful (but less technical) info here: http://docs.oracle.com/javafx/2/media/overview.htm

A comprehensive matrix of supported video container formats and types is in the: JavaFX 2 Media Package JavaDoc

Upvotes: 2

Related Questions