Skip to content
Open
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,5 +1,6 @@
## NEXT
## 6.8.0

* Adds `backBufferDurationMs` to `VideoPlayerOptions` to support configuring ExoPlayer back buffer duration on Android.
* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

## 6.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ class VideoPlayerOptions {
this.mixWithOthers = false,
this.allowBackgroundPlayback = false,
this.webOptions,
});
this.backBufferDurationMs,
}) : assert(
backBufferDurationMs == null || backBufferDurationMs >= 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On non-android implementations, isn't it going to be null?

@sailendrabathi sailendrabathi Jun 19, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I didn't get you... the assert is that is should be null or non-negative. i.e it cannot be a non-null negative number

'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 @@ -477,6 +481,9 @@ class VideoPlayerOptions {

/// Additional web controls
final VideoPlayerWebOptions? webOptions;

/// **Android only**. Sets ExoPlayer's back buffer duration in milliseconds.
final int? backBufferDurationMs;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you're asserting it must be non-null, why allow it to be nullable?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The assert is that it can be null or non negative. i.e cannot be a non-null negative number

}

/// [VideoPlayerWebOptions] can be optionally used to set additional web settings
Expand Down Expand Up @@ -576,13 +583,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;
}

/// 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.7.0
version: 6.8.0

environment:
sdk: ^3.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ void main() {
final options = VideoPlayerOptions();
expect(options.mixWithOthers, false);
});
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);
});
}