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); } }
private void DoTrackPause() { if (!IsPaused) { Debug.WriteLine("Audio player was not paused"); PlayerStoryboard.Pause(mediaElement); IsPaused = true; Debug.WriteLine("Audio player now paused"); } else { Debug.WriteLine("Audio player was paused"); PlayerStoryboard.Resume(mediaElement); IsPaused = false; Debug.WriteLine("Audio player now unpaused"); } }