Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
824 views
in Technique[技术] by (71.8m points)

media player - android:mediaplayer error(1, -17)

I am unable to find the solution to this problem. I just have to play an audio file and get the duration of that file. Sometimes it works fine but it shows error:

Below is my logcat:

Please help I am stucked.

02-01 12:30:40.287: E/MediaPlayer(256): error (1, -17)
02-01 12:30:41.896: D/MediaPlayer(256): create failed:
02-01 12:30:41.896: D/MediaPlayer(256): java.io.IOException: Prepare failed.: status=0x1
02-01 12:30:41.896: D/MediaPlayer(256): at android.media.MediaPlayer.prepare(Native Method)
02-01 12:30:41.896: D/MediaPlayer(256): at android.media.MediaPlayer.create(MediaPlayer.java:644)
02-01 12:30:41.896: D/MediaPlayer(256):     at PointOf1761.onClick(PointOf1761.java:953)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.View.performClick(View.java:2364)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.View.onTouchEvent(View.java:4179)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.View.dispatchTouchEvent(View.java:3709)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-01 12:30:41.896: D/MediaPlayer(256):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
02-01 12:30:41.896: D/MediaPlayer(256):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
02-01 12:30:41.896: D/MediaPlayer(256):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.os.Looper.loop(Looper.java:123)
02-01 12:30:41.896: D/MediaPlayer(256):     at android.app.ActivityThread.main(ActivityThread.java:4363)
02-01 12:30:41.896: D/MediaPlayer(256):     at java.lang.reflect.Method.invokeNative(Native Method)
02-01 12:30:41.896: D/MediaPlayer(256):     at java.lang.reflect.Method.invoke(Method.java:521)
02-01 12:30:41.896: D/MediaPlayer(256):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-01 12:30:41.896: D/MediaPlayer(256):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-01 12:30:41.896: D/MediaPlayer(256):     at dalvik.system.NativeStart.main(Native Method)

it says in line 953 

i have this in 953

953  female = MediaPlayer.create(this, femaleNum[i]);
954         handler.postDelayed(new Runnable() {
955             
956             @Override
957             public void run() {
958                 female.start();
959                 
960             }
961         },1000);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Please make sure you don't have too many MediaPlayer objects active at once. See this for reference.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...