Huge performance issue WPF Windows 10 tracking progress
Hi all,
Im trying to make my own player for windows at this time and i have a huge performance issue when im trying to track video progrees and show it on label or setup slider. Code below is very easy and sice i dont want to use own timer system i was thinking of to use PositionChange event. However with this code video just get slower u can see single frames and huge lags. Is there any proper way how to update c# visual components then this please ? Also my source is mainly form www. so im streaming it. Strange thing is without this code it is working perfecly but im not able to track progress then..
private async void VideoView_PositionChanged(object sender, MediaPlayerPositionChangedEventArgs e)
{
if (_mediaPlayer.IsPlaying)
{
await Dispatcher.BeginInvoke((Action)(() => sliderPosition.Value = _mediaPlayer.Position * sliderPosition.Maximum));
}
}