Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.0

* Exposes `VideoScrubber` so it can be used to make custom video progress indicators

## 2.4.10

* Adds compatibilty with version 6.0 of the platform interface.
Expand Down
21 changes: 15 additions & 6 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -835,20 +835,29 @@ class VideoProgressColors {
final Color backgroundColor;
}

class _VideoScrubber extends StatefulWidget {
const _VideoScrubber({
/// A scrubber to control [VideoPlayerController]s
class VideoScrubber extends StatefulWidget {
/// Create a [VideoScrubber] handler with the given [child].
///
/// [controller] is the [VideoPlayerController] that will be controlled by
/// this scrubber.
const VideoScrubber({
Key? key,
required this.child,
required this.controller,
});
}) : super(key: key);

/// The widget that will be displayed inside the gesture detector.
final Widget child;

/// The [VideoPlayerController] that will be controlled by this scrubber.
final VideoPlayerController controller;

@override
_VideoScrubberState createState() => _VideoScrubberState();
State<VideoScrubber> createState() => _VideoScrubberState();
}

class _VideoScrubberState extends State<_VideoScrubber> {
class _VideoScrubberState extends State<VideoScrubber> {
bool _controllerWasPlaying = false;

VideoPlayerController get controller => widget.controller;
Expand Down Expand Up @@ -1013,7 +1022,7 @@ class _VideoProgressIndicatorState extends State<VideoProgressIndicator> {
child: progressIndicator,
);
if (widget.allowScrubbing) {
return _VideoScrubber(
return VideoScrubber(
controller: controller,
child: paddedProgressIndicator,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
repository: https://github.com/flutter/plugins/tree/main/packages/video_player/video_player
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.4.10
version: 2.5.0

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down