unosquare/ffmediaelement

Error in binding SpeedRatio & Volume

TMS-Namespace opened this issue · 1 comments

Issue Title (Error in binding SpeedRatio & Volume)

Although binding other properties works fine, and those two seems to be dependency properties, and they do work if set programmatically, WPF binding and the designer throws an exception (Object reference not set to an instance of an object, see below), and during run time (compiles with no issues), no value changes takes place (in either directions).

Issue Categories

  • [*] Bug

Version Information

  • NuGet Package 4.4.350
  • Visual Studio 2022, .Net Framework 6 (same behavior with .Net Framework 5)

Sample Code

XAML

image

Stack trace from the WPF designer

at Unosquare.FFME.MediaElement.OnSpeedRatioPropertyChanging(DependencyObject d, Object value) at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue) at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp) at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange) at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange) at System.Windows.Data.BindingExpression.Activate(Object item) at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt) at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Run(Object arg) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

It's work for me,do it.

<ffme:MediaElement
                x:Name="player"
             
                Panel.ZIndex="0"
                IsDesignPreviewEnabled="True"
                LoadedBehavior="Play"
                Stretch="Fill"
                UnloadedBehavior="Manual"
                Volume="{Binding ElementName=sliderVolume, Path=Value, Mode=TwoWay}" />
<Slider
                                x:Name="sliderVolume"
                                Width="100"
                                Maximum="1"                    
                                TickFrequency=".01"
                                Value="1" />