[video_player] Improve seek performance on Android#11810
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds the backBufferDurationMs option to VideoPlayerOptions to configure the ExoPlayer back buffer duration on Android, updating the platform interface, Android implementation, and adding no-op stubs for AVFoundation and Web. Feedback on the changes highlights that passing backBufferDurationMs via a global setter on Android can cause state persistence and race conditions during concurrent player initialization, and recommends passing this option directly through CreationOptions instead.
b94d8e4 to
624afd5
Compare
624afd5 to
b75044f
Compare
There was a problem hiding this comment.
Code Review
This pull request adds support for configuring ExoPlayer's back buffer duration on Android by introducing backBufferDurationMs to VideoPlayerOptions and forwarding it through the platform interface to the Android implementation. The Android plugin updates PlatformViewVideoPlayer and TextureVideoPlayer to configure ExoPlayer's DefaultLoadControl using this value, supported by new unit tests. Feedback suggests correcting an inaccurate comment regarding how backBufferDurationMs is passed and adding an assertion to ensure the duration is positive if provided.
54e8d1e to
2f8c779
Compare
Adds `backBufferDurationMs` to `VideoPlayerOptions` and configures ExoPlayer's `DefaultLoadControl` to retain the back buffer from keyframes. This significantly improves seek performance and responsiveness during video playback on Android.
2f8c779 to
178a8e1
Compare
Adds
backBufferDurationMstoVideoPlayerOptionsand configures ExoPlayer'sDefaultLoadControlto retain the back buffer from keyframes. This significantly improves seek performance and responsiveness during video playback on Android.iOS already has some kind of back buffering implemented in AVPlayer because the replays and seeks are instantaneous for small videos.
Before:
Replays and seeks on Android for network based video assets involve a network call to fetch the video content. This significantly hampers the user experience.
After:
Replays and seeks on Android (within the back buffer duration) are instant just like in iOS. Improving user experience
This PR partly addresses flutter/flutter#97428. Not enabling back buffering by default and instead allowing the app to configure as per need. The default behavior will be same as the existing implementation to avoid any regressions.
Pre-Review Checklist
[shared_preferences]///).