0

I'm trying to implement an idea that requires me to embed a video from YouTube. As I'm using Swing, I used JFXPanel to enable me to use a good web browser which is WebView in my case. The problem I'm struggling with now is that whenever I click on the play button of the YouTube player it gives me the following message: An error occurred, please try again later.

Here is the code I used:

JFXPanel jfxPanel = new JFXPanel();
jfxPanel.setBounds(10, 10, 500, 400);
background.add(jfxPanel);

Platform.runLater(() -> {
    WebView webView = new WebView();
    jfxPanel.setScene(new Scene(webView));
    webView.getEngine().load("http://www.youtube.com/embed/aJsUw0KxUXg/");

});

Any solution please?

Bu Saeed
  • 1,173
  • 1
  • 16
  • 27
  • 1
    Works for me, Java 8u72, OS X 10.9.5 – jewelsea Apr 01 '16 at 23:45
  • I'm using Java 8 , Windows 7 and it doesn't work :( Why? – Bu Saeed Apr 01 '16 at 23:51
  • What version of Java 8 is it? What is the output of `java -version`? – jewelsea Apr 01 '16 at 23:54
  • I suggest you use the [latest version](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) available from Oracle. – jewelsea Apr 01 '16 at 23:57
  • Perhaps this is a duplicate of: [Play a video using javafx](http://stackoverflow.com/questions/18758041/play-a-video-using-javafx). "Some versions of JavaFX 8 are unable to play back youtube video content. Currently, for instance, Java 8u66 cannot playback youtube video content, but Java 8u72 early access release can." – jewelsea Apr 02 '16 at 00:00
  • Mine is build 1.8.0_77-b03 ??? – Bu Saeed Apr 02 '16 at 00:14

0 Answers0