Esempio n. 1
0
        void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            OutPut.Text = "";

            if (manifestChanged)
            {
                SmoothPlayer.SmoothStreamingSource = new Uri(ManifestURL.Text);
                return;
            }

            if ((String)PlayButton.Content == "Play")
            {
                SmoothPlayer.Play();

                PlayButton.Content          = "Stop";
                fullScreenButton.Visibility = System.Windows.Visibility.Visible;
                BWCombo.IsEnabled           = false;
            }
            else if ((String)PlayButton.Content == "Stop")
            {
                SmoothPlayer.Stop();
                SmoothPlayer.SmoothStreamingSource = null;
                manifestChanged             = true;
                PlayButton.Content          = "Play";
                fullScreenButton.Visibility = System.Windows.Visibility.Collapsed;
                BitRate.Text      = "0";
                BWCombo.IsEnabled = true;
            }
        }
        void PauseButton_Click(object sender, RoutedEventArgs e)
        {
            if (PauseButton.Content.ToString() == "Pause")
            {
                SmoothPlayer.Pause();
                seekbarTimer.Stop();

                PauseButton.Content = "Play";
            }
            else
            {
                SmoothPlayer.Play();
                seekbarTimer.Start();

                PauseButton.Content = "Pause";
            }
        }
        void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            OutPut.Text = "";

            if (manifestChanged)
            {
                String url = ManifestURL.Text;
                SmoothPlayer.SmoothStreamingSource = new Uri(url, UriKind.Absolute);
                PlayButton.IsEnabled  = false;
                SeekBar.IsEnabled     = false;
                PauseButton.IsEnabled = false;
                RewButton.IsEnabled   = false;
                return;
            }

            if ((String)PlayButton.Content == "Connect")
            {
                SmoothPlayer.Play();
                BWCombo.IsEnabled           = false;
                VolumeBar.IsEnabled         = true;
                fullScreenButton.Visibility = System.Windows.Visibility.Visible;
                PlayButton.Content          = "Disconnect";
                PauseButton.IsEnabled       = true;
                SeekBar.IsEnabled           = true;
                RewButton.IsEnabled         = true;
                fullScreenButton.Visibility = System.Windows.Visibility.Visible;
            }
            else if ((String)PlayButton.Content == "Disconnect")
            {
                SmoothPlayer.Stop();
                seekbarTimer.Stop();
                SeekBar.Value               = 0;
                SeekBar.IsEnabled           = false;
                VolumeBar.IsEnabled         = false;
                fullScreenButton.Visibility = System.Windows.Visibility.Collapsed;
                PlayButton.Content          = "Connect";
                PauseButton.Content         = "Pause";
                PauseButton.IsEnabled       = false;
                RewButton.IsEnabled         = false;
                BWCombo.IsEnabled           = true;
                BitRate.Text = "0";
                fullScreenButton.Visibility        = System.Windows.Visibility.Collapsed;
                SmoothPlayer.SmoothStreamingSource = null;
                manifestChanged = true;
            }
        }
        private void StopButton_Click(object sender, RoutedEventArgs e)
        {
            //This should simply stop the playback
            SmoothPlayer.Stop();
            //We should also reflect the chang on the play button
            PlayButton.Content = "Play";

            if (File.Exists(cache.SettingsFilePath))
            {
                File.Delete(cache.SettingsFilePath);
            }
            string json = JsonConvert.SerializeObject(cache.KeyUrls, new KeyValuePairConverter());

            using (StreamWriter outfile = new StreamWriter(cache.SettingsFilePath))
            {
                outfile.Write(json);
            }
        }
        private void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            //Monitor the state of the content to determine the right action to take on this button being clicked
            //and then change the text to reflect the next action
            switch (SmoothPlayer.CurrentState)
            {
            case SmoothStreamingMediaElementState.Playing:
                SmoothPlayer.Pause();
                PlayButton.Content = "Play";
                break;

            case SmoothStreamingMediaElementState.Stopped:
            case SmoothStreamingMediaElementState.Paused:
                SmoothPlayer.Play();
                PlayButton.Content = "Pause";
                //       CacheSize.Text = "Cache size: " + tempSize.ToString();
                break;
            }
        }
Esempio n. 6
0
        private void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            switch (SmoothPlayer.CurrentState)
            {
            case SmoothStreamingMediaElementState.Playing:
                SmoothPlayer.Pause();
                PlayButton.Content = "Play";
                break;

            case SmoothStreamingMediaElementState.Paused:
                SmoothPlayer.Play();
                PlayButton.Content = "Pause";
                break;

            case SmoothStreamingMediaElementState.Stopped:
                SmoothPlayer.Play();
                PlayButton.Content = "Pause";
                break;
            }
        }
Esempio n. 7
0
 // This method resets the button.  For more information,
 // see the following topic: Events.
 private void StopButton_Click(object sender, RoutedEventArgs e)
 {
     SmoothPlayer.Stop();
     PlayButton.Content = "Play";
 }