private void SmoothPlayer_CurrentStateChanged(object sender, RoutedEventArgs e)
        {
            switch (this.SmoothPlayer.CurrentState)
            {
            case SmoothStreamingMediaElementState.Buffering:
            {
                this.ologData = new CustomLogData()
                {
                    Message  = "Buffering .",
                    Severity = SeverityEnum.Information,
                    Source   = "Player"
                };
                this.eventLogViewer.PrintLog(this.ologData);
                break;
            }

            case SmoothStreamingMediaElementState.Paused:
            {
                break;
            }

            case SmoothStreamingMediaElementState.Stopped:
            {
                break;
            }
            }
        }
 private void FastForwardElement_Click(object sender, RoutedEventArgs e)
 {
     if ((this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Paused) || this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Stopped) ? false : !this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Closed)))
     {
         IList <double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;
         int            num = supportedPlaybackRates.IndexOf(this.SmoothPlayer.PlaybackRate.Value);
         if (num < 4)
         {
             this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[4]);
             this.ologData = new CustomLogData()
             {
                 Message  = "Fastforward enabled.",
                 Severity = SeverityEnum.Information,
                 Source   = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
         else if (num == 4)
         {
             this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[5]);
             this.ologData = new CustomLogData()
             {
                 Message  = "Fastforward enabled.",
                 Severity = SeverityEnum.Information,
                 Source   = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
     }
 }
 private void SlowMotionElement_Click(object sender, RoutedEventArgs e)
 {
     if (!(!this.SupportsSlowMotion ? true : this.IsSlowMotion))
     {
         this.SmoothPlayer.SetPlaybackRate(this.SlowMotionPlaybackRates.First <double>());
         this.IsSlowMotion = true;
         this.ologData     = new CustomLogData()
         {
             Message  = "Slowmotion enabled.",
             Severity = SeverityEnum.Information,
             Source   = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
     else if (this.IsSlowMotion)
     {
         IList <double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;
         this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[3]);
         this.IsSlowMotion = false;
         this.ologData     = new CustomLogData()
         {
             Message  = "Normal speed enabled.",
             Severity = SeverityEnum.Information,
             Source   = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
 }
 private void FullScreenToggleElement_Click(object sender, RoutedEventArgs e)
 {
     if (this.IsinFullScreen)
     {
         Application.Current.Host.Content.IsFullScreen = false;
         this.IsinFullScreen = false;
         this.ControllerContainer.Visibility = Visibility.Visible;
         this.ologData = new CustomLogData()
         {
             Message  = "Player changed to normal screen.",
             Severity = SeverityEnum.Information,
             Source   = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
     else
     {
         Application.Current.Host.Content.IsFullScreen = true;
         this.IsinFullScreen = true;
         this.ControllerContainer.Visibility = Visibility.Collapsed;
         this.ologData = new CustomLogData()
         {
             Message  = "Player changed to fullscreen.",
             Severity = SeverityEnum.Information,
             Source   = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
 }
Beispiel #5
0
        public void PrintLog(CustomLogData logData)
        {
            UIElementCollection children;
            string text;

            if (this._eventLogCanvas != null & logData != null)
            {
                this.sb = new StringBuilder();
            }
            if (logData != null)
            {
                this.sb.Append(Environment.NewLine);
                this.sb.Append(string.Concat("Message: ", logData.Message, ". "));
                this.sb.Append(string.Concat("Severity: ", logData.Severity.ToString(), ". "));
                this.sb.Append(string.Concat("Source: ", logData.Source, ". "));
                if (this._eventLogCanvas != null)
                {
                    children = this._eventLogCanvas.Children;
                    text     = (children.First <UIElement>() as TextBlock).Text;
                    (children.First <UIElement>() as TextBlock).Text = string.Concat((children.First <UIElement>() as TextBlock).Text, this.sb.ToString());
                }
            }
            else if (this._eventLogCanvas != null)
            {
                children = this._eventLogCanvas.Children;
                text     = (children.First <UIElement>() as TextBlock).Text;
                (children.First <UIElement>() as TextBlock).Text = string.Concat((children.First <UIElement>() as TextBlock).Text, this.sb.ToString());
            }
        }
 private void SmoothPlayer_MediaFailed(object sender, ExceptionRoutedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message  = "Media failed.",
         Severity = SeverityEnum.Critical,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_Loaded(object sender, RoutedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message  = "Player loaded.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_VideoHighestPlayableTrackChanged(object sender, TrackChangedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message  = "Video Highest PlayableTrackChanged.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     this.UpdateBufferBar();
     this.ologData = new CustomLogData()
     {
         Message  = "Player size changed.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_ManifestReady(object sender, EventArgs e)
 {
     this.slider.Maximum = this.SmoothPlayer.EndPosition.TotalMilliseconds;
     this.ologData       = new CustomLogData()
     {
         Message  = "Manifest Ready.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_PlaybackTrackChanged(object sender, TrackChangedEventArgs e)
 {
     this.bitRateGraph.CurrentBitrate       = e.NewTrack.Bitrate;
     this.framerateControl.CurrentFramerate = this.SmoothPlayer.RenderedFramesPerSecond;
     this.ologData = new CustomLogData()
     {
         Message  = string.Concat("Playback bitrate changed to ", this.bitRateGraph.CurrentBitrate),
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_MediaEnded(object sender, RoutedEventArgs e)
 {
     this.playButton.Visibility  = Visibility.Visible;
     this.pauseButton.Visibility = Visibility.Collapsed;
     this.ologData = new CustomLogData()
     {
         Message  = "Media ended.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.SmoothPlayer.SmoothStreamingSource = new Uri(PassedInURL);
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void pauseButton_Click(object sender, RoutedEventArgs e)
 {
     this.playButton.Visibility  = Visibility.Visible;
     this.pauseButton.Visibility = Visibility.Collapsed;
     this.SmoothPlayer.Pause();
     this.ologData = new CustomLogData()
     {
         Message  = "Puased.",
         Severity = SeverityEnum.Information,
         Source   = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
        private void ReplayElement_Click(object sender, RoutedEventArgs e)
        {
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 0);

            this.SmoothPlayer.Position = timeSpan;
            this.SmoothPlayer.SetPlaybackRate(1);
            this.SmoothPlayer.Play();
            this.ologData = new CustomLogData()
            {
                Message  = "Replay enabled.",
                Severity = SeverityEnum.Information,
                Source   = "Player"
            };
            this.eventLogViewer.PrintLog(this.ologData);
        }
        private void Seek()
        {
            double   value        = this.slider.Value / (this.slider.Maximum - this.slider.Minimum) * 100;
            TimeSpan timeSpan     = this.SmoothPlayer.NaturalDuration.TimeSpan;
            int      totalSeconds = (int)(timeSpan.TotalSeconds * value / 100);
            TimeSpan timeSpan1    = new TimeSpan(0, 0, totalSeconds);

            this.SmoothPlayer.Position = timeSpan1;
            this.ologData = new CustomLogData()
            {
                Message  = "Seek to new position.",
                Severity = SeverityEnum.Information,
                Source   = "Player"
            };
            this.eventLogViewer.PrintLog(this.ologData);
        }
 private void RewindElement_Click(object sender, RoutedEventArgs e)
 {
     if (!this.IsRewinding)
     {
         if (this.SupportsNaturalRewind)
         {
             this.SmoothPlayer.SetPlaybackRate(this.RewindPlaybackRates.First <double>());
             this.ologData = new CustomLogData()
             {
                 Message  = "Rewinding enabled.",
                 Severity = SeverityEnum.Information,
                 Source   = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
     }
 }
 private void SmoothPlayer_VideoHighestPlayableTrackChanged(object sender, TrackChangedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message = "Video Highest PlayableTrackChanged.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     this.UpdateBufferBar();
     this.ologData = new CustomLogData()
     {
         Message = "Player size changed.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_PlaybackTrackChanged(object sender, TrackChangedEventArgs e)
 {
     this.bitRateGraph.CurrentBitrate = e.NewTrack.Bitrate;
     this.framerateControl.CurrentFramerate = this.SmoothPlayer.RenderedFramesPerSecond;
     this.ologData = new CustomLogData()
     {
         Message = string.Concat("Playback bitrate changed to ", this.bitRateGraph.CurrentBitrate),
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_MediaFailed(object sender, ExceptionRoutedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message = "Media failed.",
         Severity = SeverityEnum.Critical,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_MediaEnded(object sender, RoutedEventArgs e)
 {
     this.playButton.Visibility = Visibility.Visible;
     this.pauseButton.Visibility = Visibility.Collapsed;
     this.ologData = new CustomLogData()
     {
         Message = "Media ended.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.SmoothPlayer.SmoothStreamingSource = new Uri(PassedInURL);
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_ManifestReady(object sender, EventArgs e)
 {
     this.slider.Maximum = this.SmoothPlayer.EndPosition.TotalMilliseconds;
     this.ologData = new CustomLogData()
     {
         Message = "Manifest Ready.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_Loaded(object sender, RoutedEventArgs e)
 {
     this.ologData = new CustomLogData()
     {
         Message = "Player loaded.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void SmoothPlayer_CurrentStateChanged(object sender, RoutedEventArgs e)
 {
     switch (this.SmoothPlayer.CurrentState)
     {
         case SmoothStreamingMediaElementState.Buffering:
             {
                 this.ologData = new CustomLogData()
                 {
                     Message = "Buffering .",
                     Severity = SeverityEnum.Information,
                     Source = "Player"
                 };
                 this.eventLogViewer.PrintLog(this.ologData);
                 break;
             }
         case SmoothStreamingMediaElementState.Paused:
             {
                 break;
             }
         case SmoothStreamingMediaElementState.Stopped:
             {
                 break;
             }
     }
 }
 private void SlowMotionElement_Click(object sender, RoutedEventArgs e)
 {
     if (!(!this.SupportsSlowMotion ? true : this.IsSlowMotion))
     {
         this.SmoothPlayer.SetPlaybackRate(this.SlowMotionPlaybackRates.First<double>());
         this.IsSlowMotion = true;
         this.ologData = new CustomLogData()
         {
             Message = "Slowmotion enabled.",
             Severity = SeverityEnum.Information,
             Source = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
     else if (this.IsSlowMotion)
     {
         IList<double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;
         this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[3]);
         this.IsSlowMotion = false;
         this.ologData = new CustomLogData()
         {
             Message = "Normal speed enabled.",
             Severity = SeverityEnum.Information,
             Source = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
 }
 private void Seek()
 {
     double value = this.slider.Value / (this.slider.Maximum - this.slider.Minimum) * 100;
     TimeSpan timeSpan = this.SmoothPlayer.NaturalDuration.TimeSpan;
     int totalSeconds = (int)(timeSpan.TotalSeconds * value / 100);
     TimeSpan timeSpan1 = new TimeSpan(0, 0, totalSeconds);
     this.SmoothPlayer.Position = timeSpan1;
     this.ologData = new CustomLogData()
     {
         Message = "Seek to new position.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void RewindElement_Click(object sender, RoutedEventArgs e)
 {
     if (!this.IsRewinding)
     {
         if (this.SupportsNaturalRewind)
         {
             this.SmoothPlayer.SetPlaybackRate(this.RewindPlaybackRates.First<double>());
             this.ologData = new CustomLogData()
             {
                 Message = "Rewinding enabled.",
                 Severity = SeverityEnum.Information,
                 Source = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
     }
 }
 private void ReplayElement_Click(object sender, RoutedEventArgs e)
 {
     TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 0);
     this.SmoothPlayer.Position = timeSpan;
     this.SmoothPlayer.SetPlaybackRate(1);
     this.SmoothPlayer.Play();
     this.ologData = new CustomLogData()
     {
         Message = "Replay enabled.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void pauseButton_Click(object sender, RoutedEventArgs e)
 {
     this.playButton.Visibility = Visibility.Visible;
     this.pauseButton.Visibility = Visibility.Collapsed;
     this.SmoothPlayer.Pause();
     this.ologData = new CustomLogData()
     {
         Message = "Puased.",
         Severity = SeverityEnum.Information,
         Source = "Player"
     };
     this.eventLogViewer.PrintLog(this.ologData);
 }
 private void FullScreenToggleElement_Click(object sender, RoutedEventArgs e)
 {
     if (this.IsinFullScreen)
     {
         Application.Current.Host.Content.IsFullScreen = false;
         this.IsinFullScreen = false;
         this.ControllerContainer.Visibility = Visibility.Visible;
         this.ologData = new CustomLogData()
         {
             Message = "Player changed to normal screen.",
             Severity = SeverityEnum.Information,
             Source = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
     else
     {
         Application.Current.Host.Content.IsFullScreen = true;
         this.IsinFullScreen = true;
         this.ControllerContainer.Visibility = Visibility.Collapsed;
         this.ologData = new CustomLogData()
         {
             Message = "Player changed to fullscreen.",
             Severity = SeverityEnum.Information,
             Source = "Player"
         };
         this.eventLogViewer.PrintLog(this.ologData);
     }
 }
 private void FastForwardElement_Click(object sender, RoutedEventArgs e)
 {
     if ((this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Paused) || this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Stopped) ? false : !this.SmoothPlayer.CurrentState.Equals(SmoothStreamingMediaElementState.Closed)))
     {
         IList<double> supportedPlaybackRates = this.SmoothPlayer.SupportedPlaybackRates;
         int num = supportedPlaybackRates.IndexOf(this.SmoothPlayer.PlaybackRate.Value);
         if (num < 4)
         {
             this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[4]);
             this.ologData = new CustomLogData()
             {
                 Message = "Fastforward enabled.",
                 Severity = SeverityEnum.Information,
                 Source = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
         else if (num == 4)
         {
             this.SmoothPlayer.SetPlaybackRate(supportedPlaybackRates[5]);
             this.ologData = new CustomLogData()
             {
                 Message = "Fastforward enabled.",
                 Severity = SeverityEnum.Information,
                 Source = "Player"
             };
             this.eventLogViewer.PrintLog(this.ologData);
         }
     }
 }