Skip to content

[video_player] Unfork publish: for macOS #5578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

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

im curious who is currently using this instance on iOS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably nobody (although in practice it could be anyone, in code we don't control). I expect the reason the publish call exists is because of the (deeply unfortunate, IMO, and I want to revisit this API at some point) fact that the only way to get this engine shutdown call is to publish an instance of yourself.

(This PR isn't because we need the publish functionality on macOS, but because I want to minimize forking.)


## 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 */ = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes in the project file are because RunnerTests was a folder rather than a group, but the folder doesn't actually exist (since the tests are in the darwin/ shared directory instead) which was causing issues in the Xcode UI.

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