Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] App crash when unmounting video #33

Open
kfiroo opened this issue Feb 13, 2017 · 1 comment
Open

[Android] App crash when unmounting video #33

kfiroo opened this issue Feb 13, 2017 · 1 comment

Comments

@kfiroo
Copy link

kfiroo commented Feb 13, 2017

Hey,
I have route with a react-native-video component, the route is not currently focused, when unmounting the route the app crashes with the following error.

02-13 14:53:42.879  3774  3774 E AndroidRuntime: java.lang.IllegalStateException
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.media.MediaPlayer.isPlaying(Native Method)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.yqritc.scalablevideoview.ScalableVideoView.isPlaying(ScalableVideoView.java:209)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.yqritc.scalablevideoview.ScalableVideoView.onDetachedFromWindow(ScalableVideoView.java:84)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.brentvatne.react.ReactVideoView.onDetachedFromWindow(ReactVideoView.java:524)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.View.dispatchDetachedFromWindow(View.java:14555)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4789)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.ViewGroup.removeAllViews(ViewGroup.java:4735)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.views.view.ReactViewManager.removeAllViews(ReactViewManager.java:252)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.views.view.ReactViewManager.removeAllViews(ReactViewManager.java:41)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:536)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:533)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView(NativeViewHierarchyManager.java:533)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.NativeViewHierarchyManager$1.onAnimationEnd(NativeViewHierarchyManager.java:420)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.facebook.react.uimanager.layoutanimation.LayoutAnimationController$1.onAnimationEnd(LayoutAnimationController.java:131)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.view.animation.Animation$3.run(Animation.java:376)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:148)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
02-13 14:53:42.879  3774  3774 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

From what I could find in the docs:

IllegalStateException if the internal player engine has not been initialized or has been released.

My Video component is in a background route (i.e. there is a route on top of it) so maybe the video gets release when not visible and that causes the isPlaying to throw?

Thanks!

@dojiboy9
Copy link

@kfiroo Thanks for posting this! I was getting the same issue.

Looks like the specific issue has been fixed in ScalableVideoView thanks to this Pull Request: #12 .

On the React-Native-Video side, we need to use the latest version of ScalableVideoView (1.0.4), and make sure the release() method has been called correctly in ReactVideoView.java.

I just opened a PR for that here: TheWidlarzGroup/react-native-video#533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants