Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Refactors the Dart internals to create a pleyer instance class on the Dart side, and intermediates the event stream with an instance-managed stream controller that would allow for alternate event sources (e.g., Dart code).

This prepares for future moves of more logic to Dart, and parallels Android Dart code changes made in
#9771

Part of flutter/flutter#172763

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

Refactors the Dart internals to create a pleyer instance class on the
Dart side, and intermediates the event stream with an instance-managed
stream controller that would allow for alternate event sources (e.g.,
Dart code).

This prepares for future moves of more logic to Dart, and parallels
Android Dart code changes made in
flutter#9771

Part of flutter/flutter#172763
FVPEventBridge *eventBridge = [[FVPEventBridge alloc]
initWithMessenger:messenger
channelName:[NSString stringWithFormat:@"flutter.io/videoPlayer/videoEvents%@",
channelName:[NSString stringWithFormat:@"flutter.dev/videoPlayer/videoEvents%@",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was just an opportunistic change; I had mass-changed flutter.io to flutter.dev in most places a while ago, and apparently missed this channel name.

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 refactors the Dart implementation of the AVFoundation video player to introduce a _PlayerInstance class. This new class encapsulates the state and behavior for a single video player instance, including handling API calls and event streams. This is a good architectural improvement that increases modularity and maintainability. The event channel name has also been updated from flutter.io to flutter.dev for consistency. The tests have been updated to reflect these changes.

I've found a couple of issues related to the new StreamController in _PlayerInstance that could lead to resource leaks or runtime errors. Please see my detailed comments.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2025
@auto-submit auto-submit bot merged commit 5d8d954 into flutter:main Nov 26, 2025
80 checks passed
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Nov 27, 2025
flutter/packages@cc3dca6...5d8d954

2025-11-26 stuartmorgan@google.com [video_player_avfoundation] Create a
Dart player instance (flutter/packages#10490)
2025-11-25 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump com.google.maps.android:android-maps-utils from 3.6.0
to 3.19.1 in
/packages/google_maps_flutter/google_maps_flutter_android/android
(flutter/packages#10390)
2025-11-25 stuartmorgan@google.com [path_provider] Revert iOS/macOS to
plugin-based implementation (flutter/packages#10517)
2025-11-25 stuartmorgan@google.com [google_maps_flutter] Replace
deprecated APIs (flutter/packages#10474)
2025-11-25 stuartmorgan@google.com [tool] Remove code analysis from
podspec-check (flutter/packages#10484)

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 flutter-ecosystem@google.com 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
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
)

flutter/packages@cc3dca6...5d8d954

2025-11-26 stuartmorgan@google.com [video_player_avfoundation] Create a
Dart player instance (flutter/packages#10490)
2025-11-25 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump com.google.maps.android:android-maps-utils from 3.6.0
to 3.19.1 in
/packages/google_maps_flutter/google_maps_flutter_android/android
(flutter/packages#10390)
2025-11-25 stuartmorgan@google.com [path_provider] Revert iOS/macOS to
plugin-based implementation (flutter/packages#10517)
2025-11-25 stuartmorgan@google.com [google_maps_flutter] Replace
deprecated APIs (flutter/packages#10474)
2025-11-25 stuartmorgan@google.com [tool] Remove code analysis from
podspec-check (flutter/packages#10484)

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 flutter-ecosystem@google.com 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.

2 participants