Skip to content

Conversation

@helielson
Copy link

Why is this PR necessary, what does it do?

This PR adds an optional argument to the initialize method of VideoPlayerController, allowing buffering to start from a position other than T0.

_controller = VideoPlayerController.networkUrl(
  Uri.parse(
    'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
  ),
);

_controller.initialize(
  initialPosition: const Duration(seconds: 10),
);

It will pass down the position to the VideoPlayerPlatform.create method, which then forwards it to the native layer through CreateMessage.
In the native layer, we call seek(initialPosition) after creating the player.

Copy link

@tiagopvianna tiagopvianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@helielson helielson merged commit e4af837 into master Mar 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants