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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raju8000
Copy link
Contributor

@raju8000 raju8000 commented May 4, 2025

[List which issues are fixed by this PR. You must list at least one issue.
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

@raju8000 raju8000 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants