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,3 +1,7 @@
## 6.9.0

* Adds `backBufferDurationMs` to `VideoPlayerOptions` to support configuring ExoPlayer back buffer duration on Android.

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.

Same here; don't reference ExoPlayer or Android.


## 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;

/// ** Android only **. Sets ExoPlayer's back buffer duration in milliseconds.

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.

We don't make assertions about what platforms implement something in platform interface packgaes, because this package doesn't control that. What if a third-party implementation for another platform supports it, for instance? Or it's added to iOS later, without any change to this package?

We also don't describe behavior in terms of underlying SDK details unless there's no other way to. This comment should describe what the back buffer is, conceptually, without reference to ExoPlayer.

///
/// This is not possible on iOS because AVPlayer does not provide a way to
/// configure the back buffer duration.

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.

Same here. You can say "Ignored on platforms that do not support controlling the back buffer.", which is both generic to other implementations, and future-proof.

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.

I was going to say this, but I figured once the interface is reworked to use the new standard of supportsX I would remove it myself.

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.

but Stuart is right, that is protocol

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.

It's not just protocol; this class is directly re-exported from the app-facing package currently, so these will be client-facing docs as soon as they land.

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);
});
}