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_OnPlayingSongChanged() { ChangeImage(); ChangePlayBar(PlayingService.PlayingSong, PlayingService.PlayingAlbumBitmapImage, PlayingService.PlayingSong.Name, PlayingService.PlayingSong.ar.First().name, PlayingService.PlayingSong.al.name, PlayingService.PlayingSong.dt / 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.PlayNextSongs(); 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(); //SetLastPlayedSong(); //修改SMTC 显示的元数据 MediaItemDisplayProperties props = _mediaPlaybackItem.GetDisplayProperties(); props.Type = Windows.Media.MediaPlaybackType.Music; props.MusicProperties.Title = PlayingService.PlayingSong.Name; props.MusicProperties.Artist = PlayingService.PlayingSong.ar.First().name; props.Thumbnail = RandomAccessStreamReference.CreateFromFile(await ApplicationData.Current.LocalFolder.TryGetItemAsync(ConfigService.ImageFilename) as StorageFile); _mediaPlaybackItem.ApplyDisplayProperties(props); }