-
-
Notifications
You must be signed in to change notification settings - Fork 54
chore: refactor timing offset properties #649
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 timing offset properties for audio and subtitle synchronization by moving them from custom implementation in the ViewModel to proper interface-based properties in the media player architecture.
- Extracted timing offset properties from PlayerControlsViewModel to the IMediaPlayer interface
- Replaced manual property handling with ObservableProperty attributes for automatic change notifications
- Added proper event handling for timing offset changes in VlcMediaPlayer
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
PlayerControlsViewModel.cs | Removed custom timing offset properties and replaced with ObservableProperty fields and change handlers |
VlcMediaPlayer.cs | Added proper AudioTimingOffset and SubtitleTimingOffset properties with event notifications |
IMediaPlayer.cs | Added timing offset properties and events to the interface definition |
public double SubtitleTimingOffset | ||
{ | ||
get => VlcPlayer.SpuDelay / 1000.0; | ||
set | ||
{ | ||
double oldValue = VlcPlayer.SpuDelay / 1000.0; | ||
if (Math.Abs(oldValue - value) > 0.0001) |
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.
The magic number 0.0001 should be extracted to a named constant to improve maintainability and make the tolerance value explicit.
public double SubtitleTimingOffset | |
{ | |
get => VlcPlayer.SpuDelay / 1000.0; | |
set | |
{ | |
double oldValue = VlcPlayer.SpuDelay / 1000.0; | |
if (Math.Abs(oldValue - value) > 0.0001) | |
private const double SubtitleTimingOffsetTolerance = 0.0001; | |
public double SubtitleTimingOffset | |
{ | |
get => VlcPlayer.SpuDelay / 1000.0; | |
set | |
{ | |
double oldValue = VlcPlayer.SpuDelay / 1000.0; | |
if (Math.Abs(oldValue - value) > SubtitleTimingOffsetTolerance) |
Copilot uses AI. Check for mistakes.
set | ||
{ | ||
double oldValue = VlcPlayer.AudioDelay / 1000.0; | ||
if (Math.Abs(oldValue - value) > 0.0001) |
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.
The magic number 0.0001 should be extracted to a named constant to improve maintainability and make the tolerance value explicit. Consider using the same constant as in the SubtitleTimingOffset property.
Copilot uses AI. Check for mistakes.
There is actually a reason I didn't want to include the timing offset properties in the |
Makes sense. |
No description provided.