Beispiel #1
0
        private void OnVlcStopped(object sender, Vlc.DotNet.Core.VlcMediaPlayerStoppedEventArgs e)
        {
            #if !NET20
            myLblState.InvokeIfRequired(l => l.Text = "Stopped");

            myCbxAspectRatio.InvokeIfRequired(c =>
            {
                c.Text    = string.Empty;
                c.Enabled = false;
            });
            #else
            ControlExtensions.InvokeIfRequired(myLblState, c => c.Text = "Stopped");

            ControlExtensions.InvokeIfRequired(myCbxAspectRatio, c =>
            {
                c.Text    = string.Empty;
                c.Enabled = false;
            });
            #endif
            ControlExtensions.InvokeIfRequired(myLblAudioCodec, c => c.Text    = "Codec: ");
            ControlExtensions.InvokeIfRequired(myLblAudioChannels, c => c.Text = "Channels: ");
            ControlExtensions.InvokeIfRequired(myLblAudioRate, c => c.Text     = "Rate: ");
            ControlExtensions.InvokeIfRequired(myLblVideoCodec, c => c.Text    = "Codec: ");
            ControlExtensions.InvokeIfRequired(myLblVideoHeight, c => c.Text   = "Height: ");
            ControlExtensions.InvokeIfRequired(myLblVideoWidth, c => c.Text    = "Width: ");
        }
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (playControlViewModel.IsPlay)
            {
                ControlExtensions.InvokeIfRequired(this, (x) =>
                {
                    elapsedTimeTextBlock.Text = x.ToString();
                    time = playControlViewModel.mediaPlayer.Position.ToString(@"mm\:ss");
                }, time);

                ControlExtensions.InvokeIfRequired(this, (x) =>
                {
                    durationSlider.Value = x;
                    sliderNewValue       = playControlViewModel.CalculateSliderValue();
                }, sliderNewValue);
            }

            if (playControlViewModel.IsStop)
            {
                ControlExtensions.InvokeIfRequired(this, (x) =>
                {
                    elapsedTimeTextBlock.Text        = x.ToString();
                    playControlViewModel.DurationMP3 = "00:00";
                }, "00:00");
            }
        }
Beispiel #3
0
 private void OnVlcPaused(object sender, Vlc.DotNet.Core.VlcMediaPlayerPausedEventArgs e)
 {
     #if !NET20
     myLblState.InvokeIfRequired(l => l.Text = "Paused");
     #else
     ControlExtensions.InvokeIfRequired(myLblState, c => c.Text = "Paused");
     #endif
 }
Beispiel #4
0
 private void OnVlcMediaLengthChanged(object sender, Vlc.DotNet.Core.VlcMediaPlayerLengthChangedEventArgs e)
 {
     #if !NET20
     myLblMediaLength.InvokeIfRequired(l => l.Text = new DateTime(new TimeSpan((long)e.NewLength).Ticks).ToString("mm:ss"));
     #else
     ControlExtensions.InvokeIfRequired(myLblMediaLength, l => l.Text = new DateTime(new TimeSpan((long)e.NewLength).Ticks).ToString("T"));
     #endif
 }
Beispiel #5
0
        private void OnVlcPlaying(object sender, Core.VlcMediaPlayerPlayingEventArgs e)
        {
#if !NET20
            myLblState.InvokeIfRequired(l => l.Text = "Playing");

            myLblAudioCodec.InvokeIfRequired(l => l.Text    = "Codec: ");
            myLblAudioChannels.InvokeIfRequired(l => l.Text = "Channels: ");
            myLblAudioRate.InvokeIfRequired(l => l.Text     = "Rate: ");
            myLblVideoCodec.InvokeIfRequired(l => l.Text    = "Codec: ");
            myLblVideoHeight.InvokeIfRequired(l => l.Text   = "Height: ");
            myLblVideoWidth.InvokeIfRequired(l => l.Text    = "Width: ");

            var mediaInformations = myVlcControl.GetCurrentMedia().TracksInformations;
            foreach (var mediaInformation in mediaInformations)
            {
                if (mediaInformation.Type == Core.Interops.Signatures.MediaTrackTypes.Audio)
                {
                    myLblAudioCodec.InvokeIfRequired(l => l.Text    += mediaInformation.CodecName);
                    myLblAudioChannels.InvokeIfRequired(l => l.Text += mediaInformation.Audio.Channels);
                    myLblAudioRate.InvokeIfRequired(l => l.Text     += mediaInformation.Audio.Rate);
                }
                else if (mediaInformation.Type == Core.Interops.Signatures.MediaTrackTypes.Video)
                {
                    myLblVideoCodec.InvokeIfRequired(l => l.Text  += mediaInformation.CodecName);
                    myLblVideoHeight.InvokeIfRequired(l => l.Text += mediaInformation.Video.Height);
                    myLblVideoWidth.InvokeIfRequired(l => l.Text  += mediaInformation.Video.Width);
                }
            }
#else
            ControlExtensions.InvokeIfRequired(myLblState, c => c.Text = "Playing");

            ControlExtensions.InvokeIfRequired(myLblAudioCodec, c => c.Text    = "Codec: ");
            ControlExtensions.InvokeIfRequired(myLblAudioChannels, c => c.Text = "Channels: ");
            ControlExtensions.InvokeIfRequired(myLblAudioRate, c => c.Text     = "Rate: ");
            ControlExtensions.InvokeIfRequired(myLblVideoCodec, c => c.Text    = "Codec: ");
            ControlExtensions.InvokeIfRequired(myLblVideoHeight, c => c.Text   = "Height: ");
            ControlExtensions.InvokeIfRequired(myLblVideoWidth, c => c.Text    = "Width: ");

            var mediaInformations = myVlcControl.GetCurrentMedia().TracksInformations;
            foreach (var mediaInformation in mediaInformations)
            {
                if (mediaInformation.Type == Core.Interops.Signatures.MediaTrackTypes.Audio)
                {
                    ControlExtensions.InvokeIfRequired(myLblAudioCodec, c => c.Text    += mediaInformation.CodecName);
                    ControlExtensions.InvokeIfRequired(myLblAudioChannels, c => c.Text += mediaInformation.Audio.Channels);
                    ControlExtensions.InvokeIfRequired(myLblAudioRate, c => c.Text     += mediaInformation.Audio.Rate);
                }
                else if (mediaInformation.Type == Core.Interops.Signatures.MediaTrackTypes.Video)
                {
                    ControlExtensions.InvokeIfRequired(myLblVideoCodec, c => c.Text  += mediaInformation.CodecName);
                    ControlExtensions.InvokeIfRequired(myLblVideoHeight, c => c.Text += mediaInformation.Video.Height);
                    ControlExtensions.InvokeIfRequired(myLblVideoWidth, c => c.Text  += mediaInformation.Video.Width);
                }
            }
#endif
        }
Beispiel #6
0
        private void OnVlcPositionChanged(object sender, Vlc.DotNet.Core.VlcMediaPlayerPositionChangedEventArgs e)
        {
            var position = myVlcControl.GetCurrentMedia().Duration.Ticks *e.NewPosition;

            #if !NET20
            myLblVlcPosition.InvokeIfRequired(l => l.Text = new DateTime((long)position).ToString("mm:ss"));
            #else
            ControlExtensions.InvokeIfRequired(myLblVlcPosition, c => c.Text = new DateTime((long)position).ToString("T"));
            #endif
        }
 private void timeSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (playControlViewModel.GetSongSecondsCount() > 0)
     {
         Slider slider = sender as Slider;
         playControlViewModel.SetMediaPlayerSongPosition();
         ControlExtensions.InvokeIfRequired(this, (x) =>
         {
             durationSlider.Value = x;
             sliderNewValue       = playControlViewModel.CalculateSliderValue();
         }, sliderNewValue);
         playControlViewModel.PlayOrPauseSong();
     }
 }
Beispiel #8
0
        private void OnVlcStopped(object sender, Core.VlcMediaPlayerStoppedEventArgs e)
        {
#if !NET20
            myLblState.InvokeIfRequired(l => l.Text = "Stopped");
#else
            ControlExtensions.InvokeIfRequired(myLblState, c => c.Text = "Stopped");
#endif
            myLblAudioCodec.Text    = "Codec: ";
            myLblAudioChannels.Text = "Channels: ";
            myLblAudioRate.Text     = "Rate: ";
            myLblVideoCodec.Text    = "Codec: ";
            myLblVideoHeight.Text   = "Height: ";
            myLblVideoWidth.Text    = "Width: ";
        }
        void mediaPlayer_MediaEnded(object sender, EventArgs e)
        {
            if (sender.GetType().ToString() == "System.Windows.Media.MediaPlayer")
            {
                timer.Stop();

                ControlExtensions.InvokeIfRequired(this, (x) =>
                {
                    elapsedTimeTextBlock.Text = x.ToString();
                }, "00:00");

                ControlExtensions.InvokeIfRequired(this, (x) =>
                {
                    durationSlider.Value = x;
                }, 0);
            }

            playControlViewModel.PlayNextSongAfterPrevious();
            timer.Start();
        }