1
這是非常特別的,所以我希望有人在這裏使用Windows之前的VLCJ。VLCJ簡單的應用程序工作打包爲罐子,但不是在BlueJ
使用藍Ĵ,這裏是我的測試類:
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.test.VlcjTest;
/**
* An absolute minimum test player.
*/
public class MinimalTestPlayer extends VlcjTest {
public static void main(String[] args) throws Exception {
if(args.length != 1) {
System.out.println("Specify an MRL to play");
//System.exit(1);
}
System.setProperty("VLC_PLUGIN_PATH", "<plugins-path>");
Frame f = new Frame("Test Player");
f.setIconImage(new ImageIcon(MinimalTestPlayer.class.getResource("/icons/vlcj-logo.png")).getImage());
f.setSize(800, 600);
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
f.setLayout(new BorderLayout());
Canvas vs = new Canvas();
f.add(vs, BorderLayout.CENTER);
f.setVisible(true);
MediaPlayerFactory factory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = factory.newEmbeddedMediaPlayer();
mediaPlayer.setVideoSurface(factory.newVideoSurface(vs));
mediaPlayer.playMedia("test.mp4");//args[0]);
Thread.currentThread().join();
} }
這工作時,我把它打包到一個jar文件沒有需要
-Djna.library.path="C:\Program Files\VideoLAN\VLC\plugins"
或
--plugin-path="C:\Program Files\VideoLAN\VLC\plugins"
如圖here.
只是運行CMD從直線上升作品的jar文件,那麼爲什麼不能這項工作在測試中BlueJ的?
我認爲這與在BlueJ上添加classpath有關嗎? –
對不起,上面的行應該是「System.setProperty(」VLC_PLUGIN_PATH「,」C:\\ Program Files \\ VideoLAN \\ VLC \\ plugins「);」 –