Android VideoView: 频繁异常和崩溃(失败代码:-32)
Android VideoView: Frequent exception and crash (failure code: -32)
情况
我正在使用 VideoView,当我想播放视频时会显示它。播放视频后,我再次将其隐藏。所以 我不会每次都重新创建 VideoView。
异常
当我尝试开始播放视频时(有时在我已经使用 VideoView 播放了多个视频之后),应用偶尔会崩溃。
我得到了您可以在下面找到的堆栈跟踪。我几乎尝试了一切,但没有运气。也许您也曾为这个问题而苦恼,甚至知道原因?
02-23 15:10:52.362 22834-22890/com.app.example D/dalvikvm: GC_EXPLICIT freed 189K, 27% free 11296K/15368K, paused 0ms+0ms, total 10ms
02-23 15:10:52.422 22834-22890/com.app.example D/dalvikvm: GC_EXPLICIT freed 189K, 27% free 11296K/15368K, paused 0ms+0ms, total 10ms
02-23 15:12:19.832 22834-22890/com.app.example W/PGA: [22890] egl: eglDestroySurface (0x5583a7a0, 0x7956ad40)
02-23 15:12:19.832 22834-22890/com.app.example W/PGA: [22890] egl: eglDestroySurface (0x5583a7a0, 0x7956ad40) returned
02-23 15:12:19.872 22834-22843/com.app.example E/MediaPlayer: error (1, -2147483648)
02-23 15:12:20.182 22834-22834/com.app.example D/AndroidRuntime: Shutting down VM
02-23 15:12:20.182 22834-22834/com.app.example W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x64d77b20)
02-23 15:12:20.182 22834-22847/com.app.example W/AudioSystem: AudioFlinger server died!
02-23 15:12:20.182 22834-22847/com.app.example W/IMediaDeathNotifier: media server died
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example W/AudioSystem: AudioPolicyService server died!
02-23 15:12:20.322 22834-22834/com.app.example I/Process: Sending signal. PID: 22834 SIG: 9
02-23 15:12:20.322 22834-22834/com.app.example D/AndroidRuntime: procName from cmdline: com.app.example
02-23 15:12:20.322 22834-22834/com.app.example E/AndroidRuntime: in writeCrashedAppName, pkgName :com.app.example
02-23 15:12:20.322 22834-22834/com.app.example D/AndroidRuntime: file written successfully with content: com.app.example StringBuffer : ;com.app.example
02-23 15:12:20.322 22834-22834/com.app.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.example, PID: 22834
java.lang.RuntimeException: failure code: -32
at android.media.MediaPlayer.invoke(MediaPlayer.java:664)
at android.media.MediaPlayer.getInbandTrackInfo(MediaPlayer.java:1692)
at android.media.MediaPlayer.scanInternalSubtitleTracks(MediaPlayer.java:1851)
at android.media.MediaPlayer.access0(MediaPlayer.java:529)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2198)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
你的问题好像其他人也遇到过。
One solution 会是这个
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
if( mp != null ) {
mp.setDisplay(null);
mp.reset();
mp.setDisplay(mMovieView.getHolder());
}
}
});
另一个是 update SDK
或每个媒体内容源recreating the VideoView
所有这些都表明它发生在 Android KitKat 4.4.x 上。
情况
我正在使用 VideoView,当我想播放视频时会显示它。播放视频后,我再次将其隐藏。所以 我不会每次都重新创建 VideoView。
异常
当我尝试开始播放视频时(有时在我已经使用 VideoView 播放了多个视频之后),应用偶尔会崩溃。
我得到了您可以在下面找到的堆栈跟踪。我几乎尝试了一切,但没有运气。也许您也曾为这个问题而苦恼,甚至知道原因?
02-23 15:10:52.362 22834-22890/com.app.example D/dalvikvm: GC_EXPLICIT freed 189K, 27% free 11296K/15368K, paused 0ms+0ms, total 10ms
02-23 15:10:52.422 22834-22890/com.app.example D/dalvikvm: GC_EXPLICIT freed 189K, 27% free 11296K/15368K, paused 0ms+0ms, total 10ms
02-23 15:12:19.832 22834-22890/com.app.example W/PGA: [22890] egl: eglDestroySurface (0x5583a7a0, 0x7956ad40)
02-23 15:12:19.832 22834-22890/com.app.example W/PGA: [22890] egl: eglDestroySurface (0x5583a7a0, 0x7956ad40) returned
02-23 15:12:19.872 22834-22843/com.app.example E/MediaPlayer: error (1, -2147483648)
02-23 15:12:20.182 22834-22834/com.app.example D/AndroidRuntime: Shutting down VM
02-23 15:12:20.182 22834-22834/com.app.example W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x64d77b20)
02-23 15:12:20.182 22834-22847/com.app.example W/AudioSystem: AudioFlinger server died!
02-23 15:12:20.182 22834-22847/com.app.example W/IMediaDeathNotifier: media server died
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example E/MediaPlayer: error (100, 0)
02-23 15:12:20.182 22834-22847/com.app.example W/AudioSystem: AudioPolicyService server died!
02-23 15:12:20.322 22834-22834/com.app.example I/Process: Sending signal. PID: 22834 SIG: 9
02-23 15:12:20.322 22834-22834/com.app.example D/AndroidRuntime: procName from cmdline: com.app.example
02-23 15:12:20.322 22834-22834/com.app.example E/AndroidRuntime: in writeCrashedAppName, pkgName :com.app.example
02-23 15:12:20.322 22834-22834/com.app.example D/AndroidRuntime: file written successfully with content: com.app.example StringBuffer : ;com.app.example
02-23 15:12:20.322 22834-22834/com.app.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.example, PID: 22834
java.lang.RuntimeException: failure code: -32
at android.media.MediaPlayer.invoke(MediaPlayer.java:664)
at android.media.MediaPlayer.getInbandTrackInfo(MediaPlayer.java:1692)
at android.media.MediaPlayer.scanInternalSubtitleTracks(MediaPlayer.java:1851)
at android.media.MediaPlayer.access0(MediaPlayer.java:529)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2198)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
你的问题好像其他人也遇到过。
One solution 会是这个
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
if( mp != null ) {
mp.setDisplay(null);
mp.reset();
mp.setDisplay(mMovieView.getHolder());
}
}
});
另一个是 update SDK
或每个媒体内容源recreating the VideoView
所有这些都表明它发生在 Android KitKat 4.4.x 上。