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

Youtube video appears lower track and gets slow

XMLWordPrintable

    • web
    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon Jan 18 17:52:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      JavaFX using WebView with URL youtube.com, the video appears lower track and gets slow


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Run program with URL "https://www.youtube.com"

      2.Select any video and play


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected normal video without the track
      ACTUAL -
      A track will appear in the bottom Video in the Youtube video and there will also be a slowness

      ---------- BEGIN SOURCE ----------
      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;
       
       
      public class WebViewApp 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 ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I didn't find any temporary method

      FREQUENCY : always


        1. WebViewApp.java
          2 kB
          Praveen Narayanaswamy

            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: