Using the mediaPlayer().playMedia(mrl, mediaOptions) syntax, I have the arguments loaded within the mediaOptions String[].
However, the arguments that I enter into the mediaOptions are not recognized by VLC. I have tried using a number of different argument forms (VLC seems to have not-so-specific instruction on the exact formatting of arguments). I have used the following forms for the arguments:
- String[] mediaOptions = {"vout-filter transform","transform-type vflip"};
- String[] mediaOptions = {"vout-filter=transform","transform-type=vflip"};
- String[] mediaOptions = {"--vout-filter transform","--transform-type vflip"};
- String[] mediaOptions = {"--vout-filter=transform","transform-type=vflip"};
- String[] mediaOptions = {"--transform-type vflip"};
- String[] mediaOptions = {"--transform-type=vflip"};
String[] mediaOptions = {"noaudio"};
The fact that no audio works shows me that the arguments *can* work. However, it makes no sense that none of my other arguments work.
---
The current code is as follows:
Code: Select all
package test;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
public class Example2 implements ActionListener{
private final JFrame frame;
private final JPanel contentPane;
private final EmbeddedMediaPlayerComponent mediaPlayerComponent;
public static void main(String[] args) {
new NativeDiscovery().discover();
final String mrl = args[0];
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Example2().start(mrl);
}
});
}
public Example2() {
mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
JButton pause = new JButton("Pause");
pause.setActionCommand("Pause");
pause.addActionListener(this);
contentPane = new JPanel();
contentPane.setLayout(new BorderLayout());
contentPane.add(mediaPlayerComponent, BorderLayout.CENTER);
contentPane.add(pause, BorderLayout.NORTH);
contentPane.setBackground(Color.GRAY);
frame = new JFrame("vlcj quickstart");
frame.setLocation(50, 50);
frame.setSize(800, 800);
frame.setContentPane(contentPane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
private void start(String mrl) {
String[] mediaOptions = {"vout-filter transform","transform-type vflip"};
mediaPlayerComponent.getMediaPlayer().playMedia(mrl, mediaOptions);
}
public void actionPerformed(ActionEvent e){
if(e.getActionCommand().equals("Pause")){
mediaPlayerComponent.getMediaPlayer().pause();
}
}
}