My logic for run background music when click button.
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
ContinuousAudioDataStream loop=null;
AudioPlayer mgp=AudioPlayer.player;
try{
AudioStream bgm=new AudioStream(new FileInputStream("C:/Users/Public/Music/Sample Music/Sleep Away.mp3"));
AudioData md=bgm.getData();
loop=new ContinuousAudioDataStream(md);
}
catch(IOException ex){
}
mgp.start(loop);
loop=null;
}
});
Hello EveryOne,
I am new to Java and creating a small program to add background music but its not working.
I have one qury do I need to add any .jar file in my lib folder for sound?
Thanks