btw, my os is windows xp and jvlc version is 0.8.6a. Anybody have idea on this? Thanks a lot.
Here is my code:
Code: Select all
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import org.videolan.jvlc.JVLC;
import org.videolan.jvlc.JVLCPanel;
import org.videolan.jvlc.Playlist;
import org.videolan.jvlc.VLCException;
/**
* Play video and audio.
*
* @author Administrator
*
*/
public class JVLCMain {
public JVLCMain() {
}
/**
* @param args
*/
public static void main(String[] args) {
JFrame jframe = new JVLCPlayerFrame(args);
jframe.setBounds(0, 0, 500, 500);
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setVisible(true);
}
}
// TODO need to be fixed.
/**
* Player's frame.
*
* @author Administrator
*
*/
class JVLCPlayerFrame extends JFrame {
private static final long serialVersionUID = 1L;
private JVLCPanel jvcc;
private JVLC jvlc;
private Playlist playList;
public JVLCPlayerFrame(String[] args) {
initialize(args);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
play();
}
/**
* Initialize components.
*/
public void initialize(String[] args) {
jvcc = new JVLCPanel(args);
jvlc = jvcc.getJVLCObject();
playList = jvlc.playlist;
setLayout(new BorderLayout());
jvcc.setLayout(new BorderLayout());
jvcc.add(new JButton("123123132"), BorderLayout.NORTH);
add(jvcc, BorderLayout.CENTER);
pack();
}
public void play() {
try {
playList.add("file://d:/rtsp/aa.avi", "");
playList.play(-1, null);
} catch (VLCException e) {
e.printStackTrace();
}
}
}