Sunday 15 February 2009

Java and media (surprisingly cumbersome)

I've been looking into playing videos inside a Java Panel, which turned much more difficult than I thought. I first tried the Java Media Framework, but it only plays a very limited set of media (and not very well - particularly on a Mac). I've then looked at JavaFX, which looked really promising on the web site. After wrestling with the installation for a bit and getting to grips with the language, I discovered that controlling any JavaFX component from Java is considered a hack and not really easy to do - despite the whole thing being based on Java. I can't quite understand why that is the case but well. So, I went back to Quicktime for Java, and after downgrading my project from JDK1.6 to 1.5, I was able to play movies again. This is of course not a great solution at all but will work for the demonstrator I'm currently building. I really hope SUN get their act together and provide some simple API to play media in Java (it seems like JavaFX would work well if only they decided to do it)...