Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 2 additions & 1 deletion packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.12.0

* Passes `backBufferDurationMs` from `VideoPlayerOptions` to the underlying platform interface.
* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

## 2.11.1
Expand Down
1 change: 1 addition & 0 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
final creationOptions = platform_interface.VideoCreationOptions(
dataSource: dataSourceDescription,
viewType: viewType,
videoPlayerOptions: videoPlayerOptions,
);

if (videoPlayerOptions?.mixWithOthers != null) {
Expand Down
6 changes: 3 additions & 3 deletions 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, macOS and web.
repository: https://github.com/flutter/packages/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.11.1
version: 2.12.0

environment:
sdk: ^3.10.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.

versioning says this will need to be 3.12.0 to merge, I'm not sure that's what we want though @stuartmorgan-g can you weigh in on that?

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.

Yes, this is expected, and is a common case for our federated plugins. The way it generally plays out is:

  • One of the platform implementations has a platform-specific reason to drop N-1/2, often related to some OS or platform tooling change (in this case it looks like it was supporting AGP 9, which required some functionality that's only in current stable). Our policy is that support for stable is required, but support for N-1/2 is entirely discretionary; packages authors are free to drop them when there's any reason to do so.
  • That doesn't immediately affect the app-facing package, because the app-facing package is still compatible with older versions of the platform implementation package, and the resolver will do the right thing for people on N-1/2.
  • Some later PR that adds a new feature needs to update the min version of the platform implementation to ensure that feature support is present when people try to use it (e.g., this PR). Because there's no longer a compatible platform implementation that supports N-1/2, the app-facing package needs to drop N-1/2 as well.

As a general rule of thumb: if the only thing failing is analyze_legacy, the right thing to do is raise the min SDK version unless the package owner has a compelling reason that they want to support N-1/2.

Expand All @@ -26,9 +26,9 @@ dependencies:
flutter:
sdk: flutter
html: ^0.15.0
video_player_android: ^2.9.1
video_player_android: ^2.11.0
video_player_avfoundation: ^2.9.0
video_player_platform_interface: ^6.6.0
video_player_platform_interface: ^6.9.0
video_player_web: ^2.1.0

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,22 @@ void main() {
reason: 'view type must be passed to the platform',
);
});

test('back buffer duration is forwarded to platform', () async {
const expectedBackBufferDurationMs = 20000;

final controller = VideoPlayerController.networkUrl(
Uri.parse('https://127.0.0.1'),
videoPlayerOptions: VideoPlayerOptions(backBufferDurationMs: expectedBackBufferDurationMs),
);

await controller.initialize();

expect(
fakeVideoPlayerPlatform.videoPlayerOptions.last?.backBufferDurationMs,
expectedBackBufferDurationMs,
reason:
'backBufferDurationMs must be forwarded to the platform via VideoCreationOptions.videoPlayerOptions',
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,7 @@ class FakeVideoPlayerPlatform extends VideoPlayerPlatform {
List<DataSource> dataSources = <DataSource>[];
List<VideoViewType> viewTypes = <VideoViewType>[];
final Map<int, StreamController<VideoEvent>> streams = <int, StreamController<VideoEvent>>{};
List<VideoPlayerOptions?> videoPlayerOptions = <VideoPlayerOptions?>[];
bool forceInitError = false;
int nextPlayerId = 0;
final Map<int, Duration> _positions = <int, Duration>{};
Expand Down Expand Up @@ -1943,6 +1944,7 @@ class FakeVideoPlayerPlatform extends VideoPlayerPlatform {
}
dataSources.add(options.dataSource);
viewTypes.add(options.viewType);
videoPlayerOptions.add(options.videoPlayerOptions);
return nextPlayerId++;
}

Expand Down