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

YouTube video flashing in WebView

XMLWordPrintable

    • web
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      JDK™ 8u72 Early Access Release

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      YouTube video in WebView (using iFram API) is flashing when I enter mouse cursor to the video - probably it is related from apearing controls (progress bar, play button), because when I dispatch any mouse events, problem is not occurs.

      REGRESSION. Last worked in version 8u72

      ADDITIONAL REGRESSION INFORMATION:
      Java version "1.8.0_72-ea"
      Java (TM) SE Runtime Environment (build 1.8.0_72-ea-b05)
      Java HotSpot (TM) 64-Bit Server VM (build 25.72-b05, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - place YouTube player in WebView from Javafx app using iFrame API - https://developers.google.com/youtube/iframe_api_reference?hl=pl
      - try run your app and play video, next enter mouse ccursor to video

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Flashing video
      ACTUAL -
      Flashing video

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Main.java

      package pl.javastart.browser.app;

      import javafx.application.Application;
      import javafx.scene.*;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class Main extends Application {
        public static void main(String[] args) throws Exception { launch(args); }
        @Override public void start(final Stage stage) throws Exception {
          final WebView webView = new WebView();
          webView.getEngine().load(getClass().getResource("video.html").toExternalForm());
          stage.setScene(new Scene(webView, 660, 410));
          stage.show();
        }
      }



      BrowserPane.fxml
      <?xml version="1.0" encoding="UTF-8"?>

      <?import java.lang.*?>
      <?import javafx.scene.layout.*?>
      <?import javafx.scene.web.*?>

      <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
      fx:controller="pl.javastart.browser.app.Main">
      <children>
      <WebView fx:id="webView" prefHeight="200.0" prefWidth="200.0"
      AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
      AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
      </children>
      </AnchorPane>


      video.html

      <!DOCTYPE html>
      <html>
        <body style="background-color:#1d1d1d;">
          <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
          <div style="text-align:center;"><div id="player"></div></div>
       
          <script>
            // 2. This code loads the IFrame Player API code asynchronously.
            var tag = document.createElement('script');
       
            tag.src = "http://www.youtube.com/iframe_api";
            var firstScriptTag = document.getElementsByTagName('script')[0];
            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
       
            // 3. This function creates an <iframe> (and YouTube player)
            // after the API code downloads.
            var player;
            function onYouTubeIframeAPIReady() {
              player = new YT.Player('player', {
      height: '390',
                width: '640',
                videoId: 'oirm5328KCs',
                events: {}
              });
            }
          </script>
        </body>
      </html>
      ---------- END SOURCE ----------

            asrivastava Ankit Srivastava
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: