[video_player] Unfork publish: for macOS (#5578)
Now that `publish:` is avaiable for macOS on 3.16, remove the forking that compiled that call out for macOS.
Fixes https://github.com/flutter/flutter/issues/135320
diff --git a/packages/video_player/video_player_avfoundation/CHANGELOG.md b/packages/video_player/video_player_avfoundation/CHANGELOG.md
index e9c2bcc..23316e0 100644
--- a/packages/video_player/video_player_avfoundation/CHANGELOG.md
+++ b/packages/video_player/video_player_avfoundation/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.5.3
+
+* Publishes an instance of the plugin to the registrar on macOS, as on iOS.
+
## 2.5.2
* Fixes flickering and seek-while-paused on macOS.
diff --git a/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m b/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m
index bece3f3..654c63f 100644
--- a/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m
+++ b/packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m
@@ -666,11 +666,7 @@
@implementation FVPVideoPlayerPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FVPVideoPlayerPlugin *instance = [[FVPVideoPlayerPlugin alloc] initWithRegistrar:registrar];
-#if !TARGET_OS_OSX
- // TODO(stuartmorgan): Remove the ifdef once >3.13 reaches stable. See
- // https://github.com/flutter/flutter/issues/135320
[registrar publish:instance];
-#endif
SetUpFVPAVFoundationVideoPlayerApi(registrar.messenger, instance);
}
diff --git a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m
index 0083619..bebcb71 100644
--- a/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m
+++ b/packages/video_player/video_player_avfoundation/darwin/RunnerTests/VideoPlayerTests.m
@@ -691,6 +691,19 @@
handler:nil]; // No assertions needed. Lack of crash is a success.
}
+- (void)testPublishesInRegistration {
+ NSString *pluginKey = @"TestRegistration";
+ NSObject<FlutterPluginRegistry> *registry = GetPluginRegistry();
+ NSObject<FlutterPluginRegistrar> *registrar = [registry registrarForPlugin:pluginKey];
+
+ [FVPVideoPlayerPlugin registerWithRegistrar:registrar];
+
+ id publishedValue = [registry valuePublishedByPlugin:pluginKey];
+
+ XCTAssertNotNil(publishedValue);
+ XCTAssertTrue([publishedValue isKindOfClass:[FVPVideoPlayerPlugin class]]);
+}
+
#if TARGET_OS_IOS
- (void)validateTransformFixForOrientation:(UIImageOrientation)orientation {
AVAssetTrack *track = [[FakeAVAssetTrack alloc] initWithOrientation:orientation];
diff --git a/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj b/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj
index 0fb67b6..4a5c59d 100644
--- a/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj
+++ b/packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj
@@ -110,12 +110,12 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 331C80D6294CF71000263BE5 /* RunnerTests */ = {
+ 330B3F8E2B1F9C6A00E6DC3F /* RunnerTests */ = {
isa = PBXGroup;
children = (
33683FF02ABCAC94007305E4 /* VideoPlayerTests.m */,
);
- path = RunnerTests;
+ name = RunnerTests;
sourceTree = "<group>";
};
33BA886A226E78AF003329D5 /* Configs */ = {
@@ -134,7 +134,7 @@
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
- 331C80D6294CF71000263BE5 /* RunnerTests */,
+ 330B3F8E2B1F9C6A00E6DC3F /* RunnerTests */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
628924301D1755B9EF85E51F /* Pods */,
diff --git a/packages/video_player/video_player_avfoundation/pubspec.yaml b/packages/video_player/video_player_avfoundation/pubspec.yaml
index e10c729..76a32f0 100644
--- a/packages/video_player/video_player_avfoundation/pubspec.yaml
+++ b/packages/video_player/video_player_avfoundation/pubspec.yaml
@@ -2,11 +2,11 @@
description: iOS and macOS implementation of the video_player plugin.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
-version: 2.5.2
+version: 2.5.3
environment:
- sdk: ">=3.1.0 <4.0.0"
- flutter: ">=3.13.0"
+ sdk: ">=3.2.0 <4.0.0"
+ flutter: ">=3.16.0"
flutter:
plugin: