Skip to content

[video_player] Stop display link on dispose#11118

Merged
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:video-player-frame-update-disposed
Mar 3, 2026
Merged

[video_player] Stop display link on dispose#11118
auto-submit[bot] merged 1 commit intoflutter:mainfrom
stuartmorgan-g:video-player-frame-update-disposed

Conversation

@stuartmorgan-g
Copy link
Collaborator

The video player and display link won't necessarily be deallocated when the player is disposed, so the display link should be stopped at that point to avoid having it drive frame requests.

Fixes flutter/flutter#181387

Pre-Review Checklist

Footnotes

  1. 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 3

The video player and display link won't necessarily be deallocated when
the player is disposed, so the display link should be stopped at that
point to avoid having it drive frame requests.

Fixes flutter/flutter#181387
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where the display link might not stop after a video player is disposed. The fix correctly stops the display link within the disposeWithError: method. A new test is included to verify this behavior. The changes are sound, and I have one suggestion to enhance the robustness of the new test.

Comment on lines +207 to +212
let identifiers = videoPlayerPlugin.createTexturePlayer(
with: FVPCreationOptions.make(withUri: hlsTestURI, httpHeaders: [:]),
error: &error)
#expect(error == nil)
let player =
videoPlayerPlugin.playersByIdentifier[identifiers!.playerId] as! FVPTextureBasedVideoPlayer

Choose a reason for hiding this comment

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

medium

For improved test robustness, it's better to use try #require to handle the optional returned by createTexturePlayer. This ensures the test fails gracefully with a clear message if nil is returned, rather than crashing due to force-unwrapping.

Suggested change
let identifiers = videoPlayerPlugin.createTexturePlayer(
with: FVPCreationOptions.make(withUri: hlsTestURI, httpHeaders: [:]),
error: &error)
#expect(error == nil)
let player =
videoPlayerPlugin.playersByIdentifier[identifiers!.playerId] as! FVPTextureBasedVideoPlayer
let identifiers = try #require(videoPlayerPlugin.createTexturePlayer(
with: FVPCreationOptions.make(withUri: hlsTestURI, httpHeaders: [:]),
error: &error))
#expect(error == nil)
let player =
videoPlayerPlugin.playersByIdentifier[identifiers.playerId] as! FVPTextureBasedVideoPlayer

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 3, 2026
@auto-submit auto-submit bot merged commit 9083bc9 into flutter:main Mar 3, 2026
81 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 3, 2026
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Mar 3, 2026
flutter/packages@faa4e22...9083bc9

2026-03-03 [email protected] [video_player] Stop display link on
dispose (flutter/packages#11118)
2026-03-02 [email protected] Roll Flutter from
1141b2b to 46fb721 (38 revisions) (flutter/packages#11162)
2026-03-02 [email protected] [pigeon] Switch Indent class to manage
all writes with a StringBuffer (flutter/packages#11133)
2026-03-02 [email protected] Add LeanCode
and contributors to AUTHORS (flutter/packages#11134)

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
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
…r#183164)

flutter/packages@faa4e22...9083bc9

2026-03-03 [email protected] [video_player] Stop display link on
dispose (flutter/packages#11118)
2026-03-02 [email protected] Roll Flutter from
1141b2b to 46fb721 (38 revisions) (flutter/packages#11162)
2026-03-02 [email protected] [pigeon] Switch Indent class to manage
all writes with a StringBuffer (flutter/packages#11133)
2026-03-02 [email protected] Add LeanCode
and contributors to AUTHORS (flutter/packages#11134)

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-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[video_player][iOS] VideoPlayer doesn't stop asking for new frame even if it has been disposed

2 participants