@capgo/capacitor-jw-player 8.0.32 → 8.0.33
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.
|
@@ -22,7 +22,7 @@ import java.util.List;
|
|
|
22
22
|
@CapacitorPlugin(name = "JwPlayer")
|
|
23
23
|
public class JwPlayerPlugin extends Plugin {
|
|
24
24
|
|
|
25
|
-
private final String pluginVersion = "8.0.
|
|
25
|
+
private final String pluginVersion = "8.0.33";
|
|
26
26
|
|
|
27
27
|
private static final String TAG = "JwPlayerPlugin";
|
|
28
28
|
// Static reference to the plugin instance for activity communication
|
|
@@ -16,7 +16,7 @@ protocol CallbackHandler {
|
|
|
16
16
|
|
|
17
17
|
@objc(JwPlayerPlugin)
|
|
18
18
|
public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
19
|
-
private let pluginVersion: String = "8.0.
|
|
19
|
+
private let pluginVersion: String = "8.0.33"
|
|
20
20
|
// public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin, GCKLoggerDelegate {
|
|
21
21
|
public let identifier = "JwPlayerPlugin"
|
|
22
22
|
public let jsName = "JwPlayer"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-jw-player",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.33",
|
|
4
4
|
"description": "Playes videos from jwplayer.com",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"ios/Sources",
|
|
14
14
|
"ios/Tests",
|
|
15
15
|
"Package.swift",
|
|
16
|
-
"CapgoCapacitorJwPlayer.podspec"
|
|
16
|
+
"CapgoCapacitorJwPlayer.podspec",
|
|
17
|
+
"scripts/configure-ios-dsyms.js"
|
|
17
18
|
],
|
|
18
19
|
"author": "Martin Donadieu <martin@capgo.app>",
|
|
19
20
|
"license": "MPL-2.0",
|
|
@@ -31,6 +32,8 @@
|
|
|
31
32
|
"native"
|
|
32
33
|
],
|
|
33
34
|
"scripts": {
|
|
35
|
+
"capacitor:sync:after": "node scripts/configure-ios-dsyms.js",
|
|
36
|
+
"capacitor:update:after": "node scripts/configure-ios-dsyms.js",
|
|
34
37
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
35
38
|
"verify:ios": "xcodebuild -scheme CapgoCapacitorJwPlayer -destination generic/platform=iOS",
|
|
36
39
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const pluginName = 'CapgoCapacitorJwPlayer';
|
|
8
|
+
const frameworkNames = ['JWPlayerKit', 'GoogleCast'];
|
|
9
|
+
const phaseName = 'Capgo dSYMs for JWPlayerKit and GoogleCast';
|
|
10
|
+
|
|
11
|
+
function log(message) {
|
|
12
|
+
console.log(`[${pluginName}] ${message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function warn(message) {
|
|
16
|
+
console.warn(`[${pluginName}] ${message}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function exists(filePath) {
|
|
20
|
+
return fs.existsSync(filePath);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function hasApplicationTarget(projectFile) {
|
|
24
|
+
try {
|
|
25
|
+
return fs.readFileSync(projectFile, 'utf8').includes('productType = "com.apple.product-type.application";');
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function stablePbxId(seed) {
|
|
32
|
+
return crypto.createHash('sha1').update(seed).digest('hex').slice(0, 24).toUpperCase();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function escapeRegExp(value) {
|
|
36
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function findExistingPhaseId(content) {
|
|
40
|
+
const pattern = new RegExp(
|
|
41
|
+
`([A-F0-9]{24}) /\\* ${escapeRegExp(phaseName)} \\*/ = \\{[\\s\\S]*?isa = PBXShellScriptBuildPhase;`,
|
|
42
|
+
'm',
|
|
43
|
+
);
|
|
44
|
+
return pattern.exec(content)?.[1] || '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function findProjectFile(rootDir) {
|
|
48
|
+
const preferred = path.join(rootDir, 'ios', 'App', 'App.xcodeproj', 'project.pbxproj');
|
|
49
|
+
if (exists(preferred)) {
|
|
50
|
+
return preferred;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const iosDir = path.join(rootDir, 'ios');
|
|
54
|
+
if (!exists(iosDir)) {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const stack = [iosDir];
|
|
59
|
+
while (stack.length) {
|
|
60
|
+
const current = stack.pop();
|
|
61
|
+
const entries = fs.readdirSync(current, { withFileTypes: true });
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
if (entry.name === 'Pods') {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const entryPath = path.join(current, entry.name);
|
|
68
|
+
if (entry.isDirectory() && entry.name.endsWith('.xcodeproj')) {
|
|
69
|
+
if (entry.name === 'Pods.xcodeproj') {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const pbxproj = path.join(entryPath, 'project.pbxproj');
|
|
74
|
+
if (exists(pbxproj) && hasApplicationTarget(pbxproj)) {
|
|
75
|
+
return pbxproj;
|
|
76
|
+
}
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (entry.isDirectory()) {
|
|
80
|
+
stack.push(entryPath);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function shellScript() {
|
|
89
|
+
return [
|
|
90
|
+
'set -u',
|
|
91
|
+
'',
|
|
92
|
+
'if [ "${ACTION:-}" != "install" ]; then',
|
|
93
|
+
' exit 0',
|
|
94
|
+
'fi',
|
|
95
|
+
'',
|
|
96
|
+
`log() { echo "[${pluginName} dSYMs] $1"; }`,
|
|
97
|
+
'',
|
|
98
|
+
'if [ -z "${DWARF_DSYM_FOLDER_PATH:-}" ]; then',
|
|
99
|
+
' log "Skipping because DWARF_DSYM_FOLDER_PATH is not set."',
|
|
100
|
+
' exit 0',
|
|
101
|
+
'fi',
|
|
102
|
+
'',
|
|
103
|
+
'find_dsym_roots() {',
|
|
104
|
+
' for root in \\',
|
|
105
|
+
' "${PODS_ROOT:-}" \\',
|
|
106
|
+
' "${SRCROOT:-}" \\',
|
|
107
|
+
' "${PROJECT_DIR:-}" \\',
|
|
108
|
+
' "${BUILD_DIR:-}/../../../../../SourcePackages/artifacts" \\',
|
|
109
|
+
' "${BUILD_DIR:-}/../../SourcePackages/artifacts" \\',
|
|
110
|
+
' "${BUILD_DIR:-}/../SourcePackages/artifacts" \\',
|
|
111
|
+
' "${HOME:-}/Library/Developer/Xcode/DerivedData"',
|
|
112
|
+
' do',
|
|
113
|
+
' [ -d "$root" ] || continue',
|
|
114
|
+
' printf "%s\\n" "$root"',
|
|
115
|
+
' done',
|
|
116
|
+
'}',
|
|
117
|
+
'',
|
|
118
|
+
'find_framework_binary_in_roots() {',
|
|
119
|
+
' framework="$1"',
|
|
120
|
+
' old_ifs="$IFS"',
|
|
121
|
+
" IFS='",
|
|
122
|
+
"'",
|
|
123
|
+
' for root in $(find_dsym_roots); do',
|
|
124
|
+
' for binary in $(find "$root" -type f -path "*/$framework.framework/$framework" 2>/dev/null); do',
|
|
125
|
+
' case "$binary" in',
|
|
126
|
+
' *simulator*|*Simulator*) continue ;;',
|
|
127
|
+
' esac',
|
|
128
|
+
' if [ -f "$binary" ]; then',
|
|
129
|
+
' printf "%s\\n" "$binary"',
|
|
130
|
+
' IFS="$old_ifs"',
|
|
131
|
+
' return 0',
|
|
132
|
+
' fi',
|
|
133
|
+
' done',
|
|
134
|
+
' done',
|
|
135
|
+
' IFS="$old_ifs"',
|
|
136
|
+
' return 1',
|
|
137
|
+
'}',
|
|
138
|
+
'',
|
|
139
|
+
'find_framework_binary() {',
|
|
140
|
+
' framework="$1"',
|
|
141
|
+
' for dir in \\',
|
|
142
|
+
' "${TARGET_BUILD_DIR:-}/${FRAMEWORKS_FOLDER_PATH:-}" \\',
|
|
143
|
+
' "${BUILT_PRODUCTS_DIR:-}/${FRAMEWORKS_FOLDER_PATH:-}" \\',
|
|
144
|
+
' "${TARGET_BUILD_DIR:-}/${WRAPPER_NAME:-}/Frameworks" \\',
|
|
145
|
+
' "${BUILT_PRODUCTS_DIR:-}/${WRAPPER_NAME:-}/Frameworks" \\',
|
|
146
|
+
' "${TARGET_BUILD_DIR:-}/Frameworks" \\',
|
|
147
|
+
' "${BUILT_PRODUCTS_DIR:-}/Frameworks"',
|
|
148
|
+
' do',
|
|
149
|
+
' [ -n "$dir" ] || continue',
|
|
150
|
+
' binary="$dir/$framework.framework/$framework"',
|
|
151
|
+
' if [ -f "$binary" ]; then',
|
|
152
|
+
' printf "%s\\n" "$binary"',
|
|
153
|
+
' return 0',
|
|
154
|
+
' fi',
|
|
155
|
+
' done',
|
|
156
|
+
' find_framework_binary_in_roots "$framework"',
|
|
157
|
+
'}',
|
|
158
|
+
'',
|
|
159
|
+
'copy_prebuilt_dsym() {',
|
|
160
|
+
' framework="$1"',
|
|
161
|
+
' dsym_path="$2"',
|
|
162
|
+
' binary="$3"',
|
|
163
|
+
' binary_uuid="$(dwarfdump --uuid "$binary" 2>/dev/null | awk \'NR == 1 {print $2}\')"',
|
|
164
|
+
' [ -n "$binary_uuid" ] || return 1',
|
|
165
|
+
'',
|
|
166
|
+
' old_ifs="$IFS"',
|
|
167
|
+
" IFS='",
|
|
168
|
+
"'",
|
|
169
|
+
' for root in $(find_dsym_roots); do',
|
|
170
|
+
' for candidate in $(find "$root" -type d -name "$framework.framework.dSYM" 2>/dev/null); do',
|
|
171
|
+
' if dwarfdump --uuid "$candidate" 2>/dev/null | awk \'{print $2}\' | grep -qi "^$binary_uuid$"; then',
|
|
172
|
+
' rm -rf "$dsym_path"',
|
|
173
|
+
' cp -R "$candidate" "$dsym_path"',
|
|
174
|
+
' IFS="$old_ifs"',
|
|
175
|
+
' log "Copied vendor $framework.framework.dSYM."',
|
|
176
|
+
' return 0',
|
|
177
|
+
' fi',
|
|
178
|
+
' done',
|
|
179
|
+
' done',
|
|
180
|
+
' IFS="$old_ifs"',
|
|
181
|
+
' return 1',
|
|
182
|
+
'}',
|
|
183
|
+
'',
|
|
184
|
+
'copy_to_archive() {',
|
|
185
|
+
' dsym_path="$1"',
|
|
186
|
+
' framework="$2"',
|
|
187
|
+
' for archive_dsyms in "${ARCHIVE_DSYMS_PATH:-}" "${ARCHIVE_PATH:-}/dSYMs"; do',
|
|
188
|
+
' case "$archive_dsyms" in',
|
|
189
|
+
' ""|"/dSYMs") continue ;;',
|
|
190
|
+
' esac',
|
|
191
|
+
' mkdir -p "$archive_dsyms"',
|
|
192
|
+
' rm -rf "$archive_dsyms/$framework.framework.dSYM"',
|
|
193
|
+
' cp -R "$dsym_path" "$archive_dsyms/"',
|
|
194
|
+
' done',
|
|
195
|
+
'}',
|
|
196
|
+
'',
|
|
197
|
+
'mkdir -p "$DWARF_DSYM_FOLDER_PATH"',
|
|
198
|
+
'',
|
|
199
|
+
`for framework in ${frameworkNames.join(' ')}; do`,
|
|
200
|
+
' binary="$(find_framework_binary "$framework" || true)"',
|
|
201
|
+
' if [ -z "$binary" ]; then',
|
|
202
|
+
' log "Skipping $framework because a framework binary was not found."',
|
|
203
|
+
' continue',
|
|
204
|
+
' fi',
|
|
205
|
+
'',
|
|
206
|
+
' dsym_path="$DWARF_DSYM_FOLDER_PATH/$framework.framework.dSYM"',
|
|
207
|
+
' rm -rf "$dsym_path"',
|
|
208
|
+
' if copy_prebuilt_dsym "$framework" "$dsym_path" "$binary"; then',
|
|
209
|
+
' copy_to_archive "$dsym_path" "$framework"',
|
|
210
|
+
' continue',
|
|
211
|
+
' fi',
|
|
212
|
+
'',
|
|
213
|
+
' if xcrun dsymutil "$binary" -o "$dsym_path" >/dev/null; then',
|
|
214
|
+
' log "Prepared $framework.framework.dSYM."',
|
|
215
|
+
' copy_to_archive "$dsym_path" "$framework"',
|
|
216
|
+
' else',
|
|
217
|
+
' log "Failed to generate $framework.framework.dSYM."',
|
|
218
|
+
' fi',
|
|
219
|
+
'done',
|
|
220
|
+
'',
|
|
221
|
+
].join('\n');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function phaseObject(phaseId) {
|
|
225
|
+
const quotedScript = JSON.stringify(shellScript());
|
|
226
|
+
return `\t\t${phaseId} /* ${phaseName} */ = {
|
|
227
|
+
\t\t\tisa = PBXShellScriptBuildPhase;
|
|
228
|
+
\t\t\talwaysOutOfDate = 1;
|
|
229
|
+
\t\t\tbuildActionMask = 2147483647;
|
|
230
|
+
\t\t\tfiles = (
|
|
231
|
+
\t\t\t);
|
|
232
|
+
\t\t\tinputFileListPaths = (
|
|
233
|
+
\t\t\t);
|
|
234
|
+
\t\t\tinputPaths = (
|
|
235
|
+
\t\t\t\t"$(BUILD_DIR)",
|
|
236
|
+
\t\t\t\t"$(BUILD_DIR)/../../../../../SourcePackages/artifacts",
|
|
237
|
+
\t\t\t\t"$(BUILD_DIR)/../../SourcePackages/artifacts",
|
|
238
|
+
\t\t\t\t"$(BUILD_DIR)/../SourcePackages/artifacts",
|
|
239
|
+
\t\t\t\t"$(HOME)/Library/Developer/Xcode/DerivedData",
|
|
240
|
+
\t\t\t\t"$(PODS_ROOT)",
|
|
241
|
+
\t\t\t\t"$(PROJECT_DIR)",
|
|
242
|
+
\t\t\t\t"$(SRCROOT)",
|
|
243
|
+
\t\t\t);
|
|
244
|
+
\t\t\tname = "${phaseName}";
|
|
245
|
+
\t\t\toutputFileListPaths = (
|
|
246
|
+
\t\t\t);
|
|
247
|
+
\t\t\toutputPaths = (
|
|
248
|
+
\t\t\t\t"$(ARCHIVE_PATH)/dSYMs/GoogleCast.framework.dSYM",
|
|
249
|
+
\t\t\t\t"$(ARCHIVE_PATH)/dSYMs/JWPlayerKit.framework.dSYM",
|
|
250
|
+
\t\t\t\t"$(DWARF_DSYM_FOLDER_PATH)/GoogleCast.framework.dSYM",
|
|
251
|
+
\t\t\t\t"$(DWARF_DSYM_FOLDER_PATH)/JWPlayerKit.framework.dSYM",
|
|
252
|
+
\t\t\t);
|
|
253
|
+
\t\t\trunOnlyForDeploymentPostprocessing = 0;
|
|
254
|
+
\t\t\tshellPath = /bin/sh;
|
|
255
|
+
\t\t\tshellScript = ${quotedScript};
|
|
256
|
+
\t\t};`;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function addShellScriptPhase(content, phaseId) {
|
|
260
|
+
const object = phaseObject(phaseId);
|
|
261
|
+
const existingPhaseId = findExistingPhaseId(content);
|
|
262
|
+
if (existingPhaseId) {
|
|
263
|
+
const existingPhasePattern = new RegExp(
|
|
264
|
+
`\\t\\t${escapeRegExp(existingPhaseId)} /\\* ${escapeRegExp(phaseName)} \\*/ = \\{[\\s\\S]*?\\n\\t\\t\\};`,
|
|
265
|
+
'm',
|
|
266
|
+
);
|
|
267
|
+
return content.replace(existingPhasePattern, object);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (content.includes('/* Begin PBXShellScriptBuildPhase section */')) {
|
|
271
|
+
return content.replace(
|
|
272
|
+
'/* End PBXShellScriptBuildPhase section */',
|
|
273
|
+
`${object}\n/* End PBXShellScriptBuildPhase section */`,
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return content.replace(
|
|
278
|
+
'/* Begin PBXSourcesBuildPhase section */',
|
|
279
|
+
`/* Begin PBXShellScriptBuildPhase section */\n${object}\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function addPhaseToApplicationTarget(content, phaseId) {
|
|
284
|
+
const targetPattern = /[A-F0-9]{24} \/\* [^*]+ \*\/ = \{[\s\S]*?\n\t\t\};/g;
|
|
285
|
+
let foundApplicationTarget = false;
|
|
286
|
+
let updatedApplicationTarget = false;
|
|
287
|
+
|
|
288
|
+
const nextContent = content.replace(targetPattern, (targetBlock) => {
|
|
289
|
+
if (
|
|
290
|
+
!targetBlock.includes('isa = PBXNativeTarget;') ||
|
|
291
|
+
!targetBlock.includes('productType = "com.apple.product-type.application";')
|
|
292
|
+
) {
|
|
293
|
+
return targetBlock;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
foundApplicationTarget = true;
|
|
297
|
+
if (targetBlock.includes(`${phaseId} /* ${phaseName} */`)) {
|
|
298
|
+
return targetBlock;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const nextTargetBlock = targetBlock.replace(/buildPhases = \(([\s\S]*?)\n\t\t\t\);/, (_match, phases) => {
|
|
302
|
+
return `buildPhases = (${phases}\n\t\t\t\t${phaseId} /* ${phaseName} */,\n\t\t\t);`;
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
if (nextTargetBlock === targetBlock) {
|
|
306
|
+
warn('Skipping one iOS dSYM configuration because an application target build phases list could not be updated.');
|
|
307
|
+
return targetBlock;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
updatedApplicationTarget = true;
|
|
311
|
+
return nextTargetBlock;
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
if (!foundApplicationTarget) {
|
|
315
|
+
warn('Skipping iOS dSYM configuration because no application target was found.');
|
|
316
|
+
return content;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (!updatedApplicationTarget) {
|
|
320
|
+
return content;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return nextContent;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function configureIosDsyms() {
|
|
327
|
+
if (process.env.CAPACITOR_PLATFORM_NAME !== 'ios') {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const rootDir = process.env.CAPACITOR_ROOT_DIR || process.cwd();
|
|
332
|
+
|
|
333
|
+
const projectFile = findProjectFile(rootDir);
|
|
334
|
+
if (!projectFile) {
|
|
335
|
+
warn('Skipping iOS dSYM configuration because no Xcode project was found.');
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const currentContent = fs.readFileSync(projectFile, 'utf8');
|
|
340
|
+
const phaseId = findExistingPhaseId(currentContent) || stablePbxId(phaseName);
|
|
341
|
+
let nextContent = addShellScriptPhase(currentContent, phaseId);
|
|
342
|
+
nextContent = addPhaseToApplicationTarget(nextContent, phaseId);
|
|
343
|
+
|
|
344
|
+
if (nextContent === currentContent) {
|
|
345
|
+
log('iOS vendor dSYM archive phase is already configured.');
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
fs.writeFileSync(projectFile, nextContent, 'utf8');
|
|
350
|
+
log('Configured iOS vendor dSYM archive phase.');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
configureIosDsyms();
|