X

Geertjan's Blog

  • December 1, 2007

YouTube Swing Browser

Geertjan Wielenga
Product Manager
I took the principles outlined here and now I have a Swing browser for YouTube. It opens the browser when I click "Go there", displaying whatever is selected in the list. Entries appear in the list when I type something in one of the Search fields and then press Enter. Here's how it looks:

It's already more useful than YouTube itself. There's just way too much stuff going on on that site. Just give me the movies and let me watch them, that's all I ask. Don't overload me with a zillion odds and ends. I wish the API was able to access the actual Flash movie that is played, but that doesn't seem possible. You can get the whole YouTube page, as shown above, but not the movie itself. Or maybe I overlooked it in the Javadoc. But that would be cool to extract, because then I would be able to play it in my Swing app, assuming I bundled a Flash API with it. Pity most of the ones that are up to date are not free, though.

Join the discussion

Comments ( 5 )
  • Sandip Saturday, December 1, 2007

    Cool!

    You could write out a temp html file with just the embed tag and show that file in the browser using the file:/ protocol. For example the file may contain:

    <html>

    <head>

    <title>Movie</title>

    </head>

    <body>

    <object width="425" height="355">

    <param name="movie" value="http://www.youtube.com/v/eJA9RPX9mRY&rel=1"> </param>

    <param name="wmode" value="transparent"> </param>

    <embed src="http://www.youtube.com/v/eJA9RPX9mRY&rel=1"

    type="application/x-shockwave-flash"

    wmode="transparent"

    width="425"

    height="355">

    </embed>

    </object>

    </body>

    </html>

    You only need to figure out how to build this embed and or object tag.


  • Pierluigi Rotundo Saturday, December 1, 2007

    Nice article, Geertian!

    Thank you for all your work!

    Pierluigi Rotundo


  • Geertjan Sunday, December 2, 2007

    Sandip, thanks a million! It took me a while to understand your point, but this is incredibly useful. I copied your HTML tags into a file, double-clicked it, and then saw the Mr Bean movie. Excellent. Now, I've managed to locate the EMBED tag, via the Tidy library, writing it to the HTML file you describe above shouldn't be hard, so things are looking good! Maybe the final app should be called "YouTube Player"!

    Pierluigi, thanks for the support.


  • Sandip Sunday, December 2, 2007

    The Mr. Beans (Rowan Atkinson clip) is very funny. May be offensive to some...you are forewarned.

    BTW I got the idea when I saw that there is a text field next to all videos on YouTube which shows you the object/embed tag. I copy/pasted into a (empty) html file and opened it with the browser and it worked (just the video player).

    Now if you could use JDIC Browser to embed a browser inside your java app then you have a complete integrated YouTube player - "YouTunes" :)

    Alternatively there may be a way to embed SWF Player directly in Java and then you do not need the browser also.


  • handy Wednesday, April 23, 2008

    Thanks alot for this article. Nice idea :-)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.