moust / cordova-plugin-videoplayer

A Codova plugin to play video with the native MediaPlayer on Android devices.
MIT License
139 stars 102 forks source link

Fatal exception causing app to crash #67

Open mojocakes opened 4 years ago

mojocakes commented 4 years ago

My application cycles through various videos on a continuous loop. Occasionally the videoplayer plugin causes the application to crash. According to crashlytics this has caused 55 crashes in the last 7 days. I'm not sure whats's causing this and I haven't been able to spot any patterns or learn anything useful through debugging.

Do you know what might be causing this issue? This is running on Android 4.4.2

Fatal Exception: java.lang.IllegalStateException
       at android.media.MediaPlayer._setVideoSurface(MediaPlayer.java)
       at android.media.MediaPlayer.setDisplay(MediaPlayer.java:715)
       at com.moust.cordova.videoplayer.VideoPlayer$2.surfaceCreated(VideoPlayer.java:216)
       at android.view.SurfaceView.updateWindow(SurfaceView.java:601)
       at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:237)
       at android.view.View.dispatchWindowVisibilityChanged(View.java:8004)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1077)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1077)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1077)
       at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1077)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1237)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5672)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:772)
       at android.view.Choreographer.doCallbacks(Choreographer.java:585)
       at android.view.Choreographer.doFrame(Choreographer.java:555)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:758)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5017)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
       at dalvik.system.NativeStart.main(NativeStart.java)
mojocakes commented 4 years ago

Not sure if it's related, but I'm also getting this error quite frequently:

E/PluginManager: Uncaught exception from plugin
    java.lang.IllegalStateException
        at android.media.MediaPlayer.isPlaying(Native Method)
        at com.moust.cordova.videoplayer.VideoPlayer.execute(VideoPlayer.java:91)
        at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
        at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
        at org.apache.cordova.PluginManager.exec(PluginManager.java:133)
        at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
        at org.crosswalk.engine.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
        at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
        at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.os.HandlerThread.run(HandlerThread.java:65)

Do you have any ideas what could be causing this? It's got me stumped