views:

488

answers:

2

Hello all,

Trying to build a very simple video player component in a JPanel (or something similar) to sit in a swing app, connect to an mpeg (or, really, anything VLC can output) video stream, and play it. Don't need any controls or anything -- just a live connection to the video stream.

It has to be cross-platform -- at least Mac and Windows (linux would be a nice bonus, but not necessary).

I'm developing in NetBeans, so any specifics regarding that would be extra-helpful.

JMF? Xuggler? Help! Thanks.

+1  A: 

JavaFX will do just that. It's quite simple to use and it'll support both Win, Mac and Linux. Playing most static video files are okay but you do have to test streaming.

Chuk Lee
Right, but I'm not writing a JavaFX app, I'm writing a regular Java/Swing app. Cannot use JavaFX (or the JavaFX libraries, as the license prevents me from including them in a commercial Java app)... unless that's not the case anymore?
DanM
+1  A: 

I would suggest integrating one of the two best-known Open Source media players, VLC or mplayer. Both projects are widely used, in active development, highly flexible and open to integration. Out of the box they are both able to play dozens of video & audio formats on Windows, OS X, and Linux.

For VLC, there are Java bindings jvlc (older, no longer maintained) or vlcj (newer, simpler). Mplayer can be embedded into a Java component in "slave mode".

As an alternative, the Java Media Framework (JMF) may be a Java-friendly way of embedding video, but it is not so up-to-date and few people recommend it. Docs can be found here.

ewall
VLCJ looks very promising, and I hadn't seen it before.Another project I'm looking at which might be useful is the DJ Project: Native Swing (http://djproject.sourceforge.net/ns/), which can embed a flash player and/or VLC player in a Swing app. Thanks!
DanM
I hadn't seen the DJ Project before, but it does look good--especially the plentiful documentation and examples. Good luck!
ewall