javaswingvlcjdvb

Using VLCJ for DVB-T tuner


In our country there is a dvb frequency of 570000000 with 3 channels/programs; 16,17,18

This is the mrl i am using to change channel for vlc via batch file by replacing the :program value.

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" dvb-t://frequency=570000000:bandwidth=8 :dvb-adapter=0 :live-caching=1000 :program=16

But when i use the same mrl via VLCJ it seems the :program does not have any effect and randomly show channel without changing code.

import uk.co.caprica.vlcj.discovery.NativeDiscovery;
import uk.co.caprica.vlcj.player.MediaPlayer;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;


public class VLCJTest {

    public static void main(String[] args) throws Exception {
        new NativeDiscovery().discover();

        final MediaPlayerFactory factory = new MediaPlayerFactory();
        final MediaPlayer mediaPlayer = factory.newHeadlessMediaPlayer();

        String str = "dvb-t://frequency=570000000 :bandwidth=8 :dvb-adapter=0 :live-caching=1000 :program=16";

        mediaPlayer.playMedia(str);

        Thread.currentThread().join();
    }
}

Can anyone help me to solve how to change of channel/program of digital tv via VLCJ mrl?

Thank you.


Solution

  • The string must be split into MRL and separate "options":

    String mrl = "dvb-t://frequency=570000000";
    String[] options = {
        ":bandwidth=8",
        ":dvb-adapter=0",
        ":live-caching=1000",
        ":program=16"
    };
    mediaPlayer.playMedia(mrl, options);