Ejemplo n.º 1
0
 public void PlayBetween(double startms, double endms)
 {
     LogPrint($"bet {startms} {endms}");
     controller.Duration = TimeSpan.FromMilliseconds(endms);
     controller.Resume();
     controller.Position = TimeSpan.FromMilliseconds(startms);
 }
Ejemplo n.º 2
0
 public void PlayIndex(int index)
 {
     GetSong(PlayList[index]);
     playerTimelineController.Start();
     playerTimelineController.Resume();
     PlayListNowPlay = index;
 }
Ejemplo n.º 3
0
 /**
  * MediaPlayerElement Holding Event
  */
 private void MediaPlayerElement_Holding(object sender, HoldingRoutedEventArgs e)
 {
     if (mediaTimelineController.State == MediaTimelineControllerState.Running && e.HoldingState == Windows.UI.Input.HoldingState.Started)
     {
         mediaTimelineController.Pause();
     }
     else if (e.HoldingState == Windows.UI.Input.HoldingState.Started)
     {
         mediaTimelineController.Resume();
     }
 }
Ejemplo n.º 4
0
 private void Play_Pause_Clicked(object sender, RoutedEventArgs e)
 {
     if (ppButton.Tag.ToString() == "pl")
     {
         _mediaTimelineController.Resume();
     }
     else
     {
         _mediaTimelineController.Pause();
     }
 }
Ejemplo n.º 5
0
 private void Start_Click(object sender, RoutedEventArgs e)
 {
     if (duration.TotalSeconds == 0)
     {
         return;
     }
     if (storyboard.GetCurrentState() == Windows.UI.Xaml.Media.Animation.ClockState.Stopped)
     {
         timer.Start();
         storyboard.Begin();
     }
     else
     {
         timer.Start();
         storyboard.Resume();
     }
     if (timeLine.Value == 0)
     {
         mediaTimelineController.Start();
     }
     else
     {
         mediaTimelineController.Resume();
     }
     Show_PauseButton();
 }
Ejemplo n.º 6
0
 private void startOrPause(object sender, RoutedEventArgs e)
 {
     if (timer == null)
     {
         timer          = new DispatcherTimer();
         timer.Interval = TimeSpan.FromSeconds(1);
         timer.Tick    += timer_Tick;
         timer.Start();
         EllStoryboard.Begin();
         mediaTimelineController.Start();
         var pauseIcon = new SymbolIcon(Symbol.Pause);
         startAndPauseButton.Icon  = pauseIcon;
         startAndPauseButton.Label = "Pause";
     }
     else
     {
         if (mediaTimelineController.State == MediaTimelineControllerState.Running)
         {
             EllStoryboard.Pause();
             mediaTimelineController.Pause();
             var playIcon = new SymbolIcon(Symbol.Play);
             startAndPauseButton.Icon  = playIcon;
             startAndPauseButton.Label = "Play";
         }
         else
         {
             EllStoryboard.Begin();
             mediaTimelineController.Resume();
             var pauseIcon = new SymbolIcon(Symbol.Pause);
             startAndPauseButton.Icon  = pauseIcon;
             startAndPauseButton.Label = "Pause";
         }
     }
 }
Ejemplo n.º 7
0
 //播放与暂停按钮
 private void PlayPauseClick(object sender, RoutedEventArgs e)
 {
     if (mediaTimeline != null)
     {
         //暂停之后点击继续或开始
         if (mediaTimeline.State == MediaTimelineControllerState.Paused)
         {
             coverStoryboard.Begin();
             mediaTimeline.Resume();
             playPauseButton.Icon = new SymbolIcon(Symbol.Pause);
         }//播放时暂停
         else if (mediaTimeline.State == MediaTimelineControllerState.Running)
         {
             mediaTimeline.Pause();
             coverStoryboard.Pause();
             playPauseButton.Icon = new SymbolIcon(Symbol.Play);
         }
         else if (mediaTimeline.State == MediaTimelineControllerState.Stalled)
         {
             mediaTimeline.Start();
             coverStoryboard.Begin();
         }
     }
     else
     {
         var messages = new MessageDialog("no file").ShowAsync();
     }
 }
Ejemplo n.º 8
0
 private void ButtonPlay_Click(object sender, RoutedEventArgs e)
 {
     if (timelineController.State == MediaTimelineControllerState.Running || timelineController.State == MediaTimelineControllerState.Stalled)
     {
         timelineController.Pause();
         ButtonPlay.Icon = new SymbolIcon()
         {
             Symbol = Symbol.Play
         };
     }
     else
     {
         timelineController.Resume();
         ButtonPlay.Icon = new SymbolIcon()
         {
             Symbol = Symbol.Pause
         };
     }
 }
 private void PlayPause_Click(object sender, RoutedEventArgs e)
 {
     if (timelineController.State == MediaTimelineControllerState.Paused)
     {
         timelineController.Resume();
     }
     else if (timelineController.State == MediaTimelineControllerState.Running)
     {
         timelineController.Pause();
     }
 }
Ejemplo n.º 10
0
        //</SnippetPlayButtonClick>

        //<SnippetPauseButtonClick>
        private void PauseButton_Click(object sender, RoutedEventArgs e)
        {
            if (_mediaTimelineController.State == MediaTimelineControllerState.Running)
            {
                _mediaTimelineController.Pause();
                _pauseButton.Content = "Resume";
            }
            else
            {
                _mediaTimelineController.Resume();
                _pauseButton.Content = "Pause";
            }
        }
Ejemplo n.º 11
0
        private void AppBarButton_Click_Play(object sender, RoutedEventArgs e)
        {
            if (!isMediaStart)
            {
                isMediaStart = true;
                Debug.WriteLine("start");

                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromSeconds(1);
                timer.Tick    += TimerClick;
                timer.Start();

                if (timeLine.Value == 0)
                {
                    _mediaTimelineController.Start();
                }
                else
                {
                    _mediaTimelineController.Resume();
                }
                MyPlayBtn.Icon = new SymbolIcon(Symbol.Pause);
                MyStoryBoard.Begin();
            }
            else if (_mediaTimelineController.State == MediaTimelineControllerState.Paused)
            {
                Debug.WriteLine("resume");
                _mediaTimelineController.Resume();
                MyPlayBtn.Icon = new SymbolIcon(Symbol.Pause);
                MyStoryBoard.Resume();
            }
            else if (_mediaTimelineController.State == MediaTimelineControllerState.Running)
            {
                Debug.WriteLine("pause");
                _mediaTimelineController.Pause();
                MyPlayBtn.Icon = new SymbolIcon(Symbol.Play);
                MyStoryBoard.Pause();
            }
        }
Ejemplo n.º 12
0
 private void PlayButton_Click(object sender, RoutedEventArgs e)
 {
     PlayButton.Visibility  = Visibility.Collapsed;
     PauseButton.Visibility = Visibility.Visible;
     timer.Start();
     if (mediaTimelineController.State == MediaTimelineControllerState.Paused)
     {
         mediaTimelineController.Resume();
     }
     else
     {
         mediaTimelineController.Start();
     }
 }
Ejemplo n.º 13
0
 private void PlayPauseButton_Click(object sender, RoutedEventArgs e)
 {
     if (MusicRes != "shit")  //资源有效
     {
         if (App.Musicplayer.Source is null)
         {
             wantplay(SongOwned);
         }
         else
         {
             if (App.Musicplayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing)
             {
                 _mediaTimelineController.Pause();
                 ((AppBarButton)sender).Icon = new SymbolIcon(Symbol.Play);
             }
             else
             {
                 _mediaTimelineController.Resume();
                 ((AppBarButton)sender).Icon = new SymbolIcon(Symbol.Pause);
             }
         }
     }
 }
Ejemplo n.º 14
0
 public void Play(object s, RoutedEventArgs e)
 {
     _mediaTimelineController.Resume();
     if (myStoryboard.GetCurrentState() == Windows.UI.Xaml.Media.Animation.ClockState.Stopped)
     {
         myStoryboard.Begin();
     }
     else
     {
         myStoryboard.Resume();
     }
     state.Text  = "Now Playing...";
     play.Icon   = new SymbolIcon(Symbol.Pause);
     play.Click -= Play;
     play.Click += Pause;
 }
Ejemplo n.º 15
0
        private void Button_stopOrPlay_Click(object sender, RoutedEventArgs e)
        {
            if (_mediaSource == null)
            {
                return;
            }
            var state = _mediaPlayer.PlaybackSession.PlaybackState;

            if (state == MediaPlaybackState.Playing)//改为暂停
            {
                _mediaTimelineController.Pause();
            }
            else
            {
                _mediaTimelineController.Resume();
            }
        }
Ejemplo n.º 16
0
        private void ButtonPlay_Click(object sender, RoutedEventArgs e)
        {
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            AvrilStoryboard.Begin();
            if (_mediaTimelineController.State == MediaTimelineControllerState.Paused)
            {
                _mediaTimelineController.Resume();
            }
            else
            {
                _mediaTimelineController.Start();
            }
        }
Ejemplo n.º 17
0
 private void pause_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_mediaTimelineController.State == MediaTimelineControllerState.Running)
         {
             EllStoryboard.Pause();
             _mediaTimelineController.Pause();
         }
         else
         {
             //EllStoryboard.Resume();
             EllStoryboard.Begin();
             _mediaTimelineController.Resume();
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 18
0
 private void play_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DispatcherTimer timer = new DispatcherTimer();
         timer.Interval = TimeSpan.FromSeconds(1);
         timer.Tick    += TimerTick;
         timer.Start();
         if (IsAudio())
         {
             EllStoryboard.Begin();
         }
         timelineController.Resume();
         play.Visibility  = Visibility.Collapsed;
         pause.Visibility = Visibility.Visible;
     }
     catch
     {
     }
 }
Ejemplo n.º 19
0
        //play the media
        void PlayMedia(object sender, RoutedEventArgs e)
        {
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer;
            timer.Start();
            if (mediaTimelineController.State == MediaTimelineControllerState.Paused)
            {
                mediaTimelineController.Resume();
            }
            else
            {
                mediaTimelineController.Start();//播放加载好的视频文件.
                InitializePropertyValues();
            }

            //图片旋转动画开始
            EllStoryboard.Begin();

            Start.Visibility = Visibility.Collapsed;
            Pause.Visibility = Visibility.Visible;
        }
Ejemplo n.º 20
0
 private void Vm_PlayVideo(object sender, EventArgs e)
 {
     // Play video when event raised in ViewModel
     _mediaTimelineController.Resume();
     _timer.Start();
 }