【发布时间】:2015-10-03 20:34:20
【问题描述】:
过去两个小时我一直在尝试使用 vlcj,但我不知道如何让它工作。我一直在使用this tutorial。即使像在教程中那样编写代码后,我仍然会收到此错误
SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”。
SLF4J:默认为无操作 (NOP) 记录器实现
SLF4J:请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder 了解更多详情。
[000000001a8ed480] 核心流错误:模块损坏:C:\VideoLAN\VLC\plugins\stream_filter\libdash_plugin.dll
[000000001a8d7a30] 核心解复用元错误:模块损坏:C:\VideoLAN\VLC\plugins\meta_engine\libtaglib_plugin.dll
[000000001a8acfb0] 核心 vout 显示错误:无法设置在顶部
这是我正在使用的代码,它与教程有点不同,因为我的程序有不同的要求。
public class AVPlayer extends JPanel{
private EmbeddedMediaPlayerComponent mediaPlayer;
private String vlcPath, mediapath ; //iniitalized in chooseFile()
//constructor
public AVPlayer() {
chooseFiles();
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), vlcPath);
mediaPlayer = new EmbeddedMediaPlayerComponent();
add(mediaPlayer);
setSize(400,400);
}
// method to explicitly choose the VLC path and the video file I want to play
private void chooseFiles(){
JFileChooser ourFileSelector = new JFileChooser();
File ourfile;
//choose vlc path
ourFileSelector.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
ourFileSelector.showSaveDialog(null);
ourfile = ourFileSelector.getSelectedFile();
vlcPath = ourfile.getAbsolutePath();
//choose media path
ourFileSelector.setFileSelectionMode(JFileChooser.FILES_ONLY);
ourFileSelector.showSaveDialog(null);
ourfile = ourFileSelector.getSelectedFile();
mediapath = ourfile.getAbsolutePath();
}
//called in main to play the video
public void playVideo(){
mediaPlayer.getMediaPlayer().playMedia(mediapath);
}
}
这是主要的
public static void main(String[] args) {
JFrame frame = new JFrame();
AVPlayer player = new AVPlayer();
frame.add(player);
frame.setVisible(true);
frame.validate();
player.playVideo();
}
【问题讨论】: