private void UIElement_OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { Debug.WriteLine(ListViewSong.SelectedIndex); currentIndex = ListViewSong.SelectedIndex; var playIcon = sender as SymbolIcon; if (playIcon != null) { var currentSong = playIcon.Tag as Song; Debug.WriteLine(currentSong.name); MyMediaElement.Source = new Uri(currentSong.link); NowPlayingText.Text = "Now playing: " + currentSong.name + " - " + currentSong.singer; } MyMediaElement.Play(); PlayAndPauseButton.Icon = new SymbolIcon(Symbol.Pause); running = true; }
private void VideoAnimationWindow_OnLoaded(object sender, RoutedEventArgs e) { MyMediaElement.LoadedBehavior = MediaState.Manual; MyMediaElement.MediaOpened += MyMediaElementOnMediaOpened; MyMediaElement.MediaEnded += MediaElementOnMediaEnded; MyMediaElement2.LoadedBehavior = MediaState.Manual; MyMediaElement2.MediaOpened += MyMediaElementOnMediaOpened; MyMediaElement2.MediaEnded += MediaElementOnMediaEnded2; MyMediaElement.Source = new Uri(@"AnimationPerformanceDemo\Assets\1.mp4", UriKind.RelativeOrAbsolute); MyMediaElement2.Source = new Uri(@"AnimationPerformanceDemo\Assets\2.mp4", UriKind.RelativeOrAbsolute); //await Task.Delay(_random.Next(0, 1000)); MyMediaElement.Play(); MyMediaElement2.Play(); }
private void PlayButton_Click(object sender, RoutedEventArgs e) { MyMediaElement.Play(); if (MyMediaElement.CurrentState == MediaElementState.Playing) { Symbol pico = Symbol.Play; SymbolIcon spico = new SymbolIcon(pico); Play.Icon = spico; MyMediaElement.Pause(); } else { Symbol pico = Symbol.Pause; SymbolIcon spico = new SymbolIcon(pico); Play.Icon = spico; MyMediaElement.Play(); } }
private async void SoundGridView_Drop(object sender, DragEventArgs e) { if (e.DataView.Contains(StandardDataFormats.StorageItems)) { var items = await e.DataView.GetStorageItemsAsync(); if (items.Any()) { var storageFile = items[0] as StorageFile; var contentType = storageFile.ContentType; StorageFolder folder = ApplicationData.Current.LocalFolder; if (contentType == "audio/wav" || contentType == "audio/mpeg") { StorageFile newfile = await(storageFile.CopyAsync(folder, storageFile.Name, NameCollisionOption.GenerateUniqueName)); MyMediaElement.SetSource(await storageFile.OpenAsync(FileAccessMode.Read), contentType); MyMediaElement.Play(); } } } }
private void UIElement_OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { Debug.WriteLine(ListViewSong.SelectedIndex); currentIndex = ListViewSong.SelectedIndex; var playIcon = sender as StackPanel; if (playIcon != null) { var currentSong = playIcon.Tag as Song; Debug.WriteLine(currentSong.name); MyMediaElement.Source = new Uri(currentSong.link); NowPlayingText.Text = currentSong.name + " - " + currentSong.singer; img.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(currentSong.thumbnail)); AddressBar.Visibility = Visibility.Visible; backgroud.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(currentSong.thumbnail)); volumeSlider.Value = 100; } MyMediaElement.Play(); PlayAndPauseButton.Symbol = Symbol.Pause; running = true; }
private void HyperLink_Click(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args) { MyMediaElement.Source = new Uri("C:/Users/rsrir/Music/Skip_To_My_Lou.mp3"); System.Diagnostics.Debug.WriteLine("Name ====", sender.Name); MyMediaElement.Play(); }
private void BtnPlay_OnClick(object sender, RoutedEventArgs e) { MyMediaElement.Source = new Uri("http://star.010e.net:8000/live/ahmedmadi/123456/72.ts"); MyMediaElement.Play(); }
private void Button_Click(object sender, RoutedEventArgs e) { MyMediaElement.Play(); }
public void Play(string s) { MyMediaElement.Source = new Uri(@s); MyMediaElement.Play(); }
private void Button_Click(object sender, RoutedEventArgs e) { MyMediaElement.DefaultPlaybackRate = 1.0; MyMediaElement.Play(); }
public void NextSong(Song s) { //string songname = String.Empty; if (!File.Exists(MediaPath.AudioFile) && !File.Exists(MediaPath.VideoFile)) { MObj.LoadAllSongs(); } if (MyMediaElement.IsMuted) { GideonBase.SynObj.SpeakAsync("Volume is mute, please Increase the volume!"); } switch (Indicator) { case MediaCodes.PlayAudio: ++MObj.AudPos; if (MObj.AudPos > MObj.Audios.Length - 1) { MObj.AudPos = 0; } if (!File.Exists(MObj.Audios[MObj.AudPos])) { NextSong(s); return; } songname = MObj.Audios[MObj.AudPos]; GideonBase.SynObj.SpeakAsync("Playing Next Song!"); MyMediaElement.Source = new Uri(songname); break; case MediaCodes.PlayVideo: ++MObj.VidPos; if (MObj.VidPos > MObj.Videos.Length - 1) { MObj.VidPos = 0; } if (!File.Exists(MObj.Videos[MObj.VidPos])) { NextSong(s); return; } songname = MObj.Videos[MObj.VidPos]; GideonBase.SynObj.SpeakAsync("Playing Next Video!"); MyMediaElement.Source = new Uri(songname); break; } IsPlay = true; PlayOrPause.Content = new Image { Source = new BitmapImage(new Uri(MediaPath.Pause)) }; PlayOrPause.ToolTip = "Play"; s.SongName = songname; MyMediaElement.Play(); }
public void PlaySong(MediaCodes Indicator, Song s) { if (!File.Exists(MediaPath.AudioFile) && !File.Exists(MediaPath.VideoFile)) { MObj.LoadAllSongs(); } if (MyMediaElement.IsMuted) { GideonBase.SynObj.SpeakAsync("Volume is mute, please Increase the volume!"); } switch (Indicator) { case MediaCodes.PlayAudio: this.Indicator = Indicator; // this.Visibility = Visibility.Hidden; if (!File.Exists(MObj.Audios[MObj.AudPos])) { NextSong(s); return; } songname = MObj.Audios[MObj.AudPos]; GideonBase.SynObj.SpeakAsync("Playing Song!"); MyMediaElement.Source = new Uri(songname); break; case MediaCodes.PlayVideo: this.Indicator = Indicator; //this.Visibility = Visibility.Visible; if (!File.Exists(MObj.Videos[MObj.VidPos])) { NextSong(s); return; } songname = MObj.Videos[MObj.VidPos]; GideonBase.SynObj.SpeakAsync("Playing Video!"); MyMediaElement.Source = new Uri(songname); break; case MediaCodes.Play: if (!File.Exists(MObj.Audios[MObj.AudPos])) { NextSong(s); return; } if (!File.Exists(MObj.Videos[MObj.VidPos])) { NextSong(s); return; } break; } IsPlay = true; PlayOrPause.Content = new Image { Source = new BitmapImage(new Uri(MediaPath.Pause)) }; PlayOrPause.ToolTip = "Play"; s.SongName = songname; MyMediaElement.Play(); }