xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xamarin Forms: Video is not working on Android version 12 and above with MediaElement[Bug]

sreejith-pagematics opened this issue · comments

I am using MediaElement for playing video in my xamarin forms application. It is working fine on android version 11 and below. But on android version 12 and above, after playing a video, if we tap on the pause option, the app breaks with the below exception:

Exception:

[InputEventReceiver] java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
[InputEventReceiver] at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:636)
[InputEventReceiver] at android.view.View.dispatchPointerEvent(View.java:14964)
[InputEventReceiver] at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6992)
[InputEventReceiver] at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6758)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6208)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6275)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6236)
[InputEventReceiver] at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6409)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6244)
[InputEventReceiver] at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6466)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6212)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6275)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6236)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6244)
[InputEventReceiver] at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6212)
[InputEventReceiver] at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9339)
[InputEventReceiver] at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9290)
[InputEventReceiver] at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9234)
[InputEventReceiver] at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9480)
[InputEventReceiver] at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:276)
[InputEventReceiver] at android.os.MessageQueue.nativePollOnce(Native Method)
[InputEventReceiver] at android.os.MessageQueue.next(MessageQueue.java:339)
[InputEventReceiver] at android.os.Looper.loopOnce(Looper.java:186)
[InputEventReceiver] at android.os.Looper.loop(Looper.java:334)
[InputEventReceiver] at android.app.ActivityThread.main(ActivityThread.java:8501)
[InputEventReceiver] at java.lang.reflect.Method.invoke(Native Method)
[InputEventReceiver] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
[InputEventReceiver] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

My Versions:

Xamarin forms: 5.0.0.2291

Xamarin.CommunityToolkit: 1.3.1

Visual Studio: 17.4.3

I tried updating the xamarin toolkit package to the latest, but no luck.

I added CrossMediaManager.Current.Speed = 1F; before playing audio, and now audio is working fine. But for video, it is playing well, but the pause option breaks the application.

I check this on some other devices, and there is no such issue. Video play and pause are working fine.
I am adding my device details ss below:

https://i.stack.imgur.com/PVm8l.jpg