Caprica Software

vlcj 4.x Tutorial

Logo

Building on previous tutorials, we will now overlay a logo on the video.


Let's Get Started

You should now already have a basic template for how to create a vlcj application, so this tutorial will no longer duplicate all of the code each time - instead we'll just show the new code fragments.


Create a Logo

You create a logo by using a builder:

Logo logo = Logo.logo()
.file("vlcj-logo.png")
.position(LogoPosition.TOP_LET)
.opacity(0.3f)
.enable();

Using the Logo

For historical reasons there are two ways to use the logo, whichever way you choose is essentially a matter of preference.

logo.apply(mediaPlayerComponent.mediaPlayer());

Alternatively:

mediaPlayerComponent.mediaPlayer().logo().set(logo);

Logo API

You do not have to use the builder, you can invoke the individual API methods directly:

mediaPlayerComponent.mediaPlayer().logo().setFile("vlcj-logo.png");
mediaPlayerComponent.mediaPlayer().logo().setPosition(LogoPosition.TOP_LEFT);
mediaPlayerComponent.mediaPlayer().logo().setOpacity(0.3f);
mediaPlayerComponent.mediaPlayer().logo().enable(true);

Disabling the Logo

Using the builder approach, create a logo without invoking enable() and then apply or set it.

Using the API directly:

mediaPlayerComponent.mediaPlayer().logo().enable(false);

When To Use Logo

A logo can be set at any time, even before media is playing.

You no longer need to explicitly enable the native logo video filter module, with VLC 3.x this is all handled automatically by LibVLC.