Exemple #1
0
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            MediaState state = _player.MediaState;

            Pause();

            double position = _player.Position.TotalSeconds;
            double volume   = _player.Volume;

            _player.Close();
            _sourcePlayer   = null;
            this.Visibility = Visibility.Collapsed;

            CloseAction(position, state, volume);
        }
Exemple #2
0
        public void CopyState(VideoPlayerControl player, double volume, bool copySource)
        {
            if (copySource)
            {
                VideoPlayerElement.Source = player.VideoPlayerElement.Source;
            }

            Volume             = volume;
            MediaState         = player.MediaState;
            Title              = player.Title;
            FileName           = player.FileName;
            IsFlipHorizontally = player.IsFlipHorizontally;
            Zoom           = player.Zoom;
            VerticalOffset = player.VerticalOffset;
            Position       = player.Position;
        }
Exemple #3
0
        public void ShowWithControl(VideoPlayerControl player, double volume)
        {
            if (_sourcePlayer != null)
            {
                throw new Exception("Invalid call");
            }

            _sourcePlayer = player;

            _player.CopyState(player, volume, true);
            _player.RestoreMediaState(player.MediaState, player.Position);

            this.Visibility = Visibility.Visible;
            _player.FitWidth(false);

            thumbnails.StartCreateThumbnailsFromVideoFile(player);

            _player.btnMaximize.IsEnabled = false;
        }
        public void StartCreateThumbnailsFromVideoFile(VideoPlayerControl playerSrc)
        {
            if (string.IsNullOrWhiteSpace(playerSrc.FileName))
            {
                return;
            }

            try
            {
                _selectedPosition = playerSrc.Position.TotalSeconds;

                Images.Clear();
                player.Source = new System.Uri(playerSrc.FileName);
                player.Play();
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }