private void PlayNextTrack() { if (MainMedia.Source == null) { return; } MainMedia.Stop(); if (!player.NextTrack(Mode)) { FullTimeText.Text = "00:00:00"; MediaImage.Source = null; TitleTextBlock.Text = ""; PerfomersTextBlock.Text = ""; IsPlaying = false; } else { LoadFullSong(); if (!IsPlaying) { PausePlay(); } else { MainMedia.Play(); } } Thread.Sleep(500); }
public void Resume(SmoothStreamingMediaElement media) { if (media != MainMedia) { // disabling slave media foreach (SlaveMediaElement slave in SubMediaElements) { if (slave.MediaElement == media) { slave.IsLogicalSyncEnabled = true; if (slave.IsPhysicalSyncEnabled) { slave.MediaElement.Play(); } } } } else { // disable main media foreach (SlaveMediaElement slave in SubMediaElements) { slave.IsLogicalSyncEnabled = true; } MainMedia.Play(); } }
private void MenuOpen_Click(object sender, RoutedEventArgs e) { if (player.OpenTracklist()) { LoadFullSong(); MainMedia.Play(); PlaylistTitle.Text = player.TracklistName; } }
private void AddOneOrMoreTracks_Click(object sender, RoutedEventArgs e) { var res = player.AddOneOrMoreTracks(); if (MainMedia.Source == null && res) { LoadFullSong(); MainMedia.Play(); IsPlaying = true; } }
private void SliderThumbDragCompleted(object sender, EventArgs e) { if (MainMedia.Source == null) { return; } MainMedia.Position = TimeSpan.FromSeconds(TrackTimePosition.Value); TrackTimePosition.Value = MainMedia.Position.TotalSeconds; CurTimeText.Text = MainMedia.Position.ToString().Split('.')[0]; MainMedia.Play(); timer.Start(); }
private void TrackList_SelectionChanged(object sender, SelectionChangedEventArgs e) { MainMedia.Stop(); LoadFullSong(); if (!IsPlaying) { PausePlay(); } else { MainMedia.Play(); } TrackList.ScrollIntoView(TrackList.SelectedItem); }
private void masterMedia_MediaOpened(object sender, RoutedEventArgs e) { HeuristicManager.StartMonitoring(); // the live video intermittently starts at the beginning of the live video // instead of the end, it has been difficult to reproduce and resolve, calling // StartSeekToLive is a workaround to solve the problem, it can be removed if // find the root problem of the issue // // only want to run the workaround for live streams and when the initial // video is loaded, not when the stream is restored by the auto retry //if (MainMedia.IsLive && MainMedia.RetryState == RetryState.None) if (MainMedia.IsLive) { MainMedia.StartSeekToLive(); } MainMedia.Play(); }
private void PausePlay() { if (MainMedia.Source == null) { return; } if (IsPlaying) { MainMedia.Pause(); timer.Stop(); PauseButton.Background = new ImageBrush(new BitmapImage(new Uri("Icons/play.png", UriKind.Relative))); IsPlaying = false; } else { MainMedia.Play(); timer.Start(); PauseButton.Background = new ImageBrush(new BitmapImage(new Uri("Icons/pause.png", UriKind.Relative))); IsPlaying = true; } }
private void PreviousTrack_Click(object sender, RoutedEventArgs e) { if (MainMedia.Source == null) { return; } MainMedia.Stop(); player.PreviousTrack(Mode); LoadFullSong(); if (!IsPlaying) { PausePlay(); } else { MainMedia.Play(); } Thread.Sleep(500); }
//private void RetrySlaves() //{ // foreach (SlaveMediaElement slave in SubMediaElements) // { // if (slave.MediaElement.CurrentState == SmoothStreamingMediaElementState.Closed) // { // slave.MediaElement.Retry(); // } // } //} private void UnpauseAll() { HeuristicManager.StartMonitoring(); MainMedia.Play(); }