private void HandlePositionChanged(object?sender, OnlyMPositionChangedEventArgs e) { if (!_manuallySettingPlaybackPosition && (e.Position - _lastPosition).TotalMilliseconds > 60) { // only fire every 60ms _lastPosition = e.Position; MediaPositionChangedEvent?.Invoke(this, e); if (!_firedNearEndEvent && _mediaElement.NaturalDuration.HasTimeSpan && (_mediaElement.NaturalDuration.TimeSpan - e.Position).TotalMilliseconds < FreezeMillisecsFromEnd) { _firedNearEndEvent = true; MediaNearEndEvent?.Invoke(this, new MediaNearEndEventArgs { MediaItemId = _mediaItemId }); } } }
private void HandleMediaNearEndEvent(object sender, MediaNearEndEventArgs e) { MediaNearEndEvent?.Invoke(this, e); }