private void DoSkipStep(int skipDirection) { IPlayerContext pc = GetPlayerContext(); if (pc == null) { return; } ReSetSkipTimer(); // First we find the new skip index, then we check if the player is able to skip. int newSkipStepIndex = _skipStepIndex; // We are in the matching range and want to step "forward" (greater step into this direction). if (_skipStepDirection == skipDirection) { // Last step must be valid to do next step if (_skipStepValid && _skipStepIndex < _skipSteps.Count - 1) { newSkipStepIndex++; } } else { // The current index is in the opposite direction, so we take one step back. if (_skipStepIndex > 0) { newSkipStepIndex--; } else { _skipStepDirection *= -1; // swap sign and direction newSkipStepIndex = 1; } } _skipStepIndex = newSkipStepIndex; if (pc.CanSkipRelative(TimeSpan.FromSeconds(_skipStepDirection * _skipSteps[newSkipStepIndex]))) { // Skip target is inside valid range SkipStep = FormatStepUnit(_skipStepDirection * _skipSteps[_skipStepIndex]); _skipStepValid = true; } else { _skipStepValid = false; SkipStep = _skipStepDirection == -1 ? "[Media.Start]" : "[Media.End]"; } }