public synchronized void controllerUpdate(ControllerEvent ce) {Р Player p = (Player) ce.getSourceController();Р JFrame jFrame = new JFrame();Р ;Р if (p == null) {Р return;Р }Р //如果player的状态变为RealizedР if (ce instanceof pleteEvent) {Р if ((com = p.ponent()) != null) {Р jFrame., BorderLayout.SOUTH);Р }Р if ((com = p.ponent()) != null) {Р jFrame., BorderLayout.NORTH);Р }Р jFrame.setVisible(true);Р jFrame.pack();Р jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Р p.start();Р }Р }Р public static void main(String args[]) {Р VideoPlayer cap = new VideoPlayer();Р cap.initAudioCapDevLoc();Р cap.initVideoCapDevLoc();Р cap.initAudioPlayer();Р cap.initVideoPlayer();Р try {Р Thread.currentThread().sleep(20000);//20秒后停止并关闭播放器Р } catch (InterruptedException ex) {Р }Р cap.stopAndClosePlayer();Р }Р}