YouTube Swing Browser

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.

Comments:

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.

Posted by Sandip on December 01, 2007 at 01:48 AM PST #

Nice article, Geertian!

Thank you for all your work!

Pierluigi Rotundo

Posted by Pierluigi Rotundo on December 01, 2007 at 02:39 AM PST #

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.

Posted by Geertjan on December 01, 2007 at 06:43 PM PST #

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.

Posted by Sandip on December 02, 2007 at 12:34 AM PST #

Thanks alot for this article. Nice idea :-)

Posted by handy on April 23, 2008 at 04:58 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

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.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today