void mediaElement1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { if (e.newState == (int)WMPLib.WMPPlayState.wmppsPlaying) { if (resumeposition != 0) { axWindowsMediaPlayer1.Ctlcontrols.currentPosition = resumeposition; resumeposition = 0; } if (playstate != 1) { MediaOpen(); } MediaPositionTimer.Start(); this.Text = CommonHelper.SetPlayerTitle("Playing", CurrentVideoItem.Directory.FullName); } else if (e.newState == (int)WMPLib.WMPPlayState.wmppsStopped) { //Played.RLastPostion(Helper.FileName(URL.uri)); CurrentVideoItem.LastPlayedPoisition.ProgressLastSeen = (double)CurrentVideoItem.Progress; if (!CurrentVideoItem.HasLastSeen && CurrentVideoItem.Progress > 0) { LastSeenHelper.AddLastSeen(CurrentVideoItem.ParentDirectory, CurrentVideoItem.LastPlayedPoisition); } MediaPositionTimer.Stop(); resumeposition = CurrentVideoItem.Progress; this.Text = CommonHelper.SetPlayerTitle("Stopped", CurrentVideoItem.Directory.FullName); } else if (e.newState == (int)WMPLib.WMPPlayState.wmppsPaused) { MediaPositionTimer.Stop(); this.Text = CommonHelper.SetPlayerTitle("Paused", CurrentVideoItem.Directory.FullName); } }
private void SavePlayed() { CurrentVideoItem.LastPlayedPoisition.ProgressLastSeen = (double)axWindowsMediaPlayer1.Ctlcontrols.currentPosition; if (!CurrentVideoItem.HasLastSeen && CurrentVideoItem.Progress > 0) { LastSeenHelper.AddLastSeen(CurrentVideoItem.ParentDirectory, CurrentVideoItem.LastPlayedPoisition); } ApplicationService.SaveLastSeenFile(CurrentVideoItem.ParentDirectory); }
private void MediaPlayerStop() { if (CurrentVideoItem == null) { return; } CurrentVideoItem.LastPlayedPoisition.ProgressLastSeen = (double)CurrentVideoItem.Progress; if (!CurrentVideoItem.HasLastSeen && CurrentVideoItem.Progress > 0) { LastSeenHelper.AddLastSeen(CurrentVideoItem.ParentDirectory, CurrentVideoItem.LastPlayedPoisition); } if (mediaState == MediaState.Stopped) { IVideoElement.MediaPlayer.Stop(); PlayBackAction(MediaState.ToString()); } CurrentVideoItem.IsActive = false; if (IsDirectoryChanged) { IsDirectoryChanged = false; ApplicationService.SaveLastSeenFile(CurrentVideoItem.ParentDirectory); } }