Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.9.0

* Adds `backBufferDurationMs` to `VideoPlayerOptions` to support configuring the back buffer duration.

## 6.8.0

* Adds `preventsDisplaySleepDuringVideoPlayback` to `VideoPlayerOptions` and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,11 @@ class VideoPlayerOptions {
this.allowBackgroundPlayback = false,
this.preventsDisplaySleepDuringVideoPlayback = true,
this.webOptions,
});
this.backBufferDurationMs,
}) : assert(
backBufferDurationMs == null || backBufferDurationMs >= 0,
'backBufferDurationMs must be zero or greater',
);
Comment thread
sailendrabathi marked this conversation as resolved.

/// Set this to true to keep playing video in background, when app goes in background.
/// The default value is false.
Expand All @@ -494,6 +498,12 @@ class VideoPlayerOptions {

/// Additional web controls
final VideoPlayerWebOptions? webOptions;

/// The duration, in milliseconds, of media to retain in the buffer prior to
/// the current playback position.
///
/// Ignored on platforms that do not support controlling the back buffer.
final int? backBufferDurationMs;
Comment thread
mboetger marked this conversation as resolved.
}

/// [VideoPlayerWebOptions] can be optionally used to set additional web settings
Expand Down Expand Up @@ -593,13 +603,20 @@ class VideoViewOptions {
@immutable
class VideoCreationOptions {
/// Constructs an instance of [VideoCreationOptions].
const VideoCreationOptions({required this.dataSource, required this.viewType});
const VideoCreationOptions({
required this.dataSource,
required this.viewType,
this.videoPlayerOptions,
});

/// The data source used to create the player.
final DataSource dataSource;

/// The type of view to be used for displaying the video player
final VideoViewType viewType;

/// Additional configuration options for the video player.
final VideoPlayerOptions? videoPlayerOptions;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Composing the two different options classes seems potentially confusing, but it doesn't look like the API surface ever clearly distinguished these conceptually. Since VideoCreationOptions isn't exposed to app-level clients it's probably not a big deal.

@tarrinneal As part of revisiting the video_player API surface later, it would be good to better distinguish what classes are for what steps of the process (e.g., global vs player-level options, which may have been the original intent here?), and we should also fix the fact that some of these classes are being directly re-exported from the app-facing package, which we should stop doing.

}

/// Represents an audio track in a video with its metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/video_player/
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 6.8.0
version: 6.9.0

environment:
sdk: ^3.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ void main() {
final options = VideoPlayerOptions();
expect(options.preventsDisplaySleepDuringVideoPlayback, true);
});
test('VideoPlayerOptions backBufferDurationMs defaults to null', () {
final options = VideoPlayerOptions();
expect(options.backBufferDurationMs, null);
});
test('VideoPlayerOptions backBufferDurationMs stores configured value', () {
final options = VideoPlayerOptions(backBufferDurationMs: 20000);
expect(options.backBufferDurationMs, 20000);
});
}
Loading