Vlcj安装及在SWT中调用实现播放器(参考网上的资料自己总结的,希望对大家有用)
1.安装VLC播放器
(win7 -64位)
下载VLC网址 :http://www.videolan.org/
下载vlcj:http://capricasoftware.co.uk/#/projects/vlcj
2.所需jar包:
3.环境配置:
在VLC的安装目录:
将这三个文件拷贝到Java工程目录下。如
4.代码导入VLC
5.SWT实现播放视频源码
package temp;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.SWTResourceManager;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaListPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
import uk.co.caprica.vlcj.runtime.x.LibXUtil;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.awt.Frame;
import org.eclipse.swt.awt.SWT_AWT;
import java.awt.Panel;
import java.awt.BorderLayout;
import java.io.File;
import javax.swing.JRootPane;
public class playMVtest extends Shell {
private Composite composite_play;
public static JRootPane rootPane; // 放音乐的控件
public static boolean isplay;
static EmbeddedMediaListPlayerComponent mediaplay; // 播放视频的对象
/**
* Launch the application.
*