This is my playSound method:
public static void playSound(FileInputStream f,boolean repeat)
{
AudioPlayer Audio=AudioPlayer.player;
AudioData MD;
AudioDataStream sound=null;
ContinuousAudioDataStream loop=null;
try{
MD=new AudioStream(f).getData();
loop=new ContinuousAudioDataStream(MD);
sound=new AudioDataStream(MD);
}
catch (Exception e){}
if(!repeat)
Audio.start(sound);
else
Audio.start(loop);
//Audio.stop(loop);
}
If I use a .wav music file that is short -like a gunshot sound-it works. I am trying to add some background music which is 2 minutes long. The gunshot sound works perfectly fine and the background music complies without error but it does not play. Is there a limit to how long the audio file can be and are there any solutions?
Also, not related to the question but would appreciate an answer, I am getting a message that AudioPlayer is an internal proprietary API and may be removed in the future. Could someone please explain this to me.