Skip to content

Commit

Permalink
[video_player] Unfork publish: for macOS (#5578)
Browse files Browse the repository at this point in the history
Now that `publish:` is avaiable for macOS on 3.16, remove the forking that compiled that call out for macOS.

Fixes flutter/flutter#135320
  • Loading branch information
stuartmorgan authored Dec 7, 2023
1 parent 170267b commit 70be741
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions packages/video_player/video_player_avfoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,7 @@ @interface FVPVideoPlayerPlugin ()
@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,19 @@ - (void)testHotReloadDoesNotCrash {
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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ = {
Expand All @@ -134,7 +134,7 @@
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
331C80D6294CF71000263BE5 /* RunnerTests */,
330B3F8E2B1F9C6A00E6DC3F /* RunnerTests */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
628924301D1755B9EF85E51F /* Pods */,
Expand Down
6 changes: 3 additions & 3 deletions packages/video_player/video_player_avfoundation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: video_player_avfoundation
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:
Expand Down

0 comments on commit 70be741

Please sign in to comment.