Enhancements: Start Time Initialization and Extended Volume Range
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
startAtparameter 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
VlcPlayer(
controller: VlcPlayerController.network(
'your_video_url_here',
startAt: const Duration(seconds: 5), // Start playing the video at 5 seconds.
),
)
Extended Volume Range
To set the volume to 150%:
vlcController.setMaxVolume(150);
To get the current volume:
double currentVolume = vlcController.getMaxVolume();
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.
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 have a few comments:
- I noticed that if the 'startAt' value is set to a value greater than the video's length, the video won't play.
- I’m not sure if we need to change '_maxVolume' to 200 because it doesn't seem to affect the volume, which I believe was the intended purpose. This value appears to only add a number of steps.
I've also added some comments in the code, please take a look
Unhandled Exception: Invalid argument (Start At cannot be greater than video duration.): Instance of 'Duration'.