Skip to content

Comments

[video_player] Add Picture-in-Picture support for iOS#11105

Draft
akaboshinit wants to merge 2 commits intoflutter:mainfrom
akaboshinit:feature/video-player-pip-support
Draft

[video_player] Add Picture-in-Picture support for iOS#11105
akaboshinit wants to merge 2 commits intoflutter:mainfrom
akaboshinit:feature/video-player-pip-support

Conversation

@akaboshinit
Copy link

@akaboshinit akaboshinit commented Feb 23, 2026

Description

Adds Picture-in-Picture (PiP) support for iOS to the video_player plugin across three packages.

Fixes flutter/flutter#60048

video_player_platform_interface (6.6.0 → 6.7.0)

  • Add enablePictureInPicture(), disablePictureInPicture(), startPictureInPicture(), stopPictureInPicture(), isPictureInPictureSupported(), and isPictureInPictureActive() methods
  • Add pipStarted, pipStopped, pipRestoreUserInterface event types to VideoEventType

video_player_avfoundation (2.9.3 → 2.10.0)

  • Integrate AVPictureInPictureController with AVPlayerLayer
  • Support both texture-based and platform view players
  • Implement PiP delegate callbacks (start/stop/restore UI)
  • Add float-up animation workaround for texture-based players
  • macOS returns stub implementations (PiP not supported on macOS)
  • Requires iOS 14.2+

video_player (2.11.0 → 2.12.0)

  • Add isPictureInPictureActive field to VideoPlayerValue
  • Add PiP methods to VideoPlayerController
  • Handle pipStarted, pipStopped, pipRestoreUserInterface events

Example app

  • Add PiP demo controls to avfoundation example

Test plan

  • Unit tests for all PiP platform interface methods (platform_interface)
  • Unit tests for all PiP Pigeon API calls (avfoundation)
  • Unit tests for PiP event conversion (avfoundation)
  • Unit tests for PiP methods on VideoPlayerController (video_player)
  • Unit tests for VideoPlayerValue.isPictureInPictureActive state updates (video_player)
  • Unit tests for PiP methods before initialization throw StateError (video_player)
  • Manual test: PiP enable/disable on iOS device
  • Manual test: PiP start/stop on iOS device
  • Manual test: PiP events fire correctly

Note: PiP requires AVPictureInPictureController which is only available on real iOS devices (iOS 14.2+). Native XCTest unit tests are not included as PiP functionality cannot be tested in the simulator.

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. [video_player]
  • 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 under1.
  • 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 under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under1.
  • All existing and new tests are passing.

Footnotes

  1. See the docs on contributing for details. 2 3

@google-cla
Copy link

google-cla bot commented Feb 23, 2026

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.

Adds PiP support across three packages:

## video_player_platform_interface (6.6.0 → 6.7.0)
- Add enablePictureInPicture, disablePictureInPicture, startPictureInPicture,
  stopPictureInPicture, isPictureInPictureSupported, isPictureInPictureActive
- Add pipStarted, pipStopped, pipRestoreUserInterface event types

## video_player_avfoundation (2.9.3 → 2.10.0)
- Integrate AVPictureInPictureController with AVPlayerLayer
- Support both texture-based and platform view players
- Implement PiP delegate callbacks (start/stop/restore UI)
- macOS returns stub implementations (PiP not supported)
- Requires iOS 14.2+

## video_player (2.11.0 → 2.12.0)
- Add isPictureInPictureActive field to VideoPlayerValue
- Add PiP methods to VideoPlayerController
- Handle PiP events in the event listener

Fixes flutter/flutter#60048
…InPicture APIs

The native iOS implementation already sets up PiP automatically during
player initialization, making enablePictureInPicture a no-op check.
disablePictureInPicture's cleanup is already handled by dispose.
Removing these simplifies the API surface without losing functionality.
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.

[ios][video_player] pip - picture in picture

1 participant