Caprica Software

vlcj 4.x Tutorial

Prerequisites

Life is much simpler for you as an application developer if VLC is already installed on your own system (or your user target system).

It is possible to bundle up the VLC native libraries and the VLC plugins that you need and include them with your own application, but doing this is not as straightforward as you might think. If you're just starting out with vlcj, then just install VLC first.


VLC/LibVLC Versions

This version of vlcj supports VLC 3.x, and possibly later, only. No earlier versions of VLC are supported at all.


Supported Platforms

You must match the CPU architecture of the Java Virtual Machine and the native LibVLC libraries - if you use a 32-bit JVM you must use a 32-bit release of VLC; if you use a 64-bit JVM you must use a 64-bit release of VLC. You can not mix CPU architectures, it will not work.

For all platforms, at least Java version 1.6 is required for vlcj versions up to 4.7.x; for version 4.8.x and onwards Java 11 is required, and the Java Module System is used.

For Linux and Windows platforms, Java versions 1.7+ are also fully supported. On macOS, there are potentially critical limitations if you use any version of Java after the 1.6 version. This is because in Java 1.7 on macOS there is no longer any "heavyweight" window toolkit, everything is lightweight. This is a problem because VLC normally requires the window handle of a heavyweight window so it can be told where to render the video into.

What this means in practice is that the EmbeddedMediaPlayer, and associated component, will not work on any Java version later than 1.6 on macOS - unless you use an alternate video surface like the CallbackVideoSurface that implements "direct rendering". This is covered in a later tutorial. There is also the option to use vlcj with JavaFX.

These tutorials start with the simpler EmbeddedMediaPlayerComponent.