Problem: When using Android Media Player you get exception:
java.io.IOException: Prepare failed.: status=0x1
Java.io.exception: setDataSource error 0x800000
- Lot of people have said this is many times due to bad or corrupted Mp3 ,OGG or other file.
- Another solution is MediaPlayer.setDataSource has 3 overloaded variants. but the one which works is the one which takes 3 parameters, FileDescriptor, start Offset and length. If you dont give all 3 you face this issue. A newbie is very likely to hit this.
Common ways to debug this:
- If you are using MediaPlayer.Create(XXX) variant then most likely the issue is bad corrputed file.
- Most people face issue#2 when they try to use setDataSource vriant. Keep in mind to use the right one.
- To debug issue whether MP3 is corrupted or not : try copying the MP3 to raw directory and then use MediaPlayer.Create(resource id) variant. If that fails then most probably issue is with the file. If that works then that confirms the quality of your file and you need to look at your code.
Hope this helps. I spent lot of time struggling with MediaPlayer issues. Let me know if you face any and I will try to help you as much as I can.