Xamarin.Forms.Android using MediaPlayerElement application crashes, without MediaPlayerElement media plays fine
Summary
Repro / Sample Application crashes when using MediaPlayerElement
in ContentPage
, without MediaPlayerElement
the application doesn't crash and the Media plays fine, the audio can be heard
The Application also crashes in a non-shell Xamarin.Forms Project, same Stack Trace.
Ive tried intializing Core.Initialize()
in App.xaml.cs
& in the ViewModel.
LibVLCSharpFormsRenderer.Init()
is also called in MainActivity
I've also created multiple repro projects with different Xamarin.Forms versions, every time I have MediaPlayerElement
in any XAML the Application crashes
How one can reproduce the issue
The repro code can be found in AboutViewModel
& AboutPage
What is the current bug behavior?
Application crashes when using MediaPlayerElement
in ContentPage
, without MediaPlayerElement
the application doesn't crash and the Media plays fine, the audio can be heard.
What is the expected correct behavior?
No crash when using MediaPlayerElement
in a ContentPage
or any other View
Does it work on other platforms? Does it work with the official VLC apps?
It doesn't work in a fresh Xamarin.Forms 5.0.0.2337 application
Relevant LibVLC logs and/or screenshots
Stacktrace
2022-03-27 18:03:40.504 8024-8070/? E/VLC: [00007c31694dbcc0/1f86] libvlc video output: video output creation failed
2022-03-27 18:03:40.505 8024-8024/? A/mono-rt: [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
at Android.Runtime.JNINativeWrapper._unhandled_exception (System.Exception e) [0x0000e] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V (_JniMarshal_PPII_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.Int32 p0, System.Int32 p1) [0x0001f] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:133
at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V(intptr,intptr,int,int)
2022-03-27 18:03:40.505 8024-8024/? A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 8024 (ompanyname.app1), pid 8024 (ompanyname.app1)
Environment
- OS: Android
- Version 12, 11
- Device: Pixel 5 - API 30 Emulator & One Plus 8 Pro
- Architecture x86_x64
- LibVLSharp 3.6.6
- LibVLCSharp.Forms 3.6.6
- VideoLAN.LibVLC.Android 3.2.0.1
- Xamarin.Forms 5.0.0.2337