Audio Player in J2ME
I am new to J2ME. I want to play an audio song in my application. I have written
Player p = null;
try {
p = Manager.createPlayer(ge开发者_Python百科tClass().getResourceAsStream("aa.wav"),"audio/x-wav");
p.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MediaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
where "aa.wav" is a wav format song placed in resource folder. when i debug this code
getClass().getResourceAsStream("aa.wav")
it returns null.
Can you please Help me thanks
if resource folder is under src then.
make it
getClass().getResourceAsStream("/resource/aa.wav")
精彩评论