I'm trying to play music in the background of my game, and I want to make it loop, i'm getting this error
java.io.IOException: could not create audio stream from input stream
I've tried using .getResourceAsStream, but it returns null, probably because it requires a URL so I'm probably doing something wrong with that
I've also tried using this.getClass().getClassLoader().getResource but that produces a bunch of runtime errors.
This is the code for the music part of the program. I've confirmed that the button works, clicking it just returns that IOException that I mentioned above.
public static void music(){
    AudioPlayer AP = AudioPlayer.player;
    AudioStream AS;
    AudioData AD;
    ContinuousAudioDataStream loop = null;
    try{
        AS = new AudioStream(new FileInputStream("theme.mp3"));
        AD = AS.getData();
        loop = new ContinuousAudioDataStream(AD);
    }catch(IOException error){
        System.out.println(error);
    }
    AP.start(loop);
}
 
    