So I was working on a mini game, and for the first time I added sound to my game, but I ran into two issues, the first is that when I load the applet up in my browser, and I close the tab when I’m done, the background music continues to play for a bit. I’m using this to play the background:
AudioClip audioClip = getAudioClip(getCodeBase(), "bg.wav");
audioClip.loop();
And that’s inside the init()
My second problem is that whenever I start the applet, it brings up that warning saying there is a mixture of signed and unsigned code, and that it could be unsafe. I’ve never gotten that before, so I assume it’s the sound files, what can I do about that?
http://www.FreeMinecraftHost.com/ParticleDefender is where the applet is hosted if you would like to see the message it brings up.
The warning I got did not say anything about ‘mixing signed & unsigned code’, but I refused the ‘allow trusted code’ dialog to check that the applet will work in a sand-box. It seems to work just fine, I could move left & right, shoot, destroy enemies, be destroyed by them, hear the (v. loud) music track, and restart the game.
Since the applet element indicates only a single Jar, and the main class is in that Jar, I cannot understand how you could get a message like you saw. Nevertheless, the solution to not get any prompts seems obvious.
Don’t sign the Jar!