diff --git a/packages/video_player/video_player_avfoundation/CHANGELOG.md b/packages/video_player/video_player_avfoundation/CHANGELOG.md
index 19088a884fae..47dcf8c7cccb 100644
--- a/packages/video_player/video_player_avfoundation/CHANGELOG.md
+++ b/packages/video_player/video_player_avfoundation/CHANGELOG.md
@@ -1,5 +1,10 @@
## NEXT
+* Adds Swift Package Manager support (`ios/video_player_avfoundation/Package.swift`).
+ The native sources moved from `ios/Classes` to
+ `ios/video_player_avfoundation/Sources/video_player_avfoundation`.
+* Raises the minimum iOS version to 13.0 and the minimum Flutter version to 3.41.0
+ (the first version that provides the `FlutterFramework` Swift package).
* Fixes violations of new analysis option use_named_constants.
* Fixes avoid_redundant_argument_values lint warnings and minor typos.
* Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/106316).
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist b/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist
index 3a9c234f96d4..6fe4034356ac 100644
--- a/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist
@@ -24,7 +24,5 @@
arm64
- MinimumOSVersion
- 9.0
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj
index 6069bf313e8e..3d00941daab3 100644
--- a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 46;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -18,6 +18,7 @@
D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD232FD3BD3343A5F52AF50 /* libPods-RunnerTests.a */; };
F7151F2F26603EBD0028CB91 /* VideoPlayerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */; };
F7151F3D26603ECA0028CB91 /* VideoPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */; };
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -77,6 +78,9 @@
F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerTests.m; sourceTree = ""; };
F7151F3E26603ECA0028CB91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; };
+ 784666492D4C4C64000A1A5F /* FlutterFramework */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterFramework; path = Flutter/ephemeral/Packages/.packages/FlutterFramework; sourceTree = ""; };
+ 78DABEA22ED26510000E7860 /* video_player_avfoundation */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = video_player_avfoundation; path = ../../ios/video_player_avfoundation; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -84,6 +88,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
B0F5C77B94E32FB72444AE9F /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -129,6 +134,9 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
+ 78DABEA22ED26510000E7860 /* video_player_avfoundation */,
+ 784666492D4C4C64000A1A5F /* FlutterFramework */,
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -206,6 +214,9 @@
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
+ packageProductDependencies = (
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
+ );
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
@@ -267,9 +278,12 @@
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
+ packageReferences = (
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
+ );
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1320;
+ LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -338,10 +352,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -352,6 +368,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -516,7 +533,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -566,7 +583,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -712,6 +729,18 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
+/* Begin XCLocalSwiftPackageReference section */
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
+ isa = XCLocalSwiftPackageReference;
+ relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCLocalSwiftPackageReference section */
+/* Begin XCSwiftPackageProductDependency section */
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
+ isa = XCSwiftPackageProductDependency;
+ productName = FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index c5858c80e959..6ef3fa75e7f3 100644
--- a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,10 +1,28 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart
index dc2034129d4a..68c1d9dfa23e 100644
--- a/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart
+++ b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart
@@ -315,6 +315,9 @@ class MiniController extends ValueNotifier {
case VideoEventType.isPlayingStateUpdate:
value = value.copyWith(isPlaying: event.isPlaying ?? false);
break;
+ case VideoEventType.playbackIntentUpdate:
+ // Not used by this example.
+ break;
case VideoEventType.unknown:
break;
}
diff --git a/packages/video_player/video_player_avfoundation/example/pubspec.yaml b/packages/video_player/video_player_avfoundation/example/pubspec.yaml
index a52d9fb1147b..4f71552bee02 100644
--- a/packages/video_player/video_player_avfoundation/example/pubspec.yaml
+++ b/packages/video_player/video_player_avfoundation/example/pubspec.yaml
@@ -3,8 +3,8 @@ description: Demonstrates how to use the video_player plugin.
publish_to: none
environment:
- sdk: ">=2.12.0 <3.0.0"
- flutter: ">=2.8.0"
+ sdk: ^3.12.0
+ flutter: ">=3.44.0"
dependencies:
flutter:
@@ -33,6 +33,8 @@ dev_dependencies:
test: any
flutter:
+ config:
+ enable-swift-package-manager: true
uses-material-design: true
assets:
- assets/flutter-mark-square-64.png
diff --git a/packages/video_player/video_player_avfoundation/ios/Assets/.gitkeep b/packages/video_player/video_player_avfoundation/ios/Assets/.gitkeep
deleted file mode 100644
index e69de29bb2d1..000000000000
diff --git a/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
index ff1df5f0ec42..03356b73ab69 100644
--- a/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
+++ b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
@@ -14,11 +14,11 @@ Downloaded by pub (not CocoaPods).
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/plugins/tree/main/packages/video_player/video_player_avfoundation' }
s.documentation_url = 'https://pub.dev/packages/video_player'
- s.source_files = 'Classes/**/*'
- s.public_header_files = 'Classes/**/*.h'
+ s.source_files = 'video_player_avfoundation/Sources/video_player_avfoundation/**/*.{h,m}'
+ s.public_header_files = 'video_player_avfoundation/Sources/video_player_avfoundation/include/**/*.h'
s.dependency 'Flutter'
- s.platform = :ios, '9.0'
+ s.platform = :ios, '13.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
- s.resource_bundles = {'video_player_avfoundation_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
+ s.resource_bundles = {'video_player_avfoundation_privacy' => ['video_player_avfoundation/Sources/video_player_avfoundation/Resources/PrivacyInfo.xcprivacy']}
end
diff --git a/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Package.swift b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Package.swift
new file mode 100644
index 000000000000..dd12df274414
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Package.swift
@@ -0,0 +1,33 @@
+// swift-tools-version: 5.9
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let package = Package(
+ name: "video_player_avfoundation",
+ platforms: [
+ .iOS("13.0")
+ ],
+ products: [
+ .library(name: "video-player-avfoundation", targets: ["video_player_avfoundation"])
+ ],
+ dependencies: [
+ .package(name: "FlutterFramework", path: "../FlutterFramework")
+ ],
+ targets: [
+ .target(
+ name: "video_player_avfoundation",
+ dependencies: [
+ .product(name: "FlutterFramework", package: "FlutterFramework")
+ ],
+ resources: [
+ .process("Resources")
+ ],
+ cSettings: [
+ // Lets code regenerated by Pigeon (which imports "messages.g.h" by
+ // file name) resolve its header.
+ .headerSearchPath("include/video_player_avfoundation")
+ ]
+ )
+ ]
+)
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/AVAssetTrackUtils.m b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/AVAssetTrackUtils.m
similarity index 100%
rename from packages/video_player/video_player_avfoundation/ios/Classes/AVAssetTrackUtils.m
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/AVAssetTrackUtils.m
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/FLTVideoPlayerPlugin.m
similarity index 99%
rename from packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/FLTVideoPlayerPlugin.m
index 35144df5262b..e7399e9b8fe7 100644
--- a/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
+++ b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/FLTVideoPlayerPlugin.m
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "FLTVideoPlayerPlugin.h"
+#import "./include/video_player_avfoundation/FLTVideoPlayerPlugin.h"
#import
#import
#import
-#import "AVAssetTrackUtils.h"
-#import "messages.g.h"
+#import "./include/video_player_avfoundation/AVAssetTrackUtils.h"
+#import "./include/video_player_avfoundation/messages.g.h"
#if !__has_feature(objc_arc)
#error Code Requires ARC.
diff --git a/packages/video_player/video_player_avfoundation/ios/Resources/PrivacyInfo.xcprivacy b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/Resources/PrivacyInfo.xcprivacy
similarity index 100%
rename from packages/video_player/video_player_avfoundation/ios/Resources/PrivacyInfo.xcprivacy
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/Resources/PrivacyInfo.xcprivacy
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/AVAssetTrackUtils.h b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/AVAssetTrackUtils.h
similarity index 100%
rename from packages/video_player/video_player_avfoundation/ios/Classes/AVAssetTrackUtils.h
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/AVAssetTrackUtils.h
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.h b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FLTVideoPlayerPlugin.h
similarity index 100%
rename from packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.h
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/FLTVideoPlayerPlugin.h
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/messages.g.h b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/messages.g.h
similarity index 100%
rename from packages/video_player/video_player_avfoundation/ios/Classes/messages.g.h
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/messages.g.h
diff --git a/packages/video_player/video_player_avfoundation/ios/Classes/messages.g.m b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m
similarity index 99%
rename from packages/video_player/video_player_avfoundation/ios/Classes/messages.g.m
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m
index 664f7ecfe55a..225a7f1ced15 100644
--- a/packages/video_player/video_player_avfoundation/ios/Classes/messages.g.m
+++ b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Autogenerated from Pigeon (v2.0.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon
-#import "messages.g.h"
+#import "./include/video_player_avfoundation/messages.g.h"
#import
#if !__has_feature(objc_arc)
diff --git a/packages/video_player/video_player_avfoundation/pigeons/messages.dart b/packages/video_player/video_player_avfoundation/pigeons/messages.dart
index 54c6eb7631f8..9b207f89807a 100644
--- a/packages/video_player/video_player_avfoundation/pigeons/messages.dart
+++ b/packages/video_player/video_player_avfoundation/pigeons/messages.dart
@@ -7,8 +7,10 @@ import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/messages.g.dart',
dartTestOut: 'test/test_api.dart',
- objcHeaderOut: 'ios/Classes/messages.g.h',
- objcSourceOut: 'ios/Classes/messages.g.m',
+ objcHeaderOut:
+ 'ios/video_player_avfoundation/Sources/video_player_avfoundation/include/video_player_avfoundation/messages.g.h',
+ objcSourceOut:
+ 'ios/video_player_avfoundation/Sources/video_player_avfoundation/messages.g.m',
objcOptions: ObjcOptions(
prefix: 'FLT',
),
diff --git a/packages/video_player/video_player_avfoundation/pubspec.yaml b/packages/video_player/video_player_avfoundation/pubspec.yaml
index c00f4baa1f0a..b6d3fc99d4b7 100644
--- a/packages/video_player/video_player_avfoundation/pubspec.yaml
+++ b/packages/video_player/video_player_avfoundation/pubspec.yaml
@@ -5,8 +5,8 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+
version: 2.3.5
environment:
- sdk: ">=2.14.0 <3.0.0"
- flutter: ">=2.8.0"
+ sdk: ^3.11.0
+ flutter: ">=3.41.0"
flutter:
plugin: