fix(windows): defer player startup initialization - #1081
Open
vicente-higino wants to merge 2 commits into
Open
Conversation
vicente-higino
marked this pull request as ready for review
August 10, 2026 00:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Separates the remaining Windows startup-initialization fix from the window-management changes discussed in #1069.
On Windows, the video backend and system media controls are no longer initialized during application startup. They initialize on the first playback request instead. Concurrent initialization requests share one operation, while failed attempts remain retryable.
Other platforms retain their existing eager player initialization behavior.
Relates to #1001 and follows the investigation in #1069.
Root cause and scope
After the delayed window-restoration and Flutter-child fixes were applied, an intermittent unresponsive launch still occurred. The remaining startup path eagerly initialized the native player and awaited SMTC before window setup. Deferring that work removed the remaining freeze from repeated A/B launch testing.
Changes
Validation
flutter test --no-pub test\single_flight_initializer_test.dart test\video_player_initialization_test.dart: 5/5 pass.flutter analyze --no-pub: no issues.AI Assistance Disclosure
This change was developed with assistance from OpenAI Codex. Codex was used to isolate the remaining startup work after the window fix, implement retryable single-flight initialization, add regression tests, rebase across the latest upstream player changes, build the release, and run repeated startup probes.
Approximately two additional hours of active AI-assisted A/B investigation, implementation, rebasing, and validation went into this portion, in addition to the contributor's manual testing. The extra time was necessary because the native player/SMTC workload was intermittent and initially looked like the window-placement freeze; repeated isolated builds were required to distinguish the two causes.