Skip to content

[video_player_android] isBuffering flag always return true after calling seekTo method - fixed #9198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

raju-muliyashiya
Copy link
Contributor

@raju-muliyashiya raju-muliyashiya commented May 4, 2025

fixes Issue #165149

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or I have commented below to indicate which [version change exemption] this PR falls under[^1].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style], or I have commented below to indicate which [CHANGELOG exemption] this PR falls under[^1].
  • All existing and new tests are passing.

Root Cause

The issue stems from the onPlaybackStateChanged callback. After calling seekTo, the player transitions to Player.STATE_BUFFERING, setting the buffering flag to true. Shortly after, it transitions to Player.STATE_READY. However, if the player was already initialized, the method returned early due to:

if (isInitialized) {
  return;
}

prevented setBuffering(false) from being called in the shared logic below the switch

@raju-muliyashiya raju-muliyashiya requested a review from camsim99 as a code owner May 4, 2025 11:08
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

Overall this change seems reasonable, but I want to ensure that this fixes the root cause of the issue.

Can you update the description to include a justification? Then, I think we should try re-enabling the integration test mentioned in flutter/flutter#165149 (comment):

.

Comment on lines 3 to 4
* Fixes a [bug](https://github.com/flutter/flutter/issues/165149) where isBuffering flag always
* return true after seekTo any position
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
* Fixes a [bug](https://github.com/flutter/flutter/issues/165149) where isBuffering flag always
* return true after seekTo any position
* Fixes a [bug](https://github.com/flutter/flutter/issues/165149) where the `isBuffering` flag always
* returns true after seeking to any position.

return;
if (!isInitialized) {
isInitialized = true;
sendInitialized();
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes in theory seems reasonable to me! Can you please add a test for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will add test case.

@camsim99 camsim99 requested a review from stuartmorgan-g May 5, 2025 21:48
@stuartmorgan-g
Copy link
Contributor

Overall this change seems reasonable, but I want to ensure that this fixes the root cause of the issue.

The timing certainly checks out; the early return was added in #8466 on March 4th, and the issue was first reported on March 13th.

…_buffer_on_seek_android_fix

# Conflicts:
#	packages/video_player/video_player_android/CHANGELOG.md
@raju-muliyashiya raju-muliyashiya requested a review from camsim99 May 7, 2025 19:01
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

LGTM but please fix the CHANGELOG :)

Comment on lines 118 to 120
*

Re-adds [support for Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins).
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo this change:

Suggested change
*
Re-adds [support for Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins).
* Re-adds [support for Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins).

@@ -284,3 +296,4 @@
## 2.2.17

* Splits from `video_player` as a federated implementation.
`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please undo this change too.

Also nit: the rest of the changes seem like auto-formatter changes, that are not needed.

@raju-muliyashiya
Copy link
Contributor Author

@stuartmorgan-g pending review

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g stuartmorgan-g requested a review from ash2moon as a code owner May 23, 2025 18:33
@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2025
@auto-submit auto-submit bot merged commit 9c11e9b into flutter:main May 23, 2025
81 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 27, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request May 27, 2025
flutter/packages@af0b9a9...6eebe72

2025-05-27 [email protected] [flutter_lints] Bump lints dependency to
6.0.0 and bump package to 6.0.0 (flutter/packages#9108)
2025-05-26 [email protected] Roll Flutter from
60050a0 to 4372bfb (6 revisions) (flutter/packages#9322)
2025-05-26 [email protected] [video_player_android] Add note
about Android platform views known issue (flutter/packages#9312)
2025-05-24 [email protected] Roll Flutter from
85564cb to 60050a0 (17 revisions) (flutter/packages#9318)
2025-05-23 [email protected]
[camera_android_camerax] Implement `enableAudio` for video recording
(flutter/packages#9264)
2025-05-23 [email protected]
[video_player_android] isBuffering flag always return true after calling
seekTo method - fixed (flutter/packages#9198)
2025-05-23 [email protected] [camera,video_player] replace
onSurfaceDestroyed with onSurfaceCleanup (flutter/packages#9316)
2025-05-23 [email protected] [camera,video_player] Update Android
to 3.29 minimum (flutter/packages#9317)
2025-05-23 [email protected] Roll Flutter from
33cdd8e to 85564cb (39 revisions) (flutter/packages#9315)
2025-05-23 [email protected] Update repo for 3.32 stable
(flutter/packages#9311)
2025-05-23 [email protected] [camera_avfoundation] Correct
pigeon configuration output paths (flutter/packages#9313)
2025-05-23 [email protected] [process] Remove from the repository
(flutter/packages#9310)
2025-05-22 [email protected] Ensure Example Packages Work on
Android API 36 (flutter/packages#9241)
2025-05-22 [email protected] Roll Flutter (stable) from
c236373 to be698c4 (1274 revisions) (flutter/packages#9300)
2025-05-22 [email protected] Remove CODEOWNER for generated iOS files
(flutter/packages#9272)
2025-05-22 [email protected]
[google_maps_flutter] Removes unnecessary parentheses
(flutter/packages#9273)
2025-05-21 [email protected] Rebalance Android plugin CODEOWNERS
(flutter/packages#9298)
2025-05-21 [email protected] Roll Flutter from
9a78af5 to 33cdd8e (60 revisions) (flutter/packages#9305)
2025-05-21 [email protected] [ci] Update repository for 3.29
release (flutter/packages#9270)
2025-05-21 [email protected] Ignore .cxx/ directories
(flutter/packages#9268)
2025-05-21 [email protected] [video_player] Skip some integration
tests on web (flutter/packages#9302)
2025-05-21 [email protected]
[webview_flutter] Adds support to respond to recoverable SSL certificate
errors (flutter/packages#9150)
2025-05-19 [email protected]
[camera_android_camerax] Swap out `BroadcastReceiver` for
`OrientationEventListener` (flutter/packages#9261)
2025-05-19 [email protected]
[video_player_android] Fix incorrect dimensions swap
(flutter/packages#9199)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: video_player platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The video player value.isBuffering always return true after seekTo any position
3 participants