-
-
Notifications
You must be signed in to change notification settings - Fork 119
refactor: add playback rate message #775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
ChangePlaybackRateRequestMessagefor 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; |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
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'.
remove unnecessary epsilon comparison reply with the current playback rate
| { | ||
| /// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| { | |
| /// <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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
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).