Skip to content

Commit 09a373f

Browse files
authored
[video_player_avfoundation] Adds Swift Package Manager compatibility (#6675)
Makes `video_player_avfoundation` available as a Swift Package to Flutter. Also, remains compatible with CocoaPods. Fixes flutter/flutter#146921. Redo of #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+
)
File renamed without changes.

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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)