Video and Eclipse

For an upcoming project I need to be able to show Flash videos inside of an RCP application. Java has never been known for its multimedia functionality so I didn’t have very high hopes.

Fortunately, with Java Media Components things seem to be moving in the right direction. JMC is an API that allows you to play media files using the video functionality of the underlying operating system (there is work being done to provide cross-platform codecs along with the API, but it’s unclear how extensive this will be). JMC is distributed as part of the JavaFX platform, but it can function independently inside of a regular Swing application.

Using this recent article as a guide, I managed to create an Eclipse plug-in that contributes a very rudimentary video player view to Eclipse or any other RCP application. If you’d like to try it yourself, click here for the source code (exported project). Note that the current code only works on Windows.

Video playing inside the Eclipse IDE

Above you can see a Flash video of Wipeout playing inside of my Eclipse IDE. Wipeout is my 5-year old daughter’s favorite show (if people are falling down, she’s laughing), so after 20 years as a software developer I’ve finally written some code she’d be interested in!

One thing to note is that JMC relies on the codecs installed on your machine. There have been some complaints that JMC is not finding or utilizing the codecs most people have installed, and hopefully this situation will improve. If you find that you’re getting MediaUnsupportedException errors when opening files, you may want to install a codec pack. The CCCP pack seems to work for most people.

4 Responses to Video and Eclipse

  1. Dan says:

    Interesting.

    So that’s a .flv file. Ever had any luck with .swf?

  2. Patrick says:

    Hi Dan,

    I’ve tried a few swf files but haven’t had any luck yet. I’m getting MediaUnsupportedExceptions.

    Hopefully support for this will be added at some point, or maybe I’m doing something wrong. If you get this to work, let me know.

    — Patrick

  3. Tony says:

    Interesting article. I’m maintaining a RCP application for which I’ve just been asked to look into adding video capability. All I need is rudimentary playback capability, almost exactly how you describe your example plug-in actually.

    One thing that gives me pause is that I’m currently on Eclipse 3.2 under Java 5.0. I know that JavaFX requires Java 6.0 update 7 at a minimum. I certainly plan on upgrading both my Eclipse and Java versions eventually, but it’s not something I can do without a lot of regression testing, and I’m currently a one man show with a limited budget.

    Anyway, I was wondering whether you have any information as to whether the JMC portion of JavaFX actually requires Java 6, or can it be run under Java 5? Thanks.

    Tony

  4. Patrick says:

    Hi Tony,

    I tried running the sample under Java 5 and, as you suspected, it didn’t work. Another solution might be to use the SWT browser control combined with video plugins. I haven’t tried this myself, but it might work.

    — Patrick

Leave a comment