问题
Hello guys my app returns failure code -32 when trying to play a video in Android 4.4 (KitKat).
I can't actually find any information about this errorcode perhaps any of you knows more about this issue?
11-04 13:43:08.966: E/AndroidRuntime(26482): java.lang.RuntimeException: failure code: -32
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.invoke(MediaPlayer.java:664)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.getInbandTrackInfo(MediaPlayer.java:1692)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.scanInternalSubtitleTracks(MediaPlayer.java:1851)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer.access$600(MediaPlayer.java:529)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2198)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.os.Handler.dispatchMessage(Handler.java:102)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.os.Looper.loop(Looper.java:137)
11-04 13:43:08.966: E/AndroidRuntime(26482): at android.app.ActivityThread.main(ActivityThread.java:4998)
11-04 13:43:08.966: E/AndroidRuntime(26482): at java.lang.reflect.Method.invokeNative(Native Method)
11-04 13:43:08.966: E/AndroidRuntime(26482): at java.lang.reflect.Method.invoke(Method.java:515)
11-04 13:43:08.966: E/AndroidRuntime(26482): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-04 13:43:08.966: E/AndroidRuntime(26482): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-04 13:43:08.966: E/AndroidRuntime(26482): at dalvik.system.NativeStart.main(Native Method)
回答1:
I have the same issue and this helps me https://groups.google.com/forum/#!topic/ima-sdk/dTkE2BmH1mw. Here the example of how i did it in my project(this is simple loop over playlist):
videoView = (VideoView)findViewById(R.id.videoView);
videoView.requestFocus();
videoView.start();
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
mp.setDisplay(null);
mp.reset();
mp.setDisplay(videoView.getHolder());
PlaylistItem next = playlistAdapter.getNext(lastVideo.id);
if (next != null && lastVideo.URL != null) {
lastVideo = next;
videoView.setVideoURI(next.getLocalFileURI());
videoView.requestFocus();
videoView.start();
}
});
the following lines
mp.setDisplay(null);
mp.reset();
mp.setDisplay(videoView.getHolder());
do the trick.
回答2:
Found the answer. I was using IMAVideoPlayer (for commercials). Just had to update the sdk.jar. Everything works fine on KitKat now.
来源:https://stackoverflow.com/questions/19768050/failure-code-32-mediaplayer-android-4-4