02-14-2013 06:02 PM
Hello,
I am trying to play a wav file on the blackberry and the debug is not giving me an Exception to work with. I have imported the wav file ('notify.wav') into my project as a resource (in the 'res' folder). Below is the snippet of code that should play the audio file, but there's no sound when I invoke the method.
try{
InputStream inptstrm =getClass().getResourceAsStream("/res/notify.wav");
Player p = javax.microedition.media.Manager.createPlayer(inptstrm, "audio/x-wav");
p.realize();
VolumeControl volume = (VolumeControl)p.getControl("VolumeControl");
volume.setLevel(99);
p.prefetch();
p.start();
}
catch(Exception me){
}
I suspect my issue is with the import and finding where the file is to play.
Any assistance would be greatly appreciated.
02-14-2013 06:25 PM
Agree finding the input file is the trick.
Don't think you need the res, just try
....getResourceAsStream("/notify.wav");
Do put some System.out.println(..) output in your exception handler too.