How to catch exceptions
brenttaft opened this issue · comments
Brent Taft commented
I am trying InTheHand Media player - and so far it works great. However, I did notice that if i try to play a video file that is corrupted - it will crash my app. I have the media element in XAML and using data binding to play the video. Is there a way to prevent to catch these exceptions so the whole app doesn't go crash?
Peter Foot commented
This is possibly in the code used to load the metadata, are there any clues in the stacktrace?
Brent Taft commented
Hi Peter,
Thanks for getting back to me – here is the crash dump
java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:72)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Xamarin caused by: Java.Lang.RuntimeException: setDataSource failed: status = 0x80000000
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <e736913786c2475188869561ae512b72>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <e736913786c2475188869561ae512b72>:0
at Android.Media.MediaMetadataRetriever.SetDataSource (System.String path) [0x00029] in <8211f1f12f9e45838d631abf63e51c79>:0
at InTheHand.Forms.Platform.Android.VideoViewEx.SetVideoPath (System.String path) [0x0000e] in <ec1877afb41f4cb395f8227f6d116d7c>:0
at InTheHand.Forms.Platform.Android.MediaElementRenderer.UpdateSource () [0x0013b] in <ec1877afb41f4cb395f8227f6d116d7c>:0
at InTheHand.Forms.Platform.Android.MediaElementRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00084] in <ec1877afb41f4cb395f8227f6d116d7c>:0
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x000fb] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in <c5acf3f925894bbdbed61060c90ad691>:0
at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in <c5acf3f925894bbdbed61060c90ad691>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <8211f1f12f9e45838d631abf63e51c79>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <8211f1f12f9e45838d631abf63e51c79>:0
at (wrapper dynamic-method) System.Object:4ba77e24-d405-4dba-9812-7721fef1574d (intptr,intptr)
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: setDataSource failed: status = 0x80000000
at android.media.MediaMetadataRetriever.setDataSource(Native Method)
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:72)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
From: Peter Foot<mailto:notifications@github.com>
Sent: Thursday, January 25, 2018 8:49 AM
To: inthehand/InTheHand.Forms<mailto:InTheHand.Forms@noreply.github.com>
Cc: brenttaft<mailto:brtaft@hotmail.com>; Author<mailto:author@noreply.github.com>
Subject: Re: [inthehand/InTheHand.Forms] How to catch exceptions (#41)
This is possibly in the code used to load the metadata, are there any clues in the stacktrace?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Finthehand%2FInTheHand.Forms%2Fissues%2F41%23issuecomment-360507341&data=02%7C01%7C%7C32a5ec3a900347aa70a808d5640b284f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636524921433782108&sdata=jclMoIGQTZda1kvyedXNxTz8wgU4FihrTO3xYuCHCro%3D&reserved=0>, or mute the thread<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHQa_thjxxCUIrzWEdSluvPJ_ldg2h1Nks5tOKJrgaJpZM4RtAHM&data=02%7C01%7C%7C32a5ec3a900347aa70a808d5640b284f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636524921433782108&sdata=7Bz4mGtbZYiNqtBfLKsDgKgmp6NFqCXKUmQ57XTyIIA%3D&reserved=0>.