[video_player_android] Avoid sending unset duration on initialization#11709
Conversation
|
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. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request modifies ExoPlayerEventListener to delay the initialization event until a valid media duration is available, implementing a 500ms fallback mechanism using a Handler. Feedback suggests adding a release method to cancel pending callbacks and prevent potential crashes upon disposal. Additionally, the reviewer recommended ensuring the fallback timer is not repeatedly reset and requested the inclusion of unit tests to verify the new logic and timeout behavior.
@dao-wkm You've checked this box, but I don't see this in the PR or description. Please make sure to complete all steps in the checklist. |
@stuartmorgan-g Thanks for pointing that out. I’ve updated |
…static in ExoPlayerEventListener and update test to use this constant
|
@dao-wkm Is this ready for another review? |
|
Sorry have been OOO for a bit. |
|
Seems like the pubspec.yaml and the CHANGELOG need to be updated since the last merge with master |
Hi @mboetger, I’ve updated the branch with the latest master and verified pubspec.yaml and CHANGELOG. |
|
@mboetger Could you find a second Android reviewer for this? |
|
autosubmit label was removed for flutter/packages/11709, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…er#189782) flutter/packages@611899b...8260a1e 2026-07-20 [email protected] [cupertino_ui] Publish pre-release 0.0.2 (flutter/packages#12251) 2026-07-20 [email protected] [camera_android_camerax] Add `AGENTS.md` (flutter/packages#12066) 2026-07-20 [email protected] [cupertino_ui] Undo unpublished version info (flutter/packages#12252) 2026-07-20 [email protected] [video_player_android] Avoid sending unset duration on initialization (flutter/packages#11709) 2026-07-20 [email protected] [webview_flutter] Convert from XCTest to Swift Testing (flutter/packages#12243) 2026-07-20 [email protected] [various] Convert example boilerplate from Java to Kotlin (flutter/packages#12201) 2026-07-20 [email protected] [material_ui, cupertino_ui] Update changelogs for the prerelease (flutter/packages#12249) 2026-07-20 [email protected] Roll Flutter from 8005793 to cab057d (2 revisions) (flutter/packages#12248) 2026-07-20 [email protected] [in_app_purchase_android] Add obfuscated profile ID purchase param (flutter/packages#12080) 2026-07-20 [email protected] [material_ui] Unpin material_color_utilities (flutter/packages#12225) 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
Description
Fixes flutter/flutter#176575
Avoid sending an
initializedevent with an unset duration invideo_player_android.On Android, ExoPlayer can briefly report
C.TIME_UNSETfor non-live, non-dynamic media when playback first reachesSTATE_READY. That value can be converted into an invalidDurationon the Dart side, causing some videos to report a duration such as0:00:00.001000.This PR delays sending the
initializedevent until a valid duration is available for regular media. It also listens for timeline updates and retries initialization when the timeline becomes ready. A short fallback timeout is kept so initialization is not blocked indefinitely if a valid duration is never reported.Breaking Changes
None - all changes are additive and backward compatible.
Pre-Review Checklist
[shared_preferences]///).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2