Swing YouTube Player

NetBeans IDE 6 is out. Time to hurry to http://www.netbeans.tv/ and check for movies. Another place is YouTube, a few interesting things can be found there too. Here's one way of doing it, using a Swing YouTube Player:

YouTube is really well integrated here, for example, you can scroll through related movies within the browser component, i.e., note the "left" and "right" arrows on the two sides of the screenshot below. And, at the bottom of the currently playing movie, you can see small Ajaxy thumbnails, which move in and out as the mouse hovers over them and which you can click, at which point the selected movie starts instead of the current one:


  • YouTube Data API. Pulls the information from YouTube.

  • HTML Tidy. Parses the returned HTML page, looking for the OBJECT element and extracts the embedded URL from there.

  • WebRenderer. Provides the embedded browser component.

The latter of the three above was the hardest bit, and it still isn't perfect. First, I searched in vain for a Flash API. One that works on Linux, up to date with the latest Flash versions and, preferably, free and open source. Nothing out there meets these requirements. Secondly, I wrestled with JDIC and then gave up. Simply doesn't work with FireFox. Mozilla and Internet Explorer only, neither of which are an option. I also played with Rich Unger's JDIC Browser plugin from java.net, to no avail. I got quite far, but for the same FireFox reasons, couldn't succeed.

I then basically threw my hands in the air until I suddenly thought: "Who said that JDIC is the only available browser component?" Then I googled around and found WebRenderer. Not ideal, at all, because it is commercial. On the other hand, it doesn't involve native libraries, unlike JDIC, which is a big plus in my book. So, because I simply wanted to get something working, I got the evaluation download. Everything works as expected, basically, except that I'm having problems reloading new movies. (I write a temporary HTML file, as suggested by Sandip in the comments of the previous blog entry.) I don't want to invest too much time on this part, because WebRenderer can't be the real solution. I also get annoying messages about this being an evaluation version, as one might expect. So, my question is, does anyone know of other browser components? I would be so grateful if I could finish this application. And then port it to the NetBeans Platform, of course.


I have listed the browser components I have already encountered in my post <a href="http://www.jroller.com/dmdevito/entry/revisiting_xhtml_as_a_base">Revisiting XHTML as a base (?) for XUL-like programming</a>. I hope this will help you.

Posted by Dominique De Vito on December 03, 2007 at 06:45 AM PST #


is it possible to download the YouTube Player?

Thanks in advance

Posted by Patrick on December 04, 2007 at 01:35 AM PST #

Dominique, thanks for the tip! Good article. Do you know of embedded browser components that support Flash and that are cross-platform compatible? Dominique, I'm sorry I can't distribute the player because it uses a commercial embeddable browser component. I hope to write a tutorial sometime, which would explain how you can create the player yourself.

Posted by Geertjan on December 04, 2007 at 11:05 PM PST #

Not to change the subject too much, hehe. Just another HTML parser you may want to use, because I always had a bit of trouble with tidy, reason being it is still under dev.
The following parser felt like I was parsing XML. :O


Posted by Natie Klopper on December 11, 2007 at 02:52 PM PST #

Dunno if this might help.


It's a pure Java HTML renderer. I think. Haven't tried it yet.

Posted by Natie Klopper on December 11, 2007 at 03:24 PM PST #

Lobo/Cobra does not support Flash, but that is a fairly common request.

Posted by Jose on December 14, 2007 at 12:59 PM PST #

Hi, did you have a look into embedding JRex instead of WebRenderer?
What is the pricing of WebRenderer?, they do not mention it explicitly on their page...

Posted by wernerino on January 23, 2008 at 06:08 PM PST #

Hi i am kinda n0vice ... is there any source code for this?

Posted by ben on April 16, 2010 at 06:18 PM PDT #

Is it possible to have a source?

Posted by ben on April 16, 2010 at 06:21 PM PDT #

I tried the 30-days trial package of WebRenderer (WebRenderer-5.0-Swing-Linux) on a 64bit system but it doesn't run properly. I.e. the demo application doesn't run due to the following problem:
java.lang.UnsatisfiedLinkError: /home/user/.webrendererswing5/linux/corecomponents/libmozz.so: /home/user/.webrendererswing5/linux/corecomponents/libmozz.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

On Windows it works properly.

What's the problem???

Posted by Flavio on April 23, 2010 at 05:21 AM PDT #

I doesn't support 64 bit. Same issue with mozswing. Noone supports 64 bit. These component have stalled years ago. Noone can be bothered.

Posted by Mike on September 23, 2010 at 06:50 AM PDT #

hello sir, this is pretty good, will to please let me know about the tutorial or code so that i can implement this.

please if u mail me with the detail.

Thanks in advance

Posted by guest on November 25, 2013 at 08:58 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016