Ejemplo n.º 1
0
        private void ParsePageJson()
        {
            Dictionary <string, object> dictionary  = JsonConvert.DeserializeObject <Dictionary <string, object> >(pageJson);
            Dictionary <string, object> dictionary2 = JsonConvert.DeserializeObject <Dictionary <string, object> >(dictionary["msg"].ToString());
            string text = dictionary2["action"].ToString();
            string s    = dictionary2["execTime"].ToString();
            string s2   = dictionary2["actionTime"].ToString();

            switch (text)
            {
            case "play":
            {
                long num  = long.Parse(s);
                long num2 = 0L;
                num2 = DateTool.GetCurrentTimeInUnixMillis() - DeltaUTC;
                long num3 = num2 - num;
                mediaPlayer.Position = TimeSpan.Parse(s2) + new TimeSpan(0, 0, 0, 0, (int)num3);
                mediaPlayer.Play();
                IsAlwaysShowHeaderFooter = false;
                break;
            }

            case "pause":
                mediaPlayer.Play();
                mediaPlayer.Position = TimeSpan.Parse(s2);
                mediaPlayer.Pause();
                IsAlwaysShowHeaderFooter = true;
                break;
            }
        }
Ejemplo n.º 2
0
 void UC_Toolbar_Play_Click_Play()
 {
     //if (TabControl_Music.SelectedIndex == 0)
     //{
     if (UC_Toolbar_Play.Is_Play == false)
     {
         Chossen_Music();
         if (List_Collection.Current_NowPlaying == -1)
         {
             return;
         }
         UC_Toolbar_Play.Is_Play             = true;
         UC_Toolbar_Play.Button_Play.Content = ";";
         Player_Music.Play();
         timer.Start();
         Key_Controller = 2;
     }
     else
     {
         UC_Toolbar_Play.Is_Play             = false;
         UC_Toolbar_Play.Button_Play.Content = "4";
         Player_Music.Pause();
         Player_Music.Pause();
         timer.Start();
     }
 }
Ejemplo n.º 3
0
 public void Pause()
 {
     if (_mediaPlaying.CurrentState == MediaElementState.Playing ||
         _mediaPlaying.CurrentState == MediaElementState.Buffering)
     {
         _mediaPlaying.Pause();
     }
 }
Ejemplo n.º 4
0
        private void InitPlayer()
        {
            if (player != null)
            {
                player.Pause();
            }

            player.Source = new Uri(Player.Url);
        }
 private async void PauseMedia()
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         if (mediaPlayer != null)
         {
             mediaPlayer.Pause();
         }
     });
 }
Ejemplo n.º 6
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            var totalSeconds = Element.Position.TotalSeconds;

            if ((_pauseEventTime > 0) && (totalSeconds >= _pauseEventTime))
            {
                Element.Pause();
                _pauseEventTime = 0;
            }
            Debug.WriteLine(totalSeconds);
        }
Ejemplo n.º 7
0
 public override void Pause()
 {
     if (!IsMediaLoaded)
     {
         return;
     }
     if (IsPlaying)
     {
         _mediaElement.Pause();
         _isPlaying = false;
     }
 }
Ejemplo n.º 8
0
        private void Pause_Click(object sender, RoutedEventArgs e)
        {
            Button       Button       = (Button)sender;
            MediaElement MediaElement = (MediaElement)Button.Tag;

            MediaElement.Pause();
        }
Ejemplo n.º 9
0
 private void MediaElement_MediaEnded(object sender, System.Windows.RoutedEventArgs e)
 {
     _isEnded   = true;
     _isPlaying = false;
     MediaElement.Pause();
     PlayStateChanged?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Pause
 /// </summary>
 /// <param name="obj"></param>
 public void PauseHandler(object obj)
 {
     if (MediaElement.CurrentState == MediaElementState.Playing)
     {
         MediaElement.Pause();
     }
 }
 public void OnVisibilityChanged(bool isVisible)
 {
     if (_videoPlayer != null && !isVisible)
     {
         _videoPlayer.Pause();
     }
 }
Ejemplo n.º 12
0
 public void Pause()
 {
     _music.Pause();
     _track.State = MediaPropertiesLibrary.MediaState.Paused;
     _tick.Stop();
     Dispatch("Media Paused");
 }
Ejemplo n.º 13
0
 private void BtnPause_OnClick(object sender, RoutedEventArgs e)
 {
     if (MediaElement.Source != null)
     {
         MediaElement.Pause();
     }
 }
Ejemplo n.º 14
0
 public void Pause()
 {
     if (player.Source != null)
     {
         player.Pause();
     }
 }
            public MasterView(Orchestrator orchestrator, string viewName, string directory)
                : base(orchestrator, viewName, GetVideos(directory))
            {
                Player = new MediaElement {
                    ScrubbingEnabled = true,
                    LoadedBehavior   = MediaState.Manual,
                    UnloadedBehavior = MediaState.Manual,
                    Volume           = 1
                };
                SetPlayerContent(Player);

                Loaded += delegate {
                    // Force the player to render a frame.
                    Player.Play();
                    Player.Pause();
                };
                Unloaded += delegate {
                    IsPlaying = false;
                };

                Player.MediaOpened += delegate {
                    DisplayDuration(Player);
                };
                Player.MediaEnded += delegate {
                    SetState(videoIndex: videoIndex + 1, position: TimeSpan.Zero, isPlaying: false);
                };

                Player.MediaFailed += (s, e) => MessageBox.Show(e.ErrorException.Message, "Video - NetPresenter", MessageBoxButton.OK, MessageBoxImage.Error);
            }
Ejemplo n.º 16
0
 public void Pause()
 {
     _video.Pause();
     _track.State = MediaPropertiesLibrary.MediaState.Paused;
     _senderTick.Stop();
     Dispatch("Media Paused");
 }
Ejemplo n.º 17
0
        // When the media element is tabbed
        private void mediaContentElement_Tabbed(object sender, TappedRoutedEventArgs e)
        {
            MediaElement me = (MediaElement)sender;

            TextBlock playButton = getSibling <TextBlock>(me, "playButtonTextBlock");


            // Change the state of the media element
            switch (me.CurrentState)
            {
            case MediaElementState.Playing:
            {
                me.Pause();
                if (playButton != null)
                {
                    playButton.Visibility = Visibility.Visible;
                }
                break;
            }

            case MediaElementState.Paused:
            {
                me.Play();
                if (playButton != null)
                {
                    playButton.Visibility = Visibility.Collapsed;
                }
                break;
            }
            }
        }
Ejemplo n.º 18
0
 public static void pause()
 {
     if (me != null && me.CanPause)
     {
         me.Pause();
     }
 }
 public void PauseAudio()
 {
     if (MyMusic.CanPause)
     {
         MyMusic.Pause();
     }
 }
Ejemplo n.º 20
0
 private void MediaElement_MediaOpened(object sender, RoutedEventArgs e)
 {
     Console.WriteLine(MediaElement.Name + " Load Complete");
     MediaElement.Pause();
     IsLoaded = true;
     Console.WriteLine(IsLoaded);
 }
Ejemplo n.º 21
0
        private async void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            await Task.Delay(500);

            if (e.NewSize.Width <= 800)
            {
                SecondFrame.Visibility = Visibility.Collapsed;
                Grid.SetColumnSpan(MyFrame, 2);
                SecondFrame  sf     = SecondFrame.Content as SecondFrame;
                Grid         gr4    = sf.Content as Grid;
                Grid         gr5    = gr4.Children[1] as Grid;
                MediaElement player = gr5.Children[0] as MediaElement;
                player.Pause();
            }
            else if (e.NewSize.Width > 800)
            {
                SecondFrame.Visibility = Visibility.Visible;
                Grid.SetColumnSpan(MyFrame, 1);
                //SecondFrame sf = SecondFrame.Content as SecondFrame;
                //Grid gr4 = sf.Content as Grid;
                //Grid gr5 = gr4.Children[1] as Grid;
                //MediaElement player = gr5.Children[0] as MediaElement;
                //if (player.Source!=null)
                //{
                //    player.Play();
                //}
            }
        }
Ejemplo n.º 22
0
 private void buttonPause_Click(object sender, RoutedEventArgs e)
 {
     if (selectedSongFile != null)
     {
         player.Pause();
     }
 }
Ejemplo n.º 23
0
 public void Pause()
 {
     MoSync.Util.RunActionOnMainThreadSync(() =>
     {
         mMediaElement.Pause();
     });
 }
Ejemplo n.º 24
0
        public void MediaPlayer_PlayStateChange()
        {
            var ps1 = GetMediaState();

            if (ps1 == MediaState.Play && _set_on_pause)
            {
                _set_on_pause = false;
                MediaElement.Pause();
            }

            if (ps1 == MediaState.Play && mode != PlayerMode.Play)
            {
                mode = PlayerMode.Play;
                if (MediaModeChanged != null)
                {
                    MediaModeChanged(this, EventArgs.Empty);
                }
            }

            if (ps1 == MediaState.Pause && mode != PlayerMode.Pause)
            {
                mode = PlayerMode.Pause;
                if (MediaModeChanged != null)
                {
                    MediaModeChanged(this, EventArgs.Empty);
                }
            }

            if (PlayStateChange != null)
            {
                PlayStateChange(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 25
0
 public virtual void pause()
 {
     SilverlightImplementation.dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         elem.Pause();
     }).AsTask().ConfigureAwait(false).GetAwaiter().GetResult();
 }
 private void Pause_Click(object sender, RoutedEventArgs e)
 {
     if (MediaElement.CanPause)
     {
         MediaElement.Pause();
     }
 }
Ejemplo n.º 27
0
 public void Pause()
 {
     Paused     = true;
     IsPlaying  = false;
     PlayStatus = PlayStatus.Paused;
     player.Pause();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Instructs the <see cref="Windows.UI.Xaml.Controls.MediaElement" /> to pause playback.
 /// </summary>
 public void Pause()
 {
     if (_mediaElement.CanPause)
     {
         _mediaElement.Pause();
     }
 }
Ejemplo n.º 29
0
 public void PauseReadContent()
 {
     if (MediaElementItem.CurrentState == MediaElementState.Playing && MediaElementItem.CanPause)
     {
         MediaElementItem.Pause();
     }
 }
Ejemplo n.º 30
0
 private void videoScreenMediaElement_MouseDown2(object sender, MouseButtonEventArgs e)
 {
     videoScreenMediaElement.Position = myPlayer.Position;
     myPlayer.Pause();
     videoScreenMediaElement.Play();
     myPlayer.Visibility = Visibility.Hidden;
     videoScreenMediaElement.Visibility = Visibility.Visible;
 }