I am working on a code to load a .wav file and play it through a bare-bones media player. I can make it play and stop correctly, but when I try to resume, the song starts over. The file itself large (around 25 mb, I think), and I want to load the entire song into the buffer, (like a clip), but that shouldn't be a problem with the amount of memory computers have today.
(note: This code is based off one that I found online)

This part loads and plays the sound;

Java Code:
import java.io.*;
import javax.sound.sampled.*;
import javax.swing.*;
import java.awt.event.*;

public class AA extends JFrame{

    private final int BUFFER_SIZE = 1024;
    private File soundFile;
    private AudioInputStream audioStream;
    private AudioFormat audioFormat;
    private SourceDataLine sourceLine;

    byte[] abData = new byte[BUFFER_SIZE]; // abData.length = 128000
    boolean isPlaying = true;
    int nBytesRead = 0;
    int songPosition = 0;

    JButton butto = new JButton("Hello, again, world.");

public AA(){
    super("Music");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(250, 150);

    butto.addActionListener(new BB());
    add(butto);
    setVisible(true);
        playSound();}

public void playSound(){

        try {
            soundFile = new File("C:\\Users\\Davis Burnside\\Desktop\\ttr.wav");
            audioStream = AudioSystem.getAudioInputStream(soundFile);
            audioFormat = audioStream.getFormat();

            DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
        
            sourceLine = (SourceDataLine) AudioSystem.getLine(info);
            sourceLine.open(audioFormat, 26992640 );} // the second number is the manual buffer size

         catch (Exception e) {         
            System.exit(1);}
        
        
            sourceLine.start();
               
            while (nBytesRead != -1) {
                    try {nBytesRead = audioStream.read(abData, 0, abData.length);                   
                    }
                    
                    catch (IOException e) {System.out.println("gg");}

                if (nBytesRead >= 0) {
                    @SuppressWarnings("unused")
                     sourceLine.write(abData, 0, nBytesRead);}
        }
    }
    public static void main(String[]args){new AA();}
}

This is the button that is supposed to stop/restart the music.


Java Code:
class BB implements ActionListener{ // do not put a long "While" statement in here
            public void actionPerformed(ActionEvent e) {
                 
       if (isPlaying == true){
           isPlaying = false;
                    try{
                        sourceLine.getFramePosition();
                        sourceLine.stop();                      
                       }
                    
                    catch(Exception d){System.out.println(d);}   
                       }
                       

       else{       
           isPlaying = true;
                    try{
                        sourceLine.start();

                      
                        }
                                  
                    catch(Exception a){System.out.println(a);}                             
          }
    }}