Skip to content

Commit 09a373f

Browse files
authored
[video_player_avfoundation] Adds Swift Package Manager compatibility (flutter#6675)
Makes `video_player_avfoundation` available as a Swift Package to Flutter. Also, remains compatible with CocoaPods. Fixes flutter#146921. Redo of flutter/packages#6634.
1 parent 0167b51 commit 09a373f

File tree

27 files changed

+174
-17
lines changed

27 files changed

+174
-17
lines changed

packages/video_player/video_player_avfoundation/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.6.0
2+
3+
* Adds Swift Package Manager compatibility.
4+
15
## 2.5.7
26

37
* Adds frame availability checks on iOS.

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation.podspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Downloaded by pub (not CocoaPods).
1414
s.author = { 'Flutter Dev Team' => '[email protected]' }
1515
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation' }
1616
s.documentation_url = 'https://pub.dev/packages/video_player'
17-
s.source_files = 'Classes/*'
18-
s.ios.source_files = 'Classes/ios/*'
19-
s.osx.source_files = 'Classes/macos/*'
20-
s.public_header_files = 'Classes/**/*.h'
17+
s.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation/**/*.{h,m}'
18+
s.ios.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation_ios/*'
19+
s.osx.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation_macos/*'
20+
s.public_header_files = 'video_player_avfoundation/Sources/video_player_avfoundation/include/**/*.h'
2121
s.ios.dependency 'Flutter'
2222
s.osx.dependency 'FlutterMacOS'
2323
s.ios.deployment_target = '12.0'
2424
s.osx.deployment_target = '10.14'
2525
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
26-
s.resource_bundles = {'video_player_avfoundation_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
26+
s.resource_bundles = {'video_player_avfoundation_privacy' => ['video_player_avfoundation/Sources/video_player_avfoundation/Resources/PrivacyInfo.xcprivacy']}
2727
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// swift-tools-version: 5.9
2+
3+
// Copyright 2013 The Flutter Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style license that can be
5+
// found in the LICENSE file.
6+
7+
import PackageDescription
8+
9+
let package = Package(
10+
name: "video_player_avfoundation",
11+
platforms: [
12+
.iOS("12.0"),
13+
.macOS("10.14"),
14+
],
15+
products: [
16+
.library(name: "video-player-avfoundation", targets: ["video_player_avfoundation"])
17+
],
18+
dependencies: [],
19+
targets: [
20+
.target(
21+
name: "video_player_avfoundation",
22+
dependencies: [
23+
.target(name: "video_player_avfoundation_ios", condition: .when(platforms: [.iOS])),
24+
.target(name: "video_player_avfoundation_macos", condition: .when(platforms: [.macOS])),
25+
],
26+
resources: [
27+
.process("Resources")
28+
],
29+
cSettings: [
30+
.headerSearchPath("include/video_player_avfoundation")
31+
]
32+
),
33+
.target(
34+
name: "video_player_avfoundation_ios",
35+
cSettings: [
36+
.headerSearchPath("../video_player_avfoundation/include/video_player_avfoundation")
37+
]
38+
),
39+
.target(
40+
name: "video_player_avfoundation_macos",
41+
cSettings: [
42+
.headerSearchPath("../video_player_avfoundation/include/video_player_avfoundation")
43+
]
44+
),
45+
]
46+
)

packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m renamed to packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayerPlugin.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#import <AVFoundation/AVFoundation.h>
99
#import <GLKit/GLKit.h>
1010

11-
#import "AVAssetTrackUtils.h"
12-
#import "FVPDisplayLink.h"
13-
#import "messages.g.h"
11+
#import "./include/video_player_avfoundation/AVAssetTrackUtils.h"
12+
#import "./include/video_player_avfoundation/FVPDisplayLink.h"
13+
#import "./include/video_player_avfoundation/messages.g.h"
1414

1515
#if !__has_feature(objc_arc)
1616
#error Code Requires ARC.

packages/video_player/video_player_avfoundation/darwin/Classes/messages.g.m renamed to packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Autogenerated from Pigeon (v18.0.0), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66

7-
#import "messages.g.h"
7+
#import "./include/video_player_avfoundation/messages.g.h"
88

99
#if TARGET_OS_OSX
1010
#import <FlutterMacOS/FlutterMacOS.h>

packages/video_player/video_player_avfoundation/darwin/Classes/ios/FVPDisplayLink.m renamed to packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/FVPDisplayLink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import "../FVPDisplayLink.h"
5+
#import "../video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h"
66

77
#import <Foundation/Foundation.h>
88
#import <QuartzCore/QuartzCore.h>

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_ios/include/.gitkeep

Whitespace-only changes.

packages/video_player/video_player_avfoundation/darwin/Classes/macos/FVPDisplayLink.m renamed to packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/FVPDisplayLink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import "../FVPDisplayLink.h"
5+
#import "../video_player_avfoundation/include/video_player_avfoundation/FVPDisplayLink.h"
66

77
#import <CoreVideo/CoreVideo.h>
88
#import <Foundation/Foundation.h>

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation_macos/include/.gitkeep

Whitespace-only changes.

packages/video_player/video_player_avfoundation/example/ios/Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3232
target 'RunnerTests' do
3333
inherit! :search_paths
34-
pod 'OCMock', '3.9.1'
3534
end
3635
end
3736

packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12+
78CF8D742BC5CEA80051231B /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 78CF8D732BC5CEA80051231B /* OCMock */; };
1213
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1314
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
1415
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -99,6 +100,7 @@
99100
isa = PBXFrameworksBuildPhase;
100101
buildActionMask = 2147483647;
101102
files = (
103+
78CF8D742BC5CEA80051231B /* OCMock in Frameworks */,
102104
D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */,
103105
);
104106
runOnlyForDeploymentPostprocessing = 0;
@@ -260,6 +262,9 @@
260262
F7151F4026603ECA0028CB91 /* PBXTargetDependency */,
261263
);
262264
name = RunnerTests;
265+
packageProductDependencies = (
266+
78CF8D732BC5CEA80051231B /* OCMock */,
267+
);
263268
productName = RunnerTests;
264269
productReference = F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */;
265270
productType = "com.apple.product-type.bundle.unit-test";
@@ -297,6 +302,9 @@
297302
Base,
298303
);
299304
mainGroup = 97C146E51CF9000F007C117D;
305+
packageReferences = (
306+
78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */,
307+
);
300308
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
301309
projectDirPath = "";
302310
projectRoot = "";
@@ -758,6 +766,25 @@
758766
defaultConfigurationName = Release;
759767
};
760768
/* End XCConfigurationList section */
769+
770+
/* Begin XCRemoteSwiftPackageReference section */
771+
78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */ = {
772+
isa = XCRemoteSwiftPackageReference;
773+
repositoryURL = "https://github.com/erikdoe/ocmock";
774+
requirement = {
775+
kind = revision;
776+
revision = ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a;
777+
};
778+
};
779+
/* End XCRemoteSwiftPackageReference section */
780+
781+
/* Begin XCSwiftPackageProductDependency section */
782+
78CF8D732BC5CEA80051231B /* OCMock */ = {
783+
isa = XCSwiftPackageProductDependency;
784+
package = 78CF8D722BC5CEA80051231B /* XCRemoteSwiftPackageReference "ocmock" */;
785+
productName = OCMock;
786+
};
787+
/* End XCSwiftPackageProductDependency section */
761788
};
762789
rootObject = 97C146E61CF9000F007C117D /* Project object */;
763790
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "ocmock",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/erikdoe/ocmock",
7+
"state" : {
8+
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
9+
}
10+
}
11+
],
12+
"version" : 2
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "ocmock",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/erikdoe/ocmock",
7+
"state" : {
8+
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
9+
}
10+
}
11+
],
12+
"version" : 2
13+
}

packages/video_player/video_player_avfoundation/example/macos/Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ target 'Runner' do
3333
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
3434
target 'RunnerTests' do
3535
inherit! :search_paths
36-
pod 'OCMock', '3.9.1'
3736
end
3837
end
3938

packages/video_player/video_player_avfoundation/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
2929
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
3030
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
31+
78CF8D772BC5D0140051231B /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 78CF8D762BC5D0140051231B /* OCMock */; };
3132
C000184E56E3386C22EF683A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC60543320154AF9A465D416 /* Pods_Runner.framework */; };
3233
/* End PBXBuildFile section */
3334

@@ -95,6 +96,7 @@
9596
isa = PBXFrameworksBuildPhase;
9697
buildActionMask = 2147483647;
9798
files = (
99+
78CF8D772BC5D0140051231B /* OCMock in Frameworks */,
98100
18AD5E2A5B24DAFCF3749529 /* Pods_RunnerTests.framework in Frameworks */,
99101
);
100102
runOnlyForDeploymentPostprocessing = 0;
@@ -226,6 +228,9 @@
226228
331C80DA294CF71000263BE5 /* PBXTargetDependency */,
227229
);
228230
name = RunnerTests;
231+
packageProductDependencies = (
232+
78CF8D762BC5D0140051231B /* OCMock */,
233+
);
229234
productName = RunnerTests;
230235
productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */;
231236
productType = "com.apple.product-type.bundle.unit-test";
@@ -292,6 +297,9 @@
292297
Base,
293298
);
294299
mainGroup = 33CC10E42044A3C60003C045;
300+
packageReferences = (
301+
78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */,
302+
);
295303
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
296304
projectDirPath = "";
297305
projectRoot = "";
@@ -808,6 +816,25 @@
808816
defaultConfigurationName = Release;
809817
};
810818
/* End XCConfigurationList section */
819+
820+
/* Begin XCRemoteSwiftPackageReference section */
821+
78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */ = {
822+
isa = XCRemoteSwiftPackageReference;
823+
repositoryURL = "https://github.com/erikdoe/ocmock";
824+
requirement = {
825+
kind = revision;
826+
revision = ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a;
827+
};
828+
};
829+
/* End XCRemoteSwiftPackageReference section */
830+
831+
/* Begin XCSwiftPackageProductDependency section */
832+
78CF8D762BC5D0140051231B /* OCMock */ = {
833+
isa = XCSwiftPackageProductDependency;
834+
package = 78CF8D752BC5D0140051231B /* XCRemoteSwiftPackageReference "ocmock" */;
835+
productName = OCMock;
836+
};
837+
/* End XCSwiftPackageProductDependency section */
811838
};
812839
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
813840
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "ocmock",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/erikdoe/ocmock",
7+
"state" : {
8+
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
9+
}
10+
}
11+
],
12+
"version" : 2
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"pins" : [
3+
{
4+
"identity" : "ocmock",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/erikdoe/ocmock",
7+
"state" : {
8+
"revision" : "ef21a2ece3ee092f8ed175417718bdd9b8eb7c9a"
9+
}
10+
}
11+
],
12+
"version" : 2
13+
}

packages/video_player/video_player_avfoundation/example/macos/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Cocoa
66
import FlutterMacOS
77

8-
@NSApplicationMain
8+
@main
99
class AppDelegate: FlutterAppDelegate {
1010
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
1111
return true

packages/video_player/video_player_avfoundation/pigeons/messages.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import 'package:pigeon/pigeon.dart';
77
@ConfigurePigeon(PigeonOptions(
88
dartOut: 'lib/src/messages.g.dart',
99
dartTestOut: 'test/test_api.g.dart',
10-
objcHeaderOut: 'darwin/Classes/messages.g.h',
11-
objcSourceOut: 'darwin/Classes/messages.g.m',
10+
objcHeaderOut:
11+
'darwin/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/messages.g.h',
12+
objcSourceOut:
13+
'darwin/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m',
1214
objcOptions: ObjcOptions(
1315
prefix: 'FVP',
16+
headerIncludePath: './include/video_player_avfoundation/messages.g.h',
1417
),
1518
copyrightHeader: 'pigeons/copyright.txt',
1619
))

packages/video_player/video_player_avfoundation/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: video_player_avfoundation
22
description: iOS and macOS implementation of the video_player plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
5-
version: 2.5.7
5+
version: 2.6.0
66

77
environment:
88
sdk: ^3.2.3

0 commit comments

Comments
 (0)