How to pause audio and then play it from where I paused?

0 votes
asked by (340 points) about NetBeans IDE
edited by

if(jToggleButton1.getText().equals("Pause"))
                {
                    time=mediaPlayer.getCurrentTime();
                    mediaPlayer.stop();
                    jToggleButton1.setText("Play");
                    isplaying=false;
                }
                else
                {
                    mediaPlayer.setStartTime(time);
                    mediaPlayer.play();
                    jToggleButton1.setText("Pause");
                    isplaying=true;
                }

1 Answer

0 votes
No avatar answered by (79.9k points)
edited by

public void actionPerformed(ActionEvent evt) {
    SwingUtilities.invokeLater(new Runnable()  {
            public void run(); 
            mediaplayier.stop();
            } });
}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...