Have to sigh Java is the best source of Open-source spirit, in the arduous struggle still cannot compile run LIBVLC (based on VC), the internet found VLCJ English articles, is VLC Java-oriented API, a little bit of a sledgehammer.
1. Please download and install VLC Media Player 2.0.7 on the Internet.
2. Create a new Java project and download the Java package you need to use.
3. Paste the following code under one of the packet below your SRC
Package com.xing;
Import Javax.swing.JFrame;
Import javax.swing.SwingUtilities;
Import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
public class Tutorial2b {private final embeddedmediaplayercomponent mediaplayercomponent;
public static void Main (string[] args) {Swingutilities.invokelater (new Runnable () {@Override
public void Run () {new tutorial2b ();
}
});
Private tutorial2b () {JFrame frame = new JFrame ("VLCJ Tutorial");
Mediaplayercomponent = new Embeddedmediaplayercomponent ();
Frame.setcontentpane (mediaplayercomponent);
Frame.setlocation (100, 100);
Frame.setsize (600, 400);
frame.setdefaultcloseoperation (jframe.exit_on_close);
frame.setvisible (true); &nbsP Mediaplayercomponent.getmediaplayer () PlayMedia ("D:\\a.mp4");/
An existed media file}}
4. Run, because VLCJ is based on JNA, to invoke the VLC-related DLL file, you need to configure the run parameters:
Run around and enjoy the player you wrote.