3

I'm trying to play a Youtube video in a JavaFX WebView. Like other people, I keep getting the "An error occurred, please try again later." error. (Also Soundcloud doesn't work either, that can use HTML 5 only)

My code is simply:

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

@Override
public void start(Stage primaryStage) throws Exception {

    primaryStage.setTitle(TITLE);

    WebView wbv = new WebView();
    wbv.getEngine().load("http://www.youtube.com/");
    wbv.setPrefSize(854, 480);

    primaryStage.setScene(new Scene(wbv));

    primaryStage.show();
}

I have already tried:

If I try a different website with an HTML 5 player (http://www.videojs.com), it works.

So I'm guessing it must be something to do with Youtube and Soundcloud.

Is there anyway I can make this work? Thanks

user2513924
  • 2,070
  • 3
  • 15
  • 23

2 Answers2

2

You need 8u72 version. Some versions just prior to that have an issue with https. I had the same problem and just fixed it this way.

Milan Novkovic
  • 126
  • 1
  • 2
  • 11
  • Thanks. This fixed it! I used version `8u76` since that was the latest one and at this time, anything above `8u66` is a snapshot release anyway. – user2513924 Jan 16 '16 at 13:05
0

I think you can't read youtube video or (soundcloud music), because it's only a link whereas on videojs it's a video link ( with mp4 extension). I don't know if there is a solution.

Thomas
  • 170
  • 1
  • 12
  • WebView is supposed to be able to play HTML 5 video players. Also it has worked before. Thanks for the answer though. – user2513924 Jun 01 '15 at 17:44
  • 1
    @user2513924 I found two topics on this subject ([play youtube videos](http://stackoverflow.com/questions/16532161/javafx-project-play-youtube-videos) and [youtube video](http://stackoverflow.com/questions/18758041/play-a-video-using-javafx)), I tested the code but it doesn't work anymore. – Thomas Jun 02 '15 at 11:48
  • I guess it just doesn't work anymore and there's nothing I can do then :( Thanks for looking though. – user2513924 Jun 03 '15 at 21:26