We have embedded a youtube video in a WebView. The video works fine. However, while playing the video there are a lot of threads created. The threads are created and finished very quickly. It seems as if there was one thread per frame... It does not matter which video is used. For the demo below I picked a random video.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class WebViewVideoTest extends Application
{
public static void main(String[] args)
{
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception
{
WebView wv = new WebView();
wv.getEngine().loadContent("<html><head/><body><iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/tfd5p1JqUsw\" frameborder=\"0\" allowfullscreen></iframe></body></html>");
primaryStage.setScene(new Scene(wv));
primaryStage.show();
}
}
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class WebViewVideoTest extends Application
{
public static void main(String[] args)
{
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception
{
WebView wv = new WebView();
wv.getEngine().loadContent("<html><head/><body><iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/tfd5p1JqUsw\" frameborder=\"0\" allowfullscreen></iframe></body></html>");
primaryStage.setScene(new Scene(wv));
primaryStage.show();
}
}
- relates to
-
JDK-8125691 Large Numbers of Threads Continuously Created when MediaPlayer is instantiated
-
- Closed
-