简体   繁体   中英

Not playing video in mediaPlayer javafx

I have problem with showing video in JavaFx Media:

public void showVideo(File videoFile) {
    scrollPane.setHvalue(scrollPane.getHmin());
    scrollPane.setVvalue(scrollPane.getVmin());

    Media media = new Media("http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv");
    final MediaPlayer mediaPlayer = new MediaPlayer(media);
    final MediaView mediaContent = new MediaView(mediaPlayer);

    HBox menuBox = new HBox();
    menuBox.setAlignment(Pos.CENTER);
    menuBox.getChildren().addAll(playButton, stopButton);
    VBox videoBox = new VBox();
    videoBox.setAlignment(Pos.CENTER);
    videoBox.getChildren().addAll(mediaContent, menuBox);

    playButtonListener(mediaPlayer);
    stopButtonListener(mediaPlayer);

    mediaPlayer.setOnEndOfMedia(new Runnable() {
        @Override public void run() {
            playButton.setGraphic(WindowUtil.createIcon(IconsConstants.ICON_PLAYER_REPEAT));
            mediaPlayer.stop();
            playButtonListener(mediaPlayer);
        }
    });

    scrollPane.setContent(videoBox);
}

I know that the code isn't wrong because in my coworker system it shows. I try to show flv file. I saw question: JavaFX video not playing

I have windows 10 N with K-Lite standart codec and jdk-8u65-windows-x64 Java and I installed feature pack for windows 10 like in link above. And I don't know what can be the problem.

Ok, problem solved. I update feature pack and now it's working. Probably previous version of feature pack for windows 10 N doesn't have codecs which I need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM