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

YouTube Video stopping in WebView

XMLWordPrintable

    • 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 :
      When I placed a YouTube Video in WebView using iFrame API, when internet connection is low (for example 100 kb/s) and video is shorter than 20 seconds video freezes for a while and next it is starting buffering. In normal web browser video is starting buffering immediately - so its problem in WebView. It is problem, because this lag causes desynchronization in real progress video and for example Slider in app showing progress of this video.

      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
      - use (for example) NetLimiter http://www.netlimiter.com/ and limit your internet download and upload to 100 kb/s
      - try run your app and play video short video - shorter than 20 seconds, before apear the buffering animation video should freeze for a while

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Video freezeing at the beginning, before it's starts buffering
      ACTUAL -
      Video freezing at the beginning, before it's starts buffering

      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 ----------

            almatvee Alexander Matveev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: