Download NetBeans!

20071203 Monday December 03, 2007

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:

Ingredients:

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

Dec 03 2007, 01:32:07 PM PST Permalink