Skip to content

Conversation

@United600
Copy link
Collaborator

Adds a new message-based approach for playback rate updates, unifies the terminology from "speed" to "rate", and expands the available playback rate options (4x).

Also adds constants for OEM keys (comma, period, plus, minus).

@United600 United600 requested a review from Copilot January 19, 2026 15:29
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jan 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the playback rate functionality to use a message-based architecture and standardizes terminology from "speed" to "rate" throughout the codebase. It also extends the maximum playback rate option to 4x and introduces named constants for OEM virtual keys.

Changes:

  • Introduces ChangePlaybackRateRequestMessage for coordinated playback rate changes via the messenger pattern
  • Replaces direct property setting with command-based approach using SetPlaybackRateCommand
  • Adds named constants (VK_OEM_PLUS, VK_OEM_COMMA, VK_OEM_MINUS, VK_OEM_PERIOD) to replace magic number key codes
  • Simplifies playback rate adjustment logic from step-based to linear increment/decrement
  • Extends maximum playback rate from 2x to 4x

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Screenbox.Core/Messages/ChangePlaybackRateRequestMessage.cs New message class for playback rate change requests following the established RequestMessage pattern
Screenbox.Core/ViewModels/PlayerControlsViewModel.cs Renamed PlaybackSpeed to PlaybackRate, added message receiver for rate changes with validation and clamping (0.05-4.0)
Screenbox.Core/ViewModels/PlayerPageViewModel.cs Introduced OEM key constants, refactored rate adjustment to use linear increment/decrement with message-based approach
Screenbox/Controls/PlayerControls.xaml Updated bindings from PlaybackSpeed to PlaybackRate, changed command references, added 4x speed option
Screenbox/Controls/PlayerControls.xaml.cs Updated property and command references to use PlaybackRate terminology
Screenbox.Core/Screenbox.Core.csproj Added new message class to project file

[ObservableProperty] private string? _titleName; // TODO: Handle VLC title name
[ObservableProperty] private string? _chapterName;
[ObservableProperty] private double _playbackSpeed;
[ObservableProperty] private double _playbackRate;
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field '_playbackRate' can be 'readonly'.

Copilot uses AI. Check for mistakes.
remove unnecessary epsilon comparison

reply with the current playback rate
Comment on lines +9 to +10
{
/// <summary>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
/// <summary>
{
public const double MinRate = 0.05;
public const double MaxRate = 4.0;
public const double Step = 0.25;
/// <summary>

Is it a good idea to move the constants to the message?

case nameof(MediaListViewModel.CurrentItem):
HasActiveItem = Playlist.CurrentItem != null;
SubtitleTimingOffset = 0;
AudioTimingOffset = 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AudioTimingOffset = 0;
PlaybackRate = 1.0;

I wonder if we should reset the playback rate on media change? I don't think so, but maybe behind a setting? Probably not even that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant