Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] MediaElement exception when fast changing Source few times #746

@RadoslawKubas

Description

@RadoslawKubas

Description

If fast changing MediaElement.Source value on iOS it is possible to see exception (on device and simulator)

System.ArgumentException: TimeSpan does not accept floating point Not-a-Number values.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: TimeSpan does not accept floating point Not-a-Number values.
  at System.TimeSpan.Interval (System.Double value, System.Int32 scale) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/TimeSpan.cs:244 
  at System.TimeSpan.FromSeconds (System.Double value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/TimeSpan.cs:271 
  at Xamarin.CommunityToolkit.UI.Views.MediaElementRenderer.get_Position () [0x0006f] in <2e7164d1a00d4fdc92a08e2145594ead>:0 
  at Xamarin.CommunityToolkit.UI.Views.MediaElementRenderer.ObserveRate (Foundation.NSObservedChange e) [0x0004b] in <2e7164d1a00d4fdc92a08e2145594ead>:0 
  at Foundation.NSObject+Observer.O
bserveValue (Foundation.NSString keyPath, Foundation.NSObject ofObject, Foundation.NSDictionary change, System.IntPtr context) [0x0001d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:804 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend(intptr,intptr)
  at AVFoundation.AVPlayer.Play () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/AVFoundation/AVPlayer.g.cs:218 
  at Xamarin.CommunityToolkit.UI.Views.MediaElementRenderer.Play () [0x000b2] in <2e7164d1a00d4fdc92a08e2145594ead>:0 
  at Xamarin.CommunityToolkit.UI.Views.MediaElementRenderer.UpdateSource () [0x001c3] in <2e7164d1a00d4fdc92a08e2145594ead>:0 
  at Xamarin.CommunityToolkit.UI.Views.MediaElementRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x000a7] in <2e7164d1a00d4fdc92a08e2145594ead>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:266 
  at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:362 
  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) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:510 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms
.Core\BindableObject.cs:446 
  at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00226] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:160 
  at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:56 
  at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__49_0 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:762 
  at Xamarin.Forms.BindingExpression+BindingExpressionPart.PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x000cb] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:773 
  at Xamarin.Forms.BindingExpression+WeakPropertyChangedProxy.OnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00012] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:666
2021-01-11 07:09:12
.441782+0100 TipCalculator.iOS[86877:6755116] 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
  at Prism.Mvvm.BindableBase.OnPropertyChanged (System.ComponentModel.PropertyChangedEventArgs args) [0x00000] in /_/src/Prism.Core/Mvvm/BindableBase.cs:81 

Steps to Reproduce

  1. Create page with MediaElement.Source binded to string property (web hosted video).
  2. Change fast binded property value to the new video few times.

Expected Behavior

New video starts to play.

Actual Behavior

If you change source slowly it works, but if you change it fast after few times, exception is thrown.

Basic Information

  • Version with issue: 1.0.0
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS: 14.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    a/MediaElementbugSomething isn't working. Breaky break.s/unverifiedThis issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions