void timer_Tick(object sender, EventArgs e)
 {
     if (TimerWorking) return;
     if (PlayerStreamSource == null) return;
     lock (PlayerStreamSource) {
         TimerWorking = true;
         if (NeedToReset) {
             MediaPlayer.Pause(); // must do this!
             Playlist.Seek(NextSeekLocation);
             PlayerStreamSource.Dispose();
             PlayerStreamSource = new HCS_MediaStreamingSource(Playlist); // this means all new buffers
             MediaPlayer.SetSource(PlayerStreamSource);
             MediaPlayer.Position = NextSeekLocation;
             MediaPlayer.Play();
             NeedToReset = false;
         } else { // not a reset pass.
             MediaControls.UpdatePosition(
                 Playlist,
                 CurrentPosition,
                 MediaPlayer.CurrentState);
         }
         TimerWorking = false;
     }
 }
        /// <summary>
        /// Playlist is ready -- hook up the MediaStreamingSource and start!
        /// </summary>
        void Playlist_PlaylistReady(object sender, EventArgs e)
        {
            MediaPlayer.Stop();
            MediaPlayer.AutoPlay = true;

            if (MaybeStartTime.HasValue) {
                Playlist.Seek(TimeSpan.FromSeconds(MaybeStartTime.Value));
            } else if (Playlist.IsLive) {
                Playlist.SeekNearEnd();
            } // otherwise will be going from start.
            if (PlayerStreamSource != null) PlayerStreamSource.Dispose();
            PlayerStreamSource = new HCS_MediaStreamingSource(Playlist);

            Ready = true;
            MediaPlayer.SetSource(PlayerStreamSource);
        }