I need your help. I tried to play an audio file stored in Assets folder but an error occurred.
Here are my code:
try{
if (player.isPlaying()) {
player.stop();
player.release();
}
}catch(Exception e){
Toast.makeText(this, "an exception occurred", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
try{
AssetFileDescriptor afd = BeeDailyConvo.this.getAssets().openFd("sounds/hello_kr.wma");
player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
player.prepare();
player.start();
}catch(Exception e){
e.printStackTrace();
}
And here are my logcat:
06-16 22:39:53.330: W/MediaPlayer(13490): info/warning (1, 26)
06-16 22:39:53.330: E/MediaPlayer(13490): error (1, -4)
Could you please explain what's wrong with my code?
Thank you in advance
Regards,
Priska