private async void DoTrackStart() { await Task.Delay(100).ConfigureAwait(false); if (partPlayStart != TimeSpan.Zero) { //await Task.Delay(100); // PlayerStoryboard.BeginTime = MarkerStoryboard.BeginTime = partPlayStart; if (PlayPartLength > 0) { var end = (TimeSpan.FromMilliseconds(PlayPartLength + partPlayStart.TotalMilliseconds)); endAnimationTime = end; // PlayerStoryboard.Duration = MarkerStoryboard.Duration = (TimeSpan.FromMilliseconds(PlayPartLength + partPlayStart.TotalMilliseconds)); //PlayerStoryboard.SpeedRatio = 0.5; // playTimer = new System.Threading.Timer(doTrackPartEnd, partPlayStart, (int)PlayPartLength, Timeout.Infinite); } else { endAnimationTime = null; partPlayStart = TimeSpan.Zero; } PlayerStoryboard.Resume(mediaElement); MarkerStoryboard.Resume(PositionBar); } else { PlayerStoryboard.Begin(mediaElement, true); MarkerStoryboard.Begin(PositionBar, true); } }
internal void SeekToMousePointInTime(TimeSpan seekTime) { if (seekTime.Ticks < 0) { seekTime = TimeSpan.FromTicks(1); } partPlayStart = seekTime; MarkerStoryboard.Begin(PositionBar, true); // if the second parameter is missing or false, it doesn't work MarkerStoryboard.Seek(PositionBar, seekTime, TimeSeekOrigin.BeginTime); MarkerStoryboard.Pause(PositionBar); // stop doesn't work PlayerStoryboard.Begin(mediaElement, true); // if the second parameter is missing or false, it doesn't work PlayerStoryboard.Seek(mediaElement, seekTime, TimeSeekOrigin.BeginTime); PlayerStoryboard.Pause(mediaElement); // stop doesn't work }