Skip to content

[video_player_avfoundation] Implement preventsDisplaySleepDuringVideoPlayback#11547

Draft
shrabanti722 wants to merge 1 commit intoflutter:mainfrom
shrabanti722:video-player-prevents-display-sleep-avfoundation
Draft

[video_player_avfoundation] Implement preventsDisplaySleepDuringVideoPlayback#11547
shrabanti722 wants to merge 1 commit intoflutter:mainfrom
shrabanti722:video-player-prevents-display-sleep-avfoundation

Conversation

@shrabanti722
Copy link
Copy Markdown

Description

Implements the setPreventsDisplaySleepDuringVideoPlayback platform interface method using AVPlayer.preventsDisplaySleepDuringVideoPlayback on iOS and macOS.

AVFoundation implementation breakout PR for #11225.

Dependencies

  • Depends on the video_player_platform_interface 6.7.0 breakout PR. CI will fail until that PR lands and the new interface version is published. Keeping this PR in draft until then.

Changes

  • Implements setPreventsDisplaySleepDuringVideoPlayback in FVPVideoPlayer.m and wires it through the Dart platform implementation.
  • Adds the Pigeon method definition and regenerates messages (includes a pigeon v26.1.7 → v26.2.3 bump carried over from the parent PR).
  • Bumps video_player_avfoundation to 2.10.0 and updates the video_player_platform_interface constraint to ^6.7.0.
  • Updates CHANGELOG.

Related

@flutter-dashboard
Copy link
Copy Markdown

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
Copy Markdown

@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 implements the setPreventsDisplaySleepDuringVideoPlayback feature for the AVFoundation video player, enabling control over display sleep during playback. The changes include updates to Pigeon message definitions, the Dart platform implementation, and the native Objective-C code. Feedback indicates that the implementation lacks required unit or integration tests as specified in the repository style guide.

Comment on lines +182 to +189
Future<void> setPreventsDisplaySleepDuringVideoPlayback(
int playerId,
bool preventsDisplaySleepDuringVideoPlayback,
) {
return _playerWith(id: playerId).setPreventsDisplaySleepDuringVideoPlayback(
preventsDisplaySleepDuringVideoPlayback,
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This PR implements a new feature setPreventsDisplaySleepDuringVideoPlayback, but it does not include any unit or integration tests to verify the implementation. Per the repository style guide, all new code should be tested. Please add tests in packages/video_player/video_player_avfoundation/test/ to ensure that the platform implementation correctly calls the Pigeon API and that the native side behaves as expected.

…Playback

Implements the platform interface method
`setPreventsDisplaySleepDuringVideoPlayback` using
`AVPlayer.preventsDisplaySleepDuringVideoPlayback` on iOS and macOS.

AVFoundation implementation breakout PR for flutter#11225.
Depends on the platform interface breakout PR (6.7.0).

Made-with: Cursor
@shrabanti722 shrabanti722 force-pushed the video-player-prevents-display-sleep-avfoundation branch from 431a14a to b53cddc Compare April 21, 2026 12:03
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.

[video_player] Allow screen auto-lock during video playback on iOS

1 participant