I am trying to load/play a sound (I have file /res/raw/fx2.wav)
with the code:
MediaPlayer mp = MediaPlayer.create(this, R.raw.fx2);
or
MediaPlayer mp = MediaPlayer.create(getApplicationContext(), R.raw.fx2);
And i get this error:
java.io.IOException: Prepare failed.: status=0x1
I searched this error but none of the answers had working code. Such examples also had:
MediaPlayer mediaPlayer = new MediaPlayer();
and then something with:
FileInputStream
or
mp.setDataSrouce
I am experimenting with these but I have nothing working so far and I don't know what method is best for me or in what situations they should be used? I simply want to load and play a sound.
It might be I am just not getting the context properly. Or there is something wrong with my sound file(but it is a normal small way so I think it is not this).
Any ideas?