-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
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) |
Copilot
AI
Aug 5, 2025
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) |
| set | ||
| { | ||
| double oldValue = VlcPlayer.AudioDelay / 1000.0; | ||
| if (Math.Abs(oldValue - value) > 0.0001) |
Copilot
AI
Aug 5, 2025
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.
|
There is actually a reason I didn't want to include the timing offset properties in the |
Makes sense. |
from media player interface
add helper methods for time delay conversions
No description provided.