1

Situation

I am using a VideoView which I show when I want to play a video. After playing the video I hide it again. So I do not recreate the VideoView each time.

Exception

Every once in a while the app crashes when I try to start playing a video (sometimes after I have already played several videos using the VideoView before).

I get the stacktrace you can find below. I have tried almost everything but without luck. Maybe you struggled with this issue as well or even know the reason?

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.access$600(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)
sjkm
  • 3,887
  • 2
  • 25
  • 43
  • Possible duplicate of [Android MediaPlayer error (1, -2147483648)](http://stackoverflow.com/questions/11540076/android-mediaplayer-error-1-2147483648) – sjkm Feb 10 '17 at 17:13

1 Answers1

0

Your problem seems to have been encountered by others.

One solution would be this

mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
              if( mp != null ) { 
                    mp.setDisplay(null);
                    mp.reset();
                    mp.setDisplay(mMovieView.getHolder());
               }
         }
});

Another would be to update SDK

Or recreating the VideoView for each media content source

All of them suggest it is happening on Android KitKat 4.4.x.

Community
  • 1
  • 1
Radu Ionescu
  • 3,462
  • 5
  • 24
  • 43
  • 1
    Thanks Radu. I've also come across those answers. However, I also ended up recreating the VideoView each time... Seems the issue is gone. I can confirm that the first "solution" (onCompletion) doesn't work. Would be nice if we found a solution that works without recreating the VideoView... I'm going to accept anyway. – sjkm Feb 23 '16 at 17:17