private void Button_next_Click(object sender, RoutedEventArgs e) { if (PlayingService.IsPlayingSong) { PlayingService.PlayNextSongs(); } else { PlayingService.PlayNextRadio(); } }
private void CommandManager_NextReceived(MediaPlaybackCommandManager sender, MediaPlaybackCommandManagerNextReceivedEventArgs args) { if (PlayingService.IsPlayingSong) { PlayingService.PlayNextSongs(); } else { PlayingService.PlayNextRadio(); } }
private void Button_Next_Click(object sender, RoutedEventArgs e) { if (PlayingService.IsPlayingSong) { PlayingService.PlayNextSongs(); } else { PlayingService.PlayNextRadio(); } MyMainPage_OnIsOrNotFavoriteChanged(); }
private async void _mediaPlayer_MediaEnded(MediaPlayer sender, object args) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { _mediaTimelineController.Pause(); if (PlayingService.IsPlayingSong) { PlayingService.PlayNextSongs(); } else { PlayingService.PlayNextRadio(); } }); }
private async void PlayingService_OnPlayingRadioChanged() { ChangeImage(); ChangePlayBar(PlayingService.PlayingAlbumBitmapImage, PlayingService.PlayingRadio.Name, PlayingService.PlayingRadio.Dj.Nickname, PlayingService.PlayingRadio.Name, PlayingService.PlayingRadio.MainSong.Duration / 1000); if ((Application.Current as App).playingPage != null) { (Application.Current as App).playingPage.LoadLayout(); } if ((Application.Current as App).compactOverlayPage != null) { (Application.Current as App).compactOverlayPage.UpdateLayout(); } if (PlayingService.PlayingSongUrlRoot.data.First().url == null) { NotifyPopup notifyPopup = new NotifyPopup("播放地址错误"); notifyPopup.Show(); //跳过当前到下一首 PlayingService.PlayNextRadio(); return; } _mediaSource = await Task.Run(() => MediaSource.CreateFromUri(new Uri(PlayingService.PlayingSongUrlRoot.data.First().url))); _mediaSource.OpenOperationCompleted += _mediaSource_OpenOperationCompleted; _mediaPlaybackItem = new MediaPlaybackItem(_mediaSource); _mediaPlayer.Source = _mediaPlaybackItem; _mediaTimelineController.Start(); //修改SMTC 显示的元数据 MediaItemDisplayProperties props = _mediaPlaybackItem.GetDisplayProperties(); props.Type = Windows.Media.MediaPlaybackType.Music; props.MusicProperties.Title = PlayingService.PlayingRadio.Name; props.MusicProperties.Artist = PlayingService.PlayingRadio.Dj.Nickname; props.Thumbnail = RandomAccessStreamReference.CreateFromFile(await ApplicationData.Current.LocalFolder.TryGetItemAsync(ConfigService.ImageFilename) as StorageFile); _mediaPlaybackItem.ApplyDisplayProperties(props); }