-
Notifications
You must be signed in to change notification settings - Fork 259
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
Enhancements: Start Time Initialization and Extended Volume Range #451
base: master
Are you sure you want to change the base?
Conversation
Hey @itsSagarBro , thanks for the PR - I'll try to ask somebody to review it sometime soon(-ish). |
@itsSagarBro Thank you for the PR.
I've also added some comments in the code, please take a look |
if (maxVolume > volumeLimit) { | ||
throw ArgumentError.value( | ||
maxVolume, | ||
'Max volume should be lower than 200.', |
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.
We often use the magic number '200.' Why not use a constant instead? If we ever need to make changes, we would only have to edit it in one place, rather than in multiple locations.
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.
Why not go back to the value of 100 if 200 doesn't make the video louder? And avoid using magic numbers.
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.
Volume 200, Actually makes videos louder, I have created some OTT apps, which greatly helped me. And I will certainly fix the magic number issue.
@@ -233,6 +239,10 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> { | |||
); | |||
break; | |||
case VlcMediaEventType.playing: | |||
|
|||
/// Calling start at | |||
if (startAt != null && !_startAtSet) _setStartAt(); |
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.
There is no need for this 'if' condition, as it is already present in the method. Call the method after setting the 'value' so that the code works.
value = value.copyWith(
...
);
_setStartAt();
if (maxVolume > volumeLimit) { | ||
throw ArgumentError.value( | ||
maxVolume, | ||
'Max volume should be lower than 200.', |
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.
Why not go back to the value of 100 if 200 doesn't make the video louder? And avoid using magic numbers.
Unhandled Exception: Invalid argument (Start At cannot be greater than video duration.): Instance of 'Duration'. |
Pull Request Description
Summary
This pull request introduces several enhancements to the Flutter VLC Player, including the ability to specify a start time when initializing a video and the option to set and get the maximum volume up to 200%. These improvements enhance the player's functionality and provide more flexibility for developers working with video playback in Flutter applications.
Changes Made
Start Time Initialization: Added the
startAt
parameter to the player's initialization, allowing developers to specify a start time in duration when opening a video or setting media. This enables users to jump to a specific point in the video when it starts playing.Extended Volume Range: Enhanced the volume control by allowing volumes up to 200% (2x). This added flexibility in volume control can be useful for scenarios where users want to amplify audio beyond the standard 100% volume.
How to Use the New Features
Start Time Initialization
Extended Volume Range
To set the volume to 150%:
To get the current volume:
Testing
I have thoroughly tested these changes by creating unit tests and running sample Flutter applications to ensure that the new features work as expected. No regressions were identified during testing.