I need your help. I tried to play the audio file stored in the Assets folder, but an error occurred.
Here is 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 is my logcat:
06-16 22: 39: 53.330: W / MediaPlayer (13490): information / warning (1, 26)
06-16 22: 39: 53.330: E / MediaPlayer (13490): error (1, -4)
Could you explain what is wrong with my code?
Thank you in advance
Hi,
Priska
source share