question

Ashwini-0407 avatar image
0 Votes"
Ashwini-0407 asked Jadennx answered

Xamarin form app is Crashing in Android device

Hi All,

I am using Xamarin community toolkit Media element in my application to play and download video .

I am getting Runtime exception in Android device.

at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <9b7153498a554a03a0c08a72cc1857d5>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <9b7153498a554a03a0c08a72cc1857d5>:0
at Android.Media.MediaMetadataRetriever.SetDataSource (System.String uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x00039] in /Users/builder/azdo/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Media.MediaMetadataRetriever.cs:1145
at Android.Media.MediaMetadataRetriever+<>c
DisplayClass157_0.<SetDataSourceAsync>b_0 () [0x00000] in /Users/builder/azdo/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Media.MediaMetadataRetriever.cs:1155
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2476
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.CommunityToolkit.UI.Views.FormsVideoView.SetMetadata (Android.Net.Uri uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x000c1] in <5a061dbfb46d4075a03b222e34e7205f>:0
at Xamarin.CommunityToolkit.UI.Views.FormsVideoView.SetVideoURI (Android.Net.Uri uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x00076] in <5a061dbfb46d4075a03b222e34e7205f>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b
7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Android.App.SyncContext+<>c
DisplayClass2_0.<Post>b_0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/builder/azdo/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native
_this) [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Java.Lang.IRunnable.cs:84
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.54(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:282)


Seeking help here, Thanks in Advance

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please provide more information about how to reproduce this issue?

I found a similar issue in GitHub, MediaElement throws an internal error when it fails to load the media with a Java.Lang.RuntimeException: 'setDataSource failed: status = 0x80000000'.

Is it the same situation you're experiencing?

0 Votes 0 ·

1 Answer

Jadennx avatar image
0 Votes"
Jadennx answered

Same error.

Pop this in a View

<views:MediaElement HeightRequest="200"  x:Name="videoView" AutoPlay="True" Source="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" HorizontalOptions="FillAndExpand"></views:MediaElement>



In the CS file add

protected override void OnAppearing( )
{
    videoView.Play();
}

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.