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?