diff --git a/source/org/thdl/quilldriver/QD.java b/source/org/thdl/quilldriver/QD.java index 733f536..7da60a2 100644 --- a/source/org/thdl/quilldriver/QD.java +++ b/source/org/thdl/quilldriver/QD.java @@ -504,40 +504,31 @@ class TimeCodeManager extends JPanel { JPanel ps = new JPanel(); ps.add(playSegButton); -/* - JButton playButton = new JButton(messages.getString("Play")); - JButton pauseButton = new JButton(messages.getString("Pause")); + JButton playPauseButton = new JButton(messages.getString("PlayPause")); + playPauseButton.addActionListener(new ThdlActionListener() { + public void theRealActionPerformed(ActionEvent e) { + if (player != null) { + try { + if (player.isPlaying()) + player.cmd_stop(); + else + player.cmd_playOn(); + } catch (SmartMoviePanelException smpe) { + smpe.printStackTrace(); + ThdlDebug.noteIffyCode(); + } + } + } + }); - playButton.addActionListener(new ThdlActionListener() { - public void theRealActionPerformed(ActionEvent e) { - if (player != null) { - try { - player.cmd_playOn(); - } catch (SmartMoviePanelException smpe) { - smpe.printStackTrace(); - ThdlDebug.noteIffyCode(); - } - } - } - }); - pauseButton.addActionListener(new ThdlActionListener() { - public void theRealActionPerformed(ActionEvent e) { - if (player != null) { - try { - player.cmd_stop(); - } catch (SmartMoviePanelException smpe) { - smpe.printStackTrace(); - ThdlDebug.noteIffyCode(); - } - } - } - }); -*/ + JPanel playPausePanel = new JPanel(); + playPausePanel.add(playPauseButton); Box box = Box.createVerticalBox(); box.add(inPanel); box.add(outPanel); box.add(ps); + box.add(playPausePanel); add("North", box); } diff --git a/source/org/thdl/quilldriver/SmartJMFPlayer.java b/source/org/thdl/quilldriver/SmartJMFPlayer.java index 7912caf..d63d39b 100644 --- a/source/org/thdl/quilldriver/SmartJMFPlayer.java +++ b/source/org/thdl/quilldriver/SmartJMFPlayer.java @@ -178,8 +178,10 @@ public class SmartJMFPlayer extends SmartMoviePanel implements ControllerListene weird results if you do player.start() without setting the media time.*/ - if (!(event instanceof RestartingEvent)) + if (!(event instanceof RestartingEvent)) { player.setMediaTime(pauseTime); + player.prefetch(); + } // player.setStopTime(Clock.RESET); stopTime = null; @@ -274,6 +276,13 @@ public class SmartJMFPlayer extends SmartMoviePanel implements ControllerListene } } /*-----------------------------------------------------------------------*/ + public boolean isPlaying() { + if (player == null) + return false; + if (player.getState() == Controller.Started) + return true; + return false; + } public int getCurrentTime() { if (player == null) return -1; diff --git a/source/org/thdl/quilldriver/SmartMoviePanel.java b/source/org/thdl/quilldriver/SmartMoviePanel.java index ee4c233..9bb64a4 100644 --- a/source/org/thdl/quilldriver/SmartMoviePanel.java +++ b/source/org/thdl/quilldriver/SmartMoviePanel.java @@ -17,6 +17,7 @@ public abstract class SmartMoviePanel extends Panel //helper methods - media status public abstract boolean isInitialized(); + public abstract boolean isPlaying(); public abstract int getCurrentTime(); public abstract int getEndTime(); diff --git a/source/org/thdl/quilldriver/SmartQT4JPlayer.java b/source/org/thdl/quilldriver/SmartQT4JPlayer.java index b284d04..0870fbf 100644 --- a/source/org/thdl/quilldriver/SmartQT4JPlayer.java +++ b/source/org/thdl/quilldriver/SmartQT4JPlayer.java @@ -199,6 +199,9 @@ public class SmartQT4JPlayer extends SmartMoviePanel { return true; } + public boolean isPlaying() { + return false; //FIXME + } public int getCurrentTime() { try {