Exemplo n.º 1
0
        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;
            }
            }
        }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 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());
            }
        }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 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);
 }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 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);
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
 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);
         }
     }
 }
Exemplo n.º 17
0
 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);
 }
Exemplo n.º 18
0
 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);
 }
Exemplo n.º 19
0
 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);
 }
Exemplo n.º 20
0
 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);
 }
Exemplo n.º 21
0
 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);
 }
Exemplo n.º 22
0
 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);
 }
Exemplo n.º 23
0
 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);
 }
Exemplo n.º 24
0
 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;
             }
     }
 }
Exemplo n.º 25
0
 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);
     }
 }
Exemplo n.º 26
0
 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);
 }
Exemplo n.º 27
0
 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);
         }
     }
 }
Exemplo n.º 28
0
 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);
 }
Exemplo n.º 29
0
 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);
 }
Exemplo n.º 30
0
 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);
     }
 }
Exemplo n.º 31
0
 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);
         }
     }
 }