Exemplo n.º 1
0
        private void LoadPreviousClip()
        {
            NovatekFile previousClip = SelectedTrip.Clips.Where(x => x.FileName == SelectedTrip.CurrentClip.PreviousFile).SingleOrDefault();

            // Check the player has a clip loaded
            if (SparePlayer.HasVideo && _spClip == previousClip && SparePlayer.NaturalDuration.HasTimeSpan)
            {
                // Match the SpeedRatio and Volume
                SparePlayer.SpeedRatio = CurrentPlayer.SpeedRatio;
                SparePlayer.Volume     = CurrentPlayer.Volume;
                // Show the spare player
                SparePlayer.Visibility   = Visibility.Visible;
                CurrentPlayer.Visibility = Visibility.Hidden;
                SparePlayer.Play();
                CurrentPlayer.Pause();
                // Set the maximum of the position bar
                UI.FindChild <Slider>(Application.Current.MainWindow, "posSlider").Maximum = SparePlayer.NaturalDuration.TimeSpan.TotalSeconds;
                // Switch the current player with spare
                var spare   = SparePlayer;
                var current = CurrentPlayer;
                CurrentPlayer = spare;
                SparePlayer   = current;
                // Update the curernt clip
                SelectedTrip.CurrentClip = previousClip;
            }
            else if (!string.IsNullOrEmpty(SelectedTrip.CurrentClip.PreviousFile))
            {
                PreparePreviousClip();
                Thread.Sleep(10);
                LoadPreviousClip();
            }
        }
Exemplo n.º 2
0
 private void PreparePreviousClip()
 {
     if (!string.IsNullOrEmpty(SelectedTrip.CurrentClip.PreviousFile))
     {
         // Load the next file into the spare player
         NovatekFile previous = SelectedTrip.Clips.Where(x => x.FileName == SelectedTrip.CurrentClip.PreviousFile).SingleOrDefault();
         SparePlayer.Source = new Uri(previous.FullNameAndPath);
         SparePlayer.Play();
         SparePlayer.Pause();
         _spClip = previous;
     }
 }