No.3 vlcj
一、简介
The vlcj project first gives you Java bindings to just about all of the native functionality provided through libvlc, but you also get much more than that...
The vlcj project also gives you a framework that provides a simpler higher-level programming model for libvlc - encapsulating as much as possible of the access to the native library, and encapsulating any platform-specific behaviours.
二、示例
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(final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Tutorial2B(args);
}
});
}
private Tutorial2B(String[] args) {
JFrame frame = new JFrame("vlcj Tutorial");
mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
frame.setContentPane(mediaPlayerComponent);
frame.setLocation(100, 100);
frame.setSize(1050, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
mediaPlayerComponent.getMediaPlayer().playMedia(args[0]);
}
}
三、评价
同样是很不错的开源项目,与强大的开源媒体播放器 VLC 结合之后更是所向披靡,使用起来更是简单实用,强烈推荐使用!