其他分享
首页 > 其他分享> > 失败代码-32 MediaPlayer(Android 4.4)

失败代码-32 MediaPlayer(Android 4.4)

作者:互联网

大家好,我的应用尝试在Android 4.4(KitKat)中播放视频时返回失败代码-32.

我实际上找不到有关此错误代码的任何信息,也许你们当中的任何人都对此问题了解更多?

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)

解决方法:

我有同样的问题,这可以帮助我https://groups.google.com/forum/#!topic/ima-sdk/dTkE2BmH1mw.
这是我在项目中的操作方式示例(这是播放列表上的简单循环):

     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();
       }
     });

以下几行

     mp.setDisplay(null);
     mp.reset();
     mp.setDisplay(videoView.getHolder());

做到这一点.

标签:android-4-4-kitkat,media-player,android
来源: https://codeday.me/bug/20191122/2060626.html