flutter_vlc_player icon indicating copy to clipboard operation
flutter_vlc_player copied to clipboard

Enhancements: Start Time Initialization and Extended Volume Range

Open itsSagarBro opened this issue 2 years ago • 4 comments

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

  1. 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.

  2. 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.

itsSagarBro avatar Nov 07 '23 14:11 itsSagarBro

Hey @itsSagarBro , thanks for the PR - I'll try to ask somebody to review it sometime soon(-ish).

illia-romanenko avatar Nov 15 '23 17:11 illia-romanenko

@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

ghost avatar Dec 05 '23 14:12 ghost

Unhandled Exception: Invalid argument (Start At cannot be greater than video duration.): Instance of 'Duration'.

Ahtsham0715 avatar Jun 05 '24 10:06 Ahtsham0715