1

I am trying to get VLCJ to do a visualizer for the mp3 files its playing from a HTTP stream. Video shows up when I stream one. But when audio plays, nothing happens.

This is my code on the cliente side

EmbeddedMediaPlayerComponent empc = new EmbeddedMediaPlayerComponent();
String[] op = {"audio-visual=visual", "effect-list=spectrum", "effect-width=800", "effect-height=80"};
empc.mediaPlayer().media().play("http://127.0.0.1:" + port, op); 

There's a lot more code, but nothing directly related to VLCJ.
I can post the server code if you think it's necessary, but I think it's not needed since the media reaches the client perfectly. So, audio and video work fine, but the visualizer simply doesn't show up. Any help would be appreciated.

Pedro Fernandes
  • 216
  • 1
  • 12

1 Answers1

0

First, check if you have the visualisation plugins installed on your OS distribution.

I am using Linux Mint and those plugins are NOT installed by default when you install VLC.

Do this:

sudo apt install vlc-plugin-visualization

Second, it seems you have to set the visualisation options on the MediaPlayerFactory rather than passing them when you invoke play() on the media player.

For example:

String[] options = new String[] {"--audio-visual=visual", "--effect-list=scope,vuMeter,spectrometer,spectrum"};
factory = new MediaPlayerFactory(options);
mediaPlayer = factory.mediaPlayers().newEmbeddedMediaPlayer();

This example configures the factory before creating a media player from it, you can use any of the media player factory creation methods.

The visualisations scale with the size of the window, I could not get the width and height parameters to do anything.

This is fine for audio.

If you play video, then the video will go the video surface embedded in your application and VLC will open up a new separate window to show the visualisations (probably you don't want that).

enter image description here

caprica
  • 3,902
  • 4
  • 19
  • 39