4 Replies Latest reply: Nov 20, 2012 7:36 AM by 974844 RSS

    Can not view youtube clips in webview

    974844
      Hi

      I'm trying to view youtube clips within webview component but i get an error message saying "this video is currently unavailable."

      the code snippet is quiet simple:
      final WebView wv = new WebView();
      wv.getEngine().load( "http://www.youtube.com/watch?v=rHcnsEoSK_c");
      am I doing something wrong?

      thanks

      Eyal

      Edited by: 971841 on Nov 18, 2012 6:08 AM

      Edited by: 971841 on Nov 18, 2012 6:12 AM
        • 1. Re: Can not view youtube clips in webview
          jsmith
          Works fine for me (win7+jdk1.7u6)
          import javafx.application.Application;
          import javafx.scene.*;
          import javafx.scene.web.WebView;
          import javafx.stage.Stage;
          
          public class SimpleYouTubePlayer extends Application {
            public static void main(String[] args) throws Exception { launch(args); }
            @Override public void start(final Stage stage) throws Exception {
              WebView webView = new WebView();
              webView.getEngine().load("http://www.youtube.com/watch?v=rHcnsEoSK_c");
              stage.setScene(new Scene(webView));
              stage.show();
            }
          }
          • 2. Re: Can not view youtube clips in webview
            974844
            Hi

            thanks for your answer, this is exactly the code i'm using and i'm running on win-xp jdk 1.7_06-b24 and still can't see any youtube clip.
            • 3. Re: Can not view youtube clips in webview
              jsmith
              Check out the system requirements: http://docs.oracle.com/javafx/2/system_requirements_2-2/jfxpub-system_requirements_2-2.htm
              For Windows XP and Windows Vista, JavaFX Media 2.2 requires that one of the following external modules be installed to play AAC audio and H.264/AVC video:
              MainConcept H.264/AVC Pro Decoder Pack
              DivX Plus Codec Pack
              MainConcept Showcase (includes demo version codecs)
              DivX is freely downloadable: http://www.divx.com/
              • 4. Re: Can not view youtube clips in webview
                974844
                Installing DIVX+ did work.

                Thanks
                Eyal