@capgo/capacitor-video-player 8.1.7 → 8.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapgoCapacitorVideoPlayer.podspec +1 -0
- package/Package.swift +4 -2
- package/README.md +99 -27
- package/android/src/main/java/com/capgo/videoplayer/FullscreenExoPlayerFragment.java +286 -32
- package/android/src/main/java/com/capgo/videoplayer/VideoPlayerPlugin.java +1 -1
- package/dist/docs.json +4 -4
- package/dist/esm/definitions.d.ts +5 -4
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/VideoPlayerPlugin/FullscreenVideoPlayer.swift +100 -4
- package/ios/Sources/VideoPlayerPlugin/VideoPlayerCastController.swift +693 -0
- package/ios/Sources/VideoPlayerPlugin/VideoPlayerPlugin.swift +39 -27
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import AVKit
|
|
|
8
8
|
*/
|
|
9
9
|
@objc(VideoPlayerPlugin)
|
|
10
10
|
public class VideoPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
11
|
-
private let pluginVersion: String = "8.1.
|
|
11
|
+
private let pluginVersion: String = "8.1.9"
|
|
12
12
|
public let identifier = "VideoPlayerPlugin"
|
|
13
13
|
public let jsName = "VideoPlayer"
|
|
14
14
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -38,7 +38,9 @@ public class VideoPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
38
38
|
@objc func getPluginVersion(_ call: CAPPluginCall) {
|
|
39
39
|
call.resolve(["version": self.pluginVersion])
|
|
40
40
|
}
|
|
41
|
+
}
|
|
41
42
|
|
|
43
|
+
extension VideoPlayerPlugin {
|
|
42
44
|
@objc func initPlayer(_ call: CAPPluginCall) {
|
|
43
45
|
guard let playerId = call.getString("playerId") else {
|
|
44
46
|
call.resolve([
|
|
@@ -73,6 +75,10 @@ public class VideoPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
73
75
|
let loopOnEnd = call.getBool("loopOnEnd") ?? false
|
|
74
76
|
let pipEnabled = call.getBool("pipEnabled") ?? true
|
|
75
77
|
let showControls = call.getBool("showControls") ?? true
|
|
78
|
+
let chromecast = call.getBool("chromecast") ?? true
|
|
79
|
+
let title = call.getString("title")
|
|
80
|
+
let smallTitle = call.getString("smallTitle")
|
|
81
|
+
let artwork = call.getString("artwork")
|
|
76
82
|
|
|
77
83
|
// Extract FairPlay DRM options if provided
|
|
78
84
|
let drm = call.getObject("drm")
|
|
@@ -89,13 +95,43 @@ public class VideoPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
89
95
|
loopOnEnd: loopOnEnd,
|
|
90
96
|
pipEnabled: pipEnabled,
|
|
91
97
|
showControls: showControls,
|
|
98
|
+
chromecast: chromecast,
|
|
99
|
+
title: title,
|
|
100
|
+
smallTitle: smallTitle,
|
|
101
|
+
artwork: artwork,
|
|
92
102
|
fairplayCertificateUrl: fairplayCertificateUrl,
|
|
93
103
|
fairplayContentKeySpcUrl: fairplayContentKeySpcUrl
|
|
94
104
|
)
|
|
95
105
|
|
|
96
|
-
player
|
|
106
|
+
// Present player
|
|
107
|
+
DispatchQueue.main.async {
|
|
108
|
+
guard let viewController = self.bridge?.viewController else {
|
|
109
|
+
call.resolve([
|
|
110
|
+
"result": false,
|
|
111
|
+
"method": "initPlayer",
|
|
112
|
+
"message": "Unable to get view controller"
|
|
113
|
+
])
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
player.setupPlayer()
|
|
118
|
+
self.configureCallbacks(for: player, playerId: playerId)
|
|
119
|
+
|
|
120
|
+
// Store player
|
|
121
|
+
self.videoPlayers[playerId] = player
|
|
122
|
+
self.currentPlayerId = playerId
|
|
123
|
+
|
|
124
|
+
player.present(on: viewController) {
|
|
125
|
+
call.resolve([
|
|
126
|
+
"result": true,
|
|
127
|
+
"method": "initPlayer",
|
|
128
|
+
"value": playerId
|
|
129
|
+
])
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
97
133
|
|
|
98
|
-
|
|
134
|
+
private func configureCallbacks(for player: FullscreenVideoPlayer, playerId: String) {
|
|
99
135
|
player.setOnPlay { [weak self] in
|
|
100
136
|
self?.notifyListeners("jeepCapVideoPlayerPlay", data: [
|
|
101
137
|
"fromPlayerId": playerId,
|
|
@@ -134,30 +170,6 @@ public class VideoPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
134
170
|
"currentTime": currentTime
|
|
135
171
|
])
|
|
136
172
|
}
|
|
137
|
-
|
|
138
|
-
// Store player
|
|
139
|
-
videoPlayers[playerId] = player
|
|
140
|
-
currentPlayerId = playerId
|
|
141
|
-
|
|
142
|
-
// Present player
|
|
143
|
-
DispatchQueue.main.async {
|
|
144
|
-
guard let viewController = self.bridge?.viewController else {
|
|
145
|
-
call.resolve([
|
|
146
|
-
"result": false,
|
|
147
|
-
"method": "initPlayer",
|
|
148
|
-
"message": "Unable to get view controller"
|
|
149
|
-
])
|
|
150
|
-
return
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
player.present(on: viewController) {
|
|
154
|
-
call.resolve([
|
|
155
|
-
"result": true,
|
|
156
|
-
"method": "initPlayer",
|
|
157
|
-
"value": playerId
|
|
158
|
-
])
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
173
|
}
|
|
162
174
|
|
|
163
175
|
@objc func isPlaying(_ call: CAPPluginCall) {
|