@capgo/capacitor-jw-player 0.0.1 → 0.0.12
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/CapgoCapacitorJwPlayer.podspec +3 -1
- package/Package.swift +12 -2
- package/README.md +19 -4
- package/android/build.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/ee/forgr/capacitor_jw_player/CastOptionsProvider.java +30 -0
- package/android/src/main/java/ee/forgr/capacitor_jw_player/JwPlayerPlugin.java +63 -59
- package/android/src/main/java/ee/forgr/capacitor_jw_player/PlayerActivity.java +72 -73
- package/dist/docs.json +6 -2
- package/dist/esm/definitions.d.ts +2 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/JwPlayerPlugin/JwPlayer.swift +4 -4
- package/ios/Sources/JwPlayerPlugin/JwPlayerPlugin.swift +218 -120
- package/ios/Sources/JwPlayerPlugin/LinkedList.swift +28 -29
- package/ios/Sources/JwPlayerPlugin/VideosToPlay.swift +4 -5
- package/package.json +5 -5
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
public class Node<Value> {
|
|
9
9
|
public var value: Value
|
|
10
10
|
public var next: Node?
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
public init(value: Value, next: Node? = nil) {
|
|
13
13
|
self.value = value
|
|
14
14
|
self.next = next
|
|
@@ -27,13 +27,13 @@ extension Node: CustomStringConvertible {
|
|
|
27
27
|
public struct LinkedList<Value> {
|
|
28
28
|
public var head: Node<Value>?
|
|
29
29
|
public var tail: Node<Value>?
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
public init() {}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
public var isEmpty: Bool {
|
|
34
34
|
head == nil
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
public mutating func push(_ value: Value) {
|
|
38
38
|
copyNodes()
|
|
39
39
|
head = Node(value: value, next: head)
|
|
@@ -41,7 +41,7 @@ public struct LinkedList<Value> {
|
|
|
41
41
|
tail = head
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
public mutating func append(_ value: Value) {
|
|
46
46
|
copyNodes()
|
|
47
47
|
guard !isEmpty else {
|
|
@@ -51,19 +51,19 @@ public struct LinkedList<Value> {
|
|
|
51
51
|
tail!.next = Node(value: value)
|
|
52
52
|
tail = tail!.next
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
public func node(at index: Int) -> Node<Value>? {
|
|
56
56
|
var currentNode = head
|
|
57
57
|
var currentIndex = 0
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
while currentNode != nil && currentIndex < index {
|
|
60
60
|
currentNode = currentNode!.next
|
|
61
61
|
currentIndex += 1
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
return currentNode
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
@discardableResult
|
|
68
68
|
public mutating func insert(_ value: Value, after node: Node<Value>) -> Node<Value> {
|
|
69
69
|
copyNodes()
|
|
@@ -74,7 +74,7 @@ public struct LinkedList<Value> {
|
|
|
74
74
|
node.next = Node(value: value, next: node.next)
|
|
75
75
|
return node.next!
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
@discardableResult
|
|
79
79
|
public mutating func pop() -> Value? {
|
|
80
80
|
copyNodes()
|
|
@@ -86,7 +86,7 @@ public struct LinkedList<Value> {
|
|
|
86
86
|
}
|
|
87
87
|
return head?.value
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
@discardableResult
|
|
91
91
|
public mutating func removeLast() -> Value? {
|
|
92
92
|
copyNodes()
|
|
@@ -106,7 +106,7 @@ public struct LinkedList<Value> {
|
|
|
106
106
|
tail = prev
|
|
107
107
|
return current.value
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
@discardableResult
|
|
111
111
|
public mutating func remove(after node: Node<Value>) -> Value? {
|
|
112
112
|
guard let node = copyNodes(returningCopyOf: node) else { return nil }
|
|
@@ -118,7 +118,7 @@ public struct LinkedList<Value> {
|
|
|
118
118
|
}
|
|
119
119
|
return node.next?.value
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
private mutating func copyNodes() {
|
|
123
123
|
guard !isKnownUniquelyReferenced(&head) else {
|
|
124
124
|
return
|
|
@@ -126,19 +126,19 @@ public struct LinkedList<Value> {
|
|
|
126
126
|
guard var oldNode = head else {
|
|
127
127
|
return
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
head = Node(value: oldNode.value)
|
|
131
131
|
var newNode = head
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
while let nextOldNode = oldNode.next {
|
|
134
134
|
newNode!.next = Node(value: nextOldNode.value)
|
|
135
135
|
newNode = newNode!.next
|
|
136
136
|
oldNode = nextOldNode
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
tail = newNode
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
private mutating func copyNodes(returningCopyOf node: Node<Value>?) -> Node<Value>? {
|
|
143
143
|
guard !isKnownUniquelyReferenced(&head) else {
|
|
144
144
|
return nil
|
|
@@ -146,11 +146,11 @@ public struct LinkedList<Value> {
|
|
|
146
146
|
guard var oldNode = head else {
|
|
147
147
|
return nil
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
head = Node(value: oldNode.value)
|
|
151
151
|
var newNode = head
|
|
152
152
|
var nodeCopy: Node<Value>?
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
while let nextOldNode = oldNode.next {
|
|
155
155
|
if oldNode === node {
|
|
156
156
|
nodeCopy = newNode
|
|
@@ -159,7 +159,7 @@ public struct LinkedList<Value> {
|
|
|
159
159
|
newNode = newNode!.next
|
|
160
160
|
oldNode = nextOldNode
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
|
|
163
163
|
return nodeCopy
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -176,8 +176,8 @@ extension LinkedList: CustomStringConvertible {
|
|
|
176
176
|
extension LinkedList: Collection {
|
|
177
177
|
public struct Index: Comparable {
|
|
178
178
|
public var node: Node<Value>?
|
|
179
|
-
|
|
180
|
-
static
|
|
179
|
+
|
|
180
|
+
public static func ==(lhs: Index, rhs: Index) -> Bool {
|
|
181
181
|
switch (lhs.node, rhs.node) {
|
|
182
182
|
case let (left?, right?):
|
|
183
183
|
return left === right
|
|
@@ -187,8 +187,8 @@ extension LinkedList: Collection {
|
|
|
187
187
|
return false
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
static
|
|
190
|
+
|
|
191
|
+
public static func <(lhs: Index, rhs: Index) -> Bool {
|
|
192
192
|
guard lhs != rhs else {
|
|
193
193
|
return false
|
|
194
194
|
}
|
|
@@ -199,21 +199,20 @@ extension LinkedList: Collection {
|
|
|
199
199
|
return nodes.contains { $0 === rhs.node }
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
public var startIndex: Index {
|
|
204
204
|
Index(node: head)
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
public var endIndex: Index {
|
|
208
208
|
Index(node: nil)
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
|
|
211
211
|
public func index(after i: Index) -> Index {
|
|
212
212
|
Index(node: i.node?.next)
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
|
|
215
215
|
public subscript(position: Index) -> Value {
|
|
216
216
|
position.node!.value
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
|
|
@@ -22,7 +22,7 @@ public class MediaNode: Node<MediaNodeType> {
|
|
|
22
22
|
public var nodeType: MediaNodeType {
|
|
23
23
|
return value
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
/// Whether this node is a playlist
|
|
27
27
|
public var isPlaylist: Bool {
|
|
28
28
|
switch value {
|
|
@@ -32,7 +32,7 @@ public class MediaNode: Node<MediaNodeType> {
|
|
|
32
32
|
return false
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
/// Whether this node is a video
|
|
37
37
|
public var isVideo: Bool {
|
|
38
38
|
switch value {
|
|
@@ -42,15 +42,14 @@ public class MediaNode: Node<MediaNodeType> {
|
|
|
42
42
|
return false
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
/// Create a new playlist node
|
|
47
47
|
public static func createPlaylist(playlistUrl: URL) -> MediaNode {
|
|
48
48
|
return MediaNode(value: .playlist(loadedUrls: [], isLoaded: false, playlistUrl: playlistUrl))
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
/// Create a new video node
|
|
52
52
|
public static func createVideo(url: URL) -> MediaNode {
|
|
53
53
|
return MediaNode(value: .video(url: url))
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-jw-player",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Playes videos from jwplayer.com",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"prepublishOnly": "npm run build"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@capacitor/android": "^7.
|
|
50
|
-
"@capacitor/core": "^7.
|
|
49
|
+
"@capacitor/android": "^7.2.0",
|
|
50
|
+
"@capacitor/core": "^7.2.0",
|
|
51
51
|
"@capacitor/docgen": "^0.3.0",
|
|
52
|
-
"@capacitor/ios": "^7.
|
|
52
|
+
"@capacitor/ios": "^7.2.0",
|
|
53
53
|
"@ionic/eslint-config": "^0.4.0",
|
|
54
54
|
"@ionic/prettier-config": "^4.0.0",
|
|
55
55
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "~4.1.5"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@capacitor/core": ">=7.
|
|
65
|
+
"@capacitor/core": ">=7.2.0"
|
|
66
66
|
},
|
|
67
67
|
"prettier": "@ionic/prettier-config",
|
|
68
68
|
"swiftlint": "@ionic/swiftlint-config",
|