public void propertyChange(java.beans.PropertyChangeEvent pe) { switch (DSJUtils.getEventType(pe)) { case DSFiltergraph.ACTIVATING: System.out.print("."); break; case DSFiltergraph.MOUSE_EVENT: System.out.println("Evento de ratón"); break; case DSFiltergraph.DONE: try { if (audioPlayer != null) { audioPlayer.close(); audioPlayer = null; dispose(); } if (moviePanel != null) { moviePanel.dispose(); moviePanel = null; dispose(); } } catch (Exception ex) { ex.printStackTrace(); } break; } }
private void loadMovie(String path, int flags) { running = false; if (moviePanel != null) { /** * This cleans up the native structures and removes the display component from any container * it was added to. It's not essential to do so anymore as dsj >= 0.8 can handle multiple * graphs in one process space (see showStereoFrame()) but we're replacing one with the other * here. However all DSFiltergraph subclasses should finally be closed with the dispose() * method. */ moviePanel.dispose(); if (audioPlayer != null) { audioPlayer.close(); audioPlayer = null; } } try { moviePanel = DSFiltergraph.createDSFiltergraph(path, flags, this); moviePanel.addMouseListener(new TVideoListener(this, running, audioPlayer, moviePanel)); DSFiltergraph.DSAudioStream audioStream = moviePanel.getAudioStream(); if (audioStream != null) { audioPlayer = new JAudioPlayer(audioStream); } } catch (DSJException e) { System.err.println("El video no se puede reproducir"); System.out.println("\n" + e.toString() + " " + e.getErrorCode()); moviePanel = null; pack(); return; } initDisplay(); if (audioPlayer != null) audioPlayer.start(); this.setVisible(true); }