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.
MIT License
1.58k stars 471 forks source link

[Bug] MediaElement bugs when 'IsLoop' is set to true #2002

Open ZivFarin opened 9 months ago

ZivFarin commented 9 months ago

Description

When MediaElement's "IsLoop" is set to "True":

  1. [iOS] The MediaElement's "speed" (hardcoded to the xaml) is reset to 1 after the 1st iteration (which played at the wanted speed) is over.
  2. [iOS] Looping just stops after a while when several instances of MediaElement are running.
  3. [Android] Media controls are showing even though 'ShowsPlaybackControls' is set to "False".

Stack Trace

NaN

Link to Reproduction Sample

Steps to Reproduce

  1. Set both 'IsLoop=True' and a speed(<1 and >0)
  2. Play video on iOS device with iOS version >= 16
  3. Video\s would reset speed after first iteration is over

Expected Behavior

Speed will stay the same after first "loop"

Actual Behavior

Speed changes

Basic Information

On iOS: I believe this happens due to the usage of 'avPlayerViewController.Player?.Play()' instead of the renderer's Play() method (note that 'Play()' redefines the speed each time)

Workaround

All bugs dissapeared when setting "IsLoop" to "False" and then using an event handler for 'MediaEnded' event to run MediaElement.Play();

Reproduction imagery

X

FedericoNembrini commented 8 months ago

Can't reproduce point 3, which version of Android are you testing on? Can you post the XAML?

ZivFarin commented 8 months ago

As written - Android 13. Can't share it... Sorry.

FedericoNembrini commented 8 months ago

I tested IsLoop=True on an Android Emulator with Android 13.0 and I don't ecounter the error.

Can you test on other devices/emulators to better understand the casistics?