/// <summary>
        ///     Handles spectating a user if applicable
        /// </summary>
        public void HandleSpectating()
        {
            if (Screen.SpectatorClient == null)
            {
                return;
            }

            if (CurrentFrame >= Replay.Frames.Count)
            {
                if (AudioEngine.Track.IsPlaying)
                {
                    AudioEngine.Track.Pause();
                }

                if (!Screen.IsPaused)
                {
                    Screen.IsPaused = true;
                }
                return;
            }

            VirtualPlayer.PlayAllFrames();

            if (Screen.IsPaused)
            {
                Screen.IsPaused = false;
            }

            if (AudioEngine.Track.IsPaused)
            {
                AudioEngine.Track.Play();
            }
        }
        /// <summary>
        ///     Determines which frame we are on in the replay and sets if it has unique key presses/releases.
        /// </summary>
        internal void HandleInput()
        {
            if (Screen.SpectatorClient != null)
            {
                VirtualPlayer.PlayAllFrames();
            }

            HandleScoring();

            if (CurrentFrame >= Replay.Frames.Count || !(Manager.CurrentAudioPosition >= Replay.Frames[CurrentFrame].Time) || !Screen.InReplayMode)
            {
                return;
            }

            var previousActive = Replay.KeyPressStateToLanes(Replay.Frames[CurrentFrame - 1].Keys);
            var currentActive  = Replay.KeyPressStateToLanes(Replay.Frames[CurrentFrame].Keys);

            foreach (var activeLane in currentActive)
            {
                try
                {
                    if (!previousActive.Contains(activeLane))
                    {
                        UniquePresses[activeLane] = true;
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }

            foreach (var activeLane in previousActive)
            {
                try
                {
                    if (!currentActive.Contains(activeLane))
                    {
                        UniqueReleases[activeLane] = true;
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }

            CurrentFrame++;
        }
        private void HandleScoring()
        {
            if (VirtualPlayer.CurrentFrame < VirtualPlayer.Replay.Frames.Count)
            {
                VirtualPlayer.PlayAllFrames();
            }

            for (var i = CurrentVirtualReplayStat + 1; i < VirtualPlayer.ScoreProcessor.Stats.Count; i++)
            {
                var hom = Screen.Ruleset.HitObjectManager as HitObjectManagerKeys;

                if (hom?.CurrentAudioPosition >= VirtualPlayer.ScoreProcessor.Stats[i].SongPosition)
                {
                    var judgement = VirtualPlayer.ScoreProcessor.Stats[i].Judgement;

                    ((ScoreProcessorKeys)Screen.Ruleset.ScoreProcessor).CalculateScore(judgement);

                    // Update Scoreboard
                    var view = (GameplayScreenView)Screen.View;
                    view.UpdateScoreAndAccuracyDisplays();

                    var playfield = (GameplayPlayfieldKeys)Screen.Ruleset.Playfield;
                    playfield.Stage.ComboDisplay.MakeVisible();

                    if (judgement != Judgement.Miss)
                    {
                        playfield.Stage.HitError.AddJudgement(judgement, VirtualPlayer.ScoreProcessor.Stats[i].HitDifference);
                    }

                    playfield.Stage.JudgementHitBurst.PerformJudgementAnimation(judgement);

                    CurrentVirtualReplayStat++;
                }
                else
                {
                    break;
                }
            }
        }