Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8319159

WebView is not playing youtube videos correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • jfx11, 8u391, jfx17, jfx21, jfx22
    • javafx
    • web
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Linux
      Ubuntu 20.04.2 LTS
       
      Java
      openjdk version "17.0.8.1" 2023-08-24
      IBM Semeru Runtime Open Edition 17.0.8.1 (build 17.0.8.1+1)
      Eclipse OpenJ9 VM 17.0.8.1 (build openj9-0.40.0, JRE 17 Linux amd64-64-Bit Compressed References 20230824_549 (JIT enabled, AOT enabled)
      OpenJ9 - d12d10c9e
      OMR - e80bff83b
      JCL - 8ecf238a124 based on jdk-17.0.8.1+1)




      A DESCRIPTION OF THE PROBLEM :
      Within youtube.com, any video after play shows a loading icon and the time counter doesn't run.
      Sometimes the video starts working and then crashes, but always with the icon above showing that it's loading.

      In this case, it's not the slow internet or anything like that, because the JavaFX 21 version works correctly.

      I also tested with JVM hotspot and the error is the same as reported here, limiting the problem to JavaFX version 21.0.1.


      REGRESSION : Last worked in version 21.0.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Run the example programme I sent you
      2.After entering the www.youtube.com page
      3.Call up any video that displays the bug

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Video display correct
      ACTUAL -
      Video display problem and frozen video time counter

      ---------- BEGIN SOURCE ----------

      /**
       *
       * @author jorge
       */

       
       
      import javafx.application.Application;
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.Priority;
      import javafx.scene.layout.VBox;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;
       
      // -Dprism.verbose=true -Xmn128m -Dsun.net.http.allowRestrictedHeaders=true -Djavafx.allowjs=true -XX:+UseZGC -Xms512m -Xmx512m

      /**
       * A sample that demonstrates a WebView object accessing a web page.
       */
      public class WebViewTest extends Application {
       
       
          public Parent createContent() {
       
              WebView webView = new WebView();
       
              final WebEngine webEngine = webView.getEngine();
              final String DEFAULT_URL = "http://www.youtube.com";
              webEngine.load(DEFAULT_URL);
       
              final TextField locationField = new TextField(DEFAULT_URL);
              final ChangeListener<String> changeListener =
                  (ObservableValue<? extends String> observable,
                   String oldValue, String newValue) -> {
                      locationField.setText(newValue);
                  };
              webEngine.locationProperty().addListener(changeListener);
              EventHandler<ActionEvent> goAction = (ActionEvent event) -> {
                  webEngine.load(locationField.getText().startsWith("http://")
                          ? locationField.getText()
                          : "http://" + locationField.getText());
              };
              locationField.setOnAction(goAction);
       
              Button goButton = new Button("Go");
              goButton.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
              goButton.setDefaultButton(true);
              goButton.setOnAction(goAction);
       
              // Layout logic
              HBox hBox = new HBox(5);
              hBox.getChildren().setAll(locationField, goButton);
              HBox.setHgrow(locationField, Priority.ALWAYS);
       
              final VBox vBox = new VBox(5);
              vBox.getChildren().setAll(hBox, webView);
              vBox.setPrefSize(800, 400);
              VBox.setVgrow(webView, Priority.ALWAYS);
              return vBox;
          }
       
          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(createContent()));
              primaryStage.show();
          }
       
          /**
           * Java main for when running without JavaFX launcher
           */
          public static void main(String[] args) {
              launch(args);
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            jbhaskar Jay Bhaskar
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: