ckplayer-plus 1.1.10 → 1.1.11
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/README.md +178 -176
- package/dist/ckplayer.js +45 -27
- package/dist/ckplayer.min.js +2 -2
- package/dist/flv.js/LICENSE +201 -201
- package/dist/flv.js/flv.min.js +9 -9
- package/dist/hls.js/LICENSE +28 -28
- package/dist/hls.js/hls.min.js +1 -1
- package/dist/index.cjs +45 -20
- package/dist/index.js +45 -20
- package/dist/mpegts.js/LICENSE +201 -201
- package/dist/mpegts.js/mpegts.min.js +8 -8
- package/dist/react.cjs +48 -20
- package/dist/react.js +48 -20
- package/dist/vue.cjs +48 -20
- package/dist/vue.js +48 -20
- package/package.json +2 -2
- package/types/vue.d.ts +1 -1
package/dist/react.cjs
CHANGED
|
@@ -210,7 +210,7 @@ var require_ckplayer = __commonJS({
|
|
|
210
210
|
cdnFallback: true
|
|
211
211
|
// getPath 失败时是否回退到 jsDelivr(内网可设 false,并配置 pluginPath)
|
|
212
212
|
};
|
|
213
|
-
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.
|
|
213
|
+
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.11/dist/";
|
|
214
214
|
function ckplayerEmbed(videoObj) {
|
|
215
215
|
var rightMenu = [
|
|
216
216
|
{
|
|
@@ -408,11 +408,6 @@ var require_ckplayer = __commonJS({
|
|
|
408
408
|
} else {
|
|
409
409
|
return embed(obj2);
|
|
410
410
|
}
|
|
411
|
-
}, isUnreliablePluginBase = function(base) {
|
|
412
|
-
if (!base || valType(base) != "string") {
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
return /\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base);
|
|
416
411
|
}, resolveAssetPath = function(folder, file) {
|
|
417
412
|
var base = "";
|
|
418
413
|
if (vars && vars["pluginPath"]) {
|
|
@@ -429,13 +424,14 @@ var require_ckplayer = __commonJS({
|
|
|
429
424
|
}
|
|
430
425
|
return base + folder + "/" + file;
|
|
431
426
|
}
|
|
432
|
-
var
|
|
433
|
-
|
|
427
|
+
var scriptBase = getPath();
|
|
428
|
+
var fromScript = scriptBase ? getPath(folder) + file : "";
|
|
429
|
+
if (fromScript && fromScript.indexOf(folder + "/") > -1 && fromScript.indexOf("undefined") === -1 && !isUnreliablePluginBase(scriptBase)) {
|
|
434
430
|
return fromScript;
|
|
435
431
|
}
|
|
436
432
|
var allowCdn = !vars || vars["cdnFallback"] !== false;
|
|
437
433
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
438
|
-
if (!allowCdn || !cdn || cdn.indexOf("1.1.
|
|
434
|
+
if (!allowCdn || !cdn || cdn.indexOf("1.1.11") > -1) {
|
|
439
435
|
return folder + "/" + file;
|
|
440
436
|
}
|
|
441
437
|
if (cdn.slice(-1) !== "/") {
|
|
@@ -6454,8 +6450,8 @@ var require_ckplayer = __commonJS({
|
|
|
6454
6450
|
removeScript();
|
|
6455
6451
|
if (!isRetry && (!vars || vars["cdnFallback"] !== false)) {
|
|
6456
6452
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
6457
|
-
var m = String(file).match(
|
|
6458
|
-
if (cdn && cdn.indexOf("1.1.
|
|
6453
|
+
var m = String(file).match(/(?:^|\/)(hls\.js|flv\.js|mpegts\.js|language)\/([^/?#]+)(?:[?#].*)?$/i);
|
|
6454
|
+
if (cdn && cdn.indexOf("1.1.11") === -1 && m) {
|
|
6459
6455
|
if (cdn.slice(-1) !== "/") {
|
|
6460
6456
|
cdn += "/";
|
|
6461
6457
|
}
|
|
@@ -6695,13 +6691,26 @@ var require_ckplayer = __commonJS({
|
|
|
6695
6691
|
}
|
|
6696
6692
|
}
|
|
6697
6693
|
}
|
|
6694
|
+
function isUnreliablePluginBase(base) {
|
|
6695
|
+
if (!base || typeof base !== "string") {
|
|
6696
|
+
return true;
|
|
6697
|
+
}
|
|
6698
|
+
var b = base.replace(/\\/g, "/");
|
|
6699
|
+
if (/\/(?:assets|\.vite\/deps|_next\/static|chunks?|static\/js|webpack|@fs|@id|@vite)\/?$/i.test(b)) {
|
|
6700
|
+
return true;
|
|
6701
|
+
}
|
|
6702
|
+
if (/\/(?:src|app|pages|views|components)\/?$/i.test(b)) {
|
|
6703
|
+
return true;
|
|
6704
|
+
}
|
|
6705
|
+
if (/^https?:\/\/[^/?#]+\/?$/i.test(b)) {
|
|
6706
|
+
return true;
|
|
6707
|
+
}
|
|
6708
|
+
return false;
|
|
6709
|
+
}
|
|
6698
6710
|
function getPath(siz) {
|
|
6699
6711
|
if (typeof window !== "undefined" && window.ckplayerBasePath) {
|
|
6700
6712
|
var base = window.ckplayerBasePath;
|
|
6701
|
-
if (
|
|
6702
|
-
base = "";
|
|
6703
|
-
}
|
|
6704
|
-
if (base) {
|
|
6713
|
+
if (!isUnreliablePluginBase(base)) {
|
|
6705
6714
|
if (base.slice(-1) !== "/") {
|
|
6706
6715
|
base += "/";
|
|
6707
6716
|
}
|
|
@@ -6711,12 +6720,17 @@ var require_ckplayer = __commonJS({
|
|
|
6711
6720
|
return base;
|
|
6712
6721
|
}
|
|
6713
6722
|
}
|
|
6714
|
-
var scriptList = document.scripts || []
|
|
6723
|
+
var scriptList = document.scripts || [];
|
|
6724
|
+
var thisPath = "";
|
|
6715
6725
|
for (var i = 0; i < scriptList.length; i++) {
|
|
6716
6726
|
var scriptName = scriptList[i].getAttribute("name") || scriptList[i].getAttribute("data-name");
|
|
6717
|
-
var
|
|
6718
|
-
if (
|
|
6719
|
-
|
|
6727
|
+
var srcFull = scriptList[i].src || "";
|
|
6728
|
+
if (!srcFull) {
|
|
6729
|
+
continue;
|
|
6730
|
+
}
|
|
6731
|
+
var src = srcFull.slice(srcFull.lastIndexOf("/") + 1, srcFull.lastIndexOf("."));
|
|
6732
|
+
if (scriptName && (scriptName == "ckplayer" || scriptName == "ckplayer.min" || scriptName == "ckplayer-plus") || (src == "ckplayer" || src == "ckplayer.min" || src.indexOf("ckplayer") === 0)) {
|
|
6733
|
+
thisPath = srcFull;
|
|
6720
6734
|
break;
|
|
6721
6735
|
}
|
|
6722
6736
|
}
|
|
@@ -6726,6 +6740,9 @@ var require_ckplayer = __commonJS({
|
|
|
6726
6740
|
} else if (thisPath && thisPath.lastIndexOf("/") > -1) {
|
|
6727
6741
|
path = thisPath.substring(0, thisPath.lastIndexOf("/") + 1);
|
|
6728
6742
|
}
|
|
6743
|
+
if (!path || isUnreliablePluginBase(path)) {
|
|
6744
|
+
return "";
|
|
6745
|
+
}
|
|
6729
6746
|
if (!isUndefined(siz)) {
|
|
6730
6747
|
path += siz + "/";
|
|
6731
6748
|
}
|
|
@@ -7232,13 +7249,21 @@ var import_meta = {};
|
|
|
7232
7249
|
try {
|
|
7233
7250
|
if (typeof window !== "undefined" && !window.ckplayerBasePath) {
|
|
7234
7251
|
base = new URL("./", import_meta.url).href;
|
|
7235
|
-
|
|
7252
|
+
normalized = String(base).replace(/\\/g, "/");
|
|
7253
|
+
trusted = /\/dist\/$/i.test(normalized) || /\/ckplayer-plus(?:@[^/]+)?\/(?:dist\/)?$/i.test(normalized) || /\/node_modules\/ckplayer-plus\/(?:dist\/)?$/i.test(normalized);
|
|
7254
|
+
untrusted = /\/(?:assets|\.vite\/deps|_next\/static|chunks?|src|app|pages|views|components|@fs|@id|@vite)\/?$/i.test(
|
|
7255
|
+
normalized
|
|
7256
|
+
);
|
|
7257
|
+
if (trusted && !untrusted) {
|
|
7236
7258
|
window.ckplayerBasePath = base;
|
|
7237
7259
|
}
|
|
7238
7260
|
}
|
|
7239
7261
|
} catch (e) {
|
|
7240
7262
|
}
|
|
7241
7263
|
var base;
|
|
7264
|
+
var normalized;
|
|
7265
|
+
var trusted;
|
|
7266
|
+
var untrusted;
|
|
7242
7267
|
var index_default = import_ckplayer.default;
|
|
7243
7268
|
|
|
7244
7269
|
// src/shared.js
|
|
@@ -7267,6 +7292,9 @@ function buildPlayerConfig(input) {
|
|
|
7267
7292
|
live: input.live != null ? input.live : false,
|
|
7268
7293
|
plug: input.plug || "",
|
|
7269
7294
|
autoPlug: input.autoPlug !== false,
|
|
7295
|
+
// Vue/React 经 bundler 引入时无 <script ckplayer>,强制走内置插件 + CDN 回退
|
|
7296
|
+
preferBuiltinPlug: opts.preferBuiltinPlug !== false,
|
|
7297
|
+
cdnFallback: opts.cdnFallback !== false,
|
|
7270
7298
|
volume: input.volume != null ? input.volume : 0.8,
|
|
7271
7299
|
cookie: opts.cookie || input.cookie || createUid()
|
|
7272
7300
|
};
|
package/dist/react.js
CHANGED
|
@@ -204,7 +204,7 @@ var require_ckplayer = __commonJS({
|
|
|
204
204
|
cdnFallback: true
|
|
205
205
|
// getPath 失败时是否回退到 jsDelivr(内网可设 false,并配置 pluginPath)
|
|
206
206
|
};
|
|
207
|
-
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.
|
|
207
|
+
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.11/dist/";
|
|
208
208
|
function ckplayerEmbed(videoObj) {
|
|
209
209
|
var rightMenu = [
|
|
210
210
|
{
|
|
@@ -402,11 +402,6 @@ var require_ckplayer = __commonJS({
|
|
|
402
402
|
} else {
|
|
403
403
|
return embed(obj2);
|
|
404
404
|
}
|
|
405
|
-
}, isUnreliablePluginBase = function(base) {
|
|
406
|
-
if (!base || valType(base) != "string") {
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
return /\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base);
|
|
410
405
|
}, resolveAssetPath = function(folder, file) {
|
|
411
406
|
var base = "";
|
|
412
407
|
if (vars && vars["pluginPath"]) {
|
|
@@ -423,13 +418,14 @@ var require_ckplayer = __commonJS({
|
|
|
423
418
|
}
|
|
424
419
|
return base + folder + "/" + file;
|
|
425
420
|
}
|
|
426
|
-
var
|
|
427
|
-
|
|
421
|
+
var scriptBase = getPath();
|
|
422
|
+
var fromScript = scriptBase ? getPath(folder) + file : "";
|
|
423
|
+
if (fromScript && fromScript.indexOf(folder + "/") > -1 && fromScript.indexOf("undefined") === -1 && !isUnreliablePluginBase(scriptBase)) {
|
|
428
424
|
return fromScript;
|
|
429
425
|
}
|
|
430
426
|
var allowCdn = !vars || vars["cdnFallback"] !== false;
|
|
431
427
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
432
|
-
if (!allowCdn || !cdn || cdn.indexOf("1.1.
|
|
428
|
+
if (!allowCdn || !cdn || cdn.indexOf("1.1.11") > -1) {
|
|
433
429
|
return folder + "/" + file;
|
|
434
430
|
}
|
|
435
431
|
if (cdn.slice(-1) !== "/") {
|
|
@@ -6448,8 +6444,8 @@ var require_ckplayer = __commonJS({
|
|
|
6448
6444
|
removeScript();
|
|
6449
6445
|
if (!isRetry && (!vars || vars["cdnFallback"] !== false)) {
|
|
6450
6446
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
6451
|
-
var m = String(file).match(
|
|
6452
|
-
if (cdn && cdn.indexOf("1.1.
|
|
6447
|
+
var m = String(file).match(/(?:^|\/)(hls\.js|flv\.js|mpegts\.js|language)\/([^/?#]+)(?:[?#].*)?$/i);
|
|
6448
|
+
if (cdn && cdn.indexOf("1.1.11") === -1 && m) {
|
|
6453
6449
|
if (cdn.slice(-1) !== "/") {
|
|
6454
6450
|
cdn += "/";
|
|
6455
6451
|
}
|
|
@@ -6689,13 +6685,26 @@ var require_ckplayer = __commonJS({
|
|
|
6689
6685
|
}
|
|
6690
6686
|
}
|
|
6691
6687
|
}
|
|
6688
|
+
function isUnreliablePluginBase(base) {
|
|
6689
|
+
if (!base || typeof base !== "string") {
|
|
6690
|
+
return true;
|
|
6691
|
+
}
|
|
6692
|
+
var b = base.replace(/\\/g, "/");
|
|
6693
|
+
if (/\/(?:assets|\.vite\/deps|_next\/static|chunks?|static\/js|webpack|@fs|@id|@vite)\/?$/i.test(b)) {
|
|
6694
|
+
return true;
|
|
6695
|
+
}
|
|
6696
|
+
if (/\/(?:src|app|pages|views|components)\/?$/i.test(b)) {
|
|
6697
|
+
return true;
|
|
6698
|
+
}
|
|
6699
|
+
if (/^https?:\/\/[^/?#]+\/?$/i.test(b)) {
|
|
6700
|
+
return true;
|
|
6701
|
+
}
|
|
6702
|
+
return false;
|
|
6703
|
+
}
|
|
6692
6704
|
function getPath(siz) {
|
|
6693
6705
|
if (typeof window !== "undefined" && window.ckplayerBasePath) {
|
|
6694
6706
|
var base = window.ckplayerBasePath;
|
|
6695
|
-
if (
|
|
6696
|
-
base = "";
|
|
6697
|
-
}
|
|
6698
|
-
if (base) {
|
|
6707
|
+
if (!isUnreliablePluginBase(base)) {
|
|
6699
6708
|
if (base.slice(-1) !== "/") {
|
|
6700
6709
|
base += "/";
|
|
6701
6710
|
}
|
|
@@ -6705,12 +6714,17 @@ var require_ckplayer = __commonJS({
|
|
|
6705
6714
|
return base;
|
|
6706
6715
|
}
|
|
6707
6716
|
}
|
|
6708
|
-
var scriptList = document.scripts || []
|
|
6717
|
+
var scriptList = document.scripts || [];
|
|
6718
|
+
var thisPath = "";
|
|
6709
6719
|
for (var i = 0; i < scriptList.length; i++) {
|
|
6710
6720
|
var scriptName = scriptList[i].getAttribute("name") || scriptList[i].getAttribute("data-name");
|
|
6711
|
-
var
|
|
6712
|
-
if (
|
|
6713
|
-
|
|
6721
|
+
var srcFull = scriptList[i].src || "";
|
|
6722
|
+
if (!srcFull) {
|
|
6723
|
+
continue;
|
|
6724
|
+
}
|
|
6725
|
+
var src = srcFull.slice(srcFull.lastIndexOf("/") + 1, srcFull.lastIndexOf("."));
|
|
6726
|
+
if (scriptName && (scriptName == "ckplayer" || scriptName == "ckplayer.min" || scriptName == "ckplayer-plus") || (src == "ckplayer" || src == "ckplayer.min" || src.indexOf("ckplayer") === 0)) {
|
|
6727
|
+
thisPath = srcFull;
|
|
6714
6728
|
break;
|
|
6715
6729
|
}
|
|
6716
6730
|
}
|
|
@@ -6720,6 +6734,9 @@ var require_ckplayer = __commonJS({
|
|
|
6720
6734
|
} else if (thisPath && thisPath.lastIndexOf("/") > -1) {
|
|
6721
6735
|
path = thisPath.substring(0, thisPath.lastIndexOf("/") + 1);
|
|
6722
6736
|
}
|
|
6737
|
+
if (!path || isUnreliablePluginBase(path)) {
|
|
6738
|
+
return "";
|
|
6739
|
+
}
|
|
6723
6740
|
if (!isUndefined(siz)) {
|
|
6724
6741
|
path += siz + "/";
|
|
6725
6742
|
}
|
|
@@ -7218,13 +7235,21 @@ var import_meta = {};
|
|
|
7218
7235
|
try {
|
|
7219
7236
|
if (typeof window !== "undefined" && !window.ckplayerBasePath) {
|
|
7220
7237
|
base = new URL("./", import_meta.url).href;
|
|
7221
|
-
|
|
7238
|
+
normalized = String(base).replace(/\\/g, "/");
|
|
7239
|
+
trusted = /\/dist\/$/i.test(normalized) || /\/ckplayer-plus(?:@[^/]+)?\/(?:dist\/)?$/i.test(normalized) || /\/node_modules\/ckplayer-plus\/(?:dist\/)?$/i.test(normalized);
|
|
7240
|
+
untrusted = /\/(?:assets|\.vite\/deps|_next\/static|chunks?|src|app|pages|views|components|@fs|@id|@vite)\/?$/i.test(
|
|
7241
|
+
normalized
|
|
7242
|
+
);
|
|
7243
|
+
if (trusted && !untrusted) {
|
|
7222
7244
|
window.ckplayerBasePath = base;
|
|
7223
7245
|
}
|
|
7224
7246
|
}
|
|
7225
7247
|
} catch (e) {
|
|
7226
7248
|
}
|
|
7227
7249
|
var base;
|
|
7250
|
+
var normalized;
|
|
7251
|
+
var trusted;
|
|
7252
|
+
var untrusted;
|
|
7228
7253
|
var index_default = import_ckplayer.default;
|
|
7229
7254
|
|
|
7230
7255
|
// src/shared.js
|
|
@@ -7253,6 +7278,9 @@ function buildPlayerConfig(input) {
|
|
|
7253
7278
|
live: input.live != null ? input.live : false,
|
|
7254
7279
|
plug: input.plug || "",
|
|
7255
7280
|
autoPlug: input.autoPlug !== false,
|
|
7281
|
+
// Vue/React 经 bundler 引入时无 <script ckplayer>,强制走内置插件 + CDN 回退
|
|
7282
|
+
preferBuiltinPlug: opts.preferBuiltinPlug !== false,
|
|
7283
|
+
cdnFallback: opts.cdnFallback !== false,
|
|
7256
7284
|
volume: input.volume != null ? input.volume : 0.8,
|
|
7257
7285
|
cookie: opts.cookie || input.cookie || createUid()
|
|
7258
7286
|
};
|
package/dist/vue.cjs
CHANGED
|
@@ -210,7 +210,7 @@ var require_ckplayer = __commonJS({
|
|
|
210
210
|
cdnFallback: true
|
|
211
211
|
// getPath 失败时是否回退到 jsDelivr(内网可设 false,并配置 pluginPath)
|
|
212
212
|
};
|
|
213
|
-
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.
|
|
213
|
+
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.11/dist/";
|
|
214
214
|
function ckplayerEmbed(videoObj) {
|
|
215
215
|
var rightMenu = [
|
|
216
216
|
{
|
|
@@ -408,11 +408,6 @@ var require_ckplayer = __commonJS({
|
|
|
408
408
|
} else {
|
|
409
409
|
return embed(obj2);
|
|
410
410
|
}
|
|
411
|
-
}, isUnreliablePluginBase = function(base) {
|
|
412
|
-
if (!base || valType(base) != "string") {
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
return /\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base);
|
|
416
411
|
}, resolveAssetPath = function(folder, file) {
|
|
417
412
|
var base = "";
|
|
418
413
|
if (vars && vars["pluginPath"]) {
|
|
@@ -429,13 +424,14 @@ var require_ckplayer = __commonJS({
|
|
|
429
424
|
}
|
|
430
425
|
return base + folder + "/" + file;
|
|
431
426
|
}
|
|
432
|
-
var
|
|
433
|
-
|
|
427
|
+
var scriptBase = getPath();
|
|
428
|
+
var fromScript = scriptBase ? getPath(folder) + file : "";
|
|
429
|
+
if (fromScript && fromScript.indexOf(folder + "/") > -1 && fromScript.indexOf("undefined") === -1 && !isUnreliablePluginBase(scriptBase)) {
|
|
434
430
|
return fromScript;
|
|
435
431
|
}
|
|
436
432
|
var allowCdn = !vars || vars["cdnFallback"] !== false;
|
|
437
433
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
438
|
-
if (!allowCdn || !cdn || cdn.indexOf("1.1.
|
|
434
|
+
if (!allowCdn || !cdn || cdn.indexOf("1.1.11") > -1) {
|
|
439
435
|
return folder + "/" + file;
|
|
440
436
|
}
|
|
441
437
|
if (cdn.slice(-1) !== "/") {
|
|
@@ -6454,8 +6450,8 @@ var require_ckplayer = __commonJS({
|
|
|
6454
6450
|
removeScript();
|
|
6455
6451
|
if (!isRetry && (!vars || vars["cdnFallback"] !== false)) {
|
|
6456
6452
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
6457
|
-
var m = String(file).match(
|
|
6458
|
-
if (cdn && cdn.indexOf("1.1.
|
|
6453
|
+
var m = String(file).match(/(?:^|\/)(hls\.js|flv\.js|mpegts\.js|language)\/([^/?#]+)(?:[?#].*)?$/i);
|
|
6454
|
+
if (cdn && cdn.indexOf("1.1.11") === -1 && m) {
|
|
6459
6455
|
if (cdn.slice(-1) !== "/") {
|
|
6460
6456
|
cdn += "/";
|
|
6461
6457
|
}
|
|
@@ -6695,13 +6691,26 @@ var require_ckplayer = __commonJS({
|
|
|
6695
6691
|
}
|
|
6696
6692
|
}
|
|
6697
6693
|
}
|
|
6694
|
+
function isUnreliablePluginBase(base) {
|
|
6695
|
+
if (!base || typeof base !== "string") {
|
|
6696
|
+
return true;
|
|
6697
|
+
}
|
|
6698
|
+
var b = base.replace(/\\/g, "/");
|
|
6699
|
+
if (/\/(?:assets|\.vite\/deps|_next\/static|chunks?|static\/js|webpack|@fs|@id|@vite)\/?$/i.test(b)) {
|
|
6700
|
+
return true;
|
|
6701
|
+
}
|
|
6702
|
+
if (/\/(?:src|app|pages|views|components)\/?$/i.test(b)) {
|
|
6703
|
+
return true;
|
|
6704
|
+
}
|
|
6705
|
+
if (/^https?:\/\/[^/?#]+\/?$/i.test(b)) {
|
|
6706
|
+
return true;
|
|
6707
|
+
}
|
|
6708
|
+
return false;
|
|
6709
|
+
}
|
|
6698
6710
|
function getPath(siz) {
|
|
6699
6711
|
if (typeof window !== "undefined" && window.ckplayerBasePath) {
|
|
6700
6712
|
var base = window.ckplayerBasePath;
|
|
6701
|
-
if (
|
|
6702
|
-
base = "";
|
|
6703
|
-
}
|
|
6704
|
-
if (base) {
|
|
6713
|
+
if (!isUnreliablePluginBase(base)) {
|
|
6705
6714
|
if (base.slice(-1) !== "/") {
|
|
6706
6715
|
base += "/";
|
|
6707
6716
|
}
|
|
@@ -6711,12 +6720,17 @@ var require_ckplayer = __commonJS({
|
|
|
6711
6720
|
return base;
|
|
6712
6721
|
}
|
|
6713
6722
|
}
|
|
6714
|
-
var scriptList = document.scripts || []
|
|
6723
|
+
var scriptList = document.scripts || [];
|
|
6724
|
+
var thisPath = "";
|
|
6715
6725
|
for (var i = 0; i < scriptList.length; i++) {
|
|
6716
6726
|
var scriptName = scriptList[i].getAttribute("name") || scriptList[i].getAttribute("data-name");
|
|
6717
|
-
var
|
|
6718
|
-
if (
|
|
6719
|
-
|
|
6727
|
+
var srcFull = scriptList[i].src || "";
|
|
6728
|
+
if (!srcFull) {
|
|
6729
|
+
continue;
|
|
6730
|
+
}
|
|
6731
|
+
var src = srcFull.slice(srcFull.lastIndexOf("/") + 1, srcFull.lastIndexOf("."));
|
|
6732
|
+
if (scriptName && (scriptName == "ckplayer" || scriptName == "ckplayer.min" || scriptName == "ckplayer-plus") || (src == "ckplayer" || src == "ckplayer.min" || src.indexOf("ckplayer") === 0)) {
|
|
6733
|
+
thisPath = srcFull;
|
|
6720
6734
|
break;
|
|
6721
6735
|
}
|
|
6722
6736
|
}
|
|
@@ -6726,6 +6740,9 @@ var require_ckplayer = __commonJS({
|
|
|
6726
6740
|
} else if (thisPath && thisPath.lastIndexOf("/") > -1) {
|
|
6727
6741
|
path = thisPath.substring(0, thisPath.lastIndexOf("/") + 1);
|
|
6728
6742
|
}
|
|
6743
|
+
if (!path || isUnreliablePluginBase(path)) {
|
|
6744
|
+
return "";
|
|
6745
|
+
}
|
|
6729
6746
|
if (!isUndefined(siz)) {
|
|
6730
6747
|
path += siz + "/";
|
|
6731
6748
|
}
|
|
@@ -7232,13 +7249,21 @@ var import_meta = {};
|
|
|
7232
7249
|
try {
|
|
7233
7250
|
if (typeof window !== "undefined" && !window.ckplayerBasePath) {
|
|
7234
7251
|
base = new URL("./", import_meta.url).href;
|
|
7235
|
-
|
|
7252
|
+
normalized = String(base).replace(/\\/g, "/");
|
|
7253
|
+
trusted = /\/dist\/$/i.test(normalized) || /\/ckplayer-plus(?:@[^/]+)?\/(?:dist\/)?$/i.test(normalized) || /\/node_modules\/ckplayer-plus\/(?:dist\/)?$/i.test(normalized);
|
|
7254
|
+
untrusted = /\/(?:assets|\.vite\/deps|_next\/static|chunks?|src|app|pages|views|components|@fs|@id|@vite)\/?$/i.test(
|
|
7255
|
+
normalized
|
|
7256
|
+
);
|
|
7257
|
+
if (trusted && !untrusted) {
|
|
7236
7258
|
window.ckplayerBasePath = base;
|
|
7237
7259
|
}
|
|
7238
7260
|
}
|
|
7239
7261
|
} catch (e) {
|
|
7240
7262
|
}
|
|
7241
7263
|
var base;
|
|
7264
|
+
var normalized;
|
|
7265
|
+
var trusted;
|
|
7266
|
+
var untrusted;
|
|
7242
7267
|
var index_default = import_ckplayer.default;
|
|
7243
7268
|
|
|
7244
7269
|
// src/shared.js
|
|
@@ -7256,6 +7281,9 @@ function buildPlayerConfig(input) {
|
|
|
7256
7281
|
live: input.live != null ? input.live : false,
|
|
7257
7282
|
plug: input.plug || "",
|
|
7258
7283
|
autoPlug: input.autoPlug !== false,
|
|
7284
|
+
// Vue/React 经 bundler 引入时无 <script ckplayer>,强制走内置插件 + CDN 回退
|
|
7285
|
+
preferBuiltinPlug: opts.preferBuiltinPlug !== false,
|
|
7286
|
+
cdnFallback: opts.cdnFallback !== false,
|
|
7259
7287
|
volume: input.volume != null ? input.volume : 0.8,
|
|
7260
7288
|
cookie: opts.cookie || input.cookie || createUid()
|
|
7261
7289
|
};
|
package/dist/vue.js
CHANGED
|
@@ -204,7 +204,7 @@ var require_ckplayer = __commonJS({
|
|
|
204
204
|
cdnFallback: true
|
|
205
205
|
// getPath 失败时是否回退到 jsDelivr(内网可设 false,并配置 pluginPath)
|
|
206
206
|
};
|
|
207
|
-
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.
|
|
207
|
+
var ckplayerPlusDefaultCdn = "https://cdn.jsdelivr.net/npm/ckplayer-plus@1.1.11/dist/";
|
|
208
208
|
function ckplayerEmbed(videoObj) {
|
|
209
209
|
var rightMenu = [
|
|
210
210
|
{
|
|
@@ -402,11 +402,6 @@ var require_ckplayer = __commonJS({
|
|
|
402
402
|
} else {
|
|
403
403
|
return embed(obj2);
|
|
404
404
|
}
|
|
405
|
-
}, isUnreliablePluginBase = function(base) {
|
|
406
|
-
if (!base || valType(base) != "string") {
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
return /\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base);
|
|
410
405
|
}, resolveAssetPath = function(folder, file) {
|
|
411
406
|
var base = "";
|
|
412
407
|
if (vars && vars["pluginPath"]) {
|
|
@@ -423,13 +418,14 @@ var require_ckplayer = __commonJS({
|
|
|
423
418
|
}
|
|
424
419
|
return base + folder + "/" + file;
|
|
425
420
|
}
|
|
426
|
-
var
|
|
427
|
-
|
|
421
|
+
var scriptBase = getPath();
|
|
422
|
+
var fromScript = scriptBase ? getPath(folder) + file : "";
|
|
423
|
+
if (fromScript && fromScript.indexOf(folder + "/") > -1 && fromScript.indexOf("undefined") === -1 && !isUnreliablePluginBase(scriptBase)) {
|
|
428
424
|
return fromScript;
|
|
429
425
|
}
|
|
430
426
|
var allowCdn = !vars || vars["cdnFallback"] !== false;
|
|
431
427
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
432
|
-
if (!allowCdn || !cdn || cdn.indexOf("1.1.
|
|
428
|
+
if (!allowCdn || !cdn || cdn.indexOf("1.1.11") > -1) {
|
|
433
429
|
return folder + "/" + file;
|
|
434
430
|
}
|
|
435
431
|
if (cdn.slice(-1) !== "/") {
|
|
@@ -6448,8 +6444,8 @@ var require_ckplayer = __commonJS({
|
|
|
6448
6444
|
removeScript();
|
|
6449
6445
|
if (!isRetry && (!vars || vars["cdnFallback"] !== false)) {
|
|
6450
6446
|
var cdn = typeof window !== "undefined" && window.ckplayerPlusCdn ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
6451
|
-
var m = String(file).match(
|
|
6452
|
-
if (cdn && cdn.indexOf("1.1.
|
|
6447
|
+
var m = String(file).match(/(?:^|\/)(hls\.js|flv\.js|mpegts\.js|language)\/([^/?#]+)(?:[?#].*)?$/i);
|
|
6448
|
+
if (cdn && cdn.indexOf("1.1.11") === -1 && m) {
|
|
6453
6449
|
if (cdn.slice(-1) !== "/") {
|
|
6454
6450
|
cdn += "/";
|
|
6455
6451
|
}
|
|
@@ -6689,13 +6685,26 @@ var require_ckplayer = __commonJS({
|
|
|
6689
6685
|
}
|
|
6690
6686
|
}
|
|
6691
6687
|
}
|
|
6688
|
+
function isUnreliablePluginBase(base) {
|
|
6689
|
+
if (!base || typeof base !== "string") {
|
|
6690
|
+
return true;
|
|
6691
|
+
}
|
|
6692
|
+
var b = base.replace(/\\/g, "/");
|
|
6693
|
+
if (/\/(?:assets|\.vite\/deps|_next\/static|chunks?|static\/js|webpack|@fs|@id|@vite)\/?$/i.test(b)) {
|
|
6694
|
+
return true;
|
|
6695
|
+
}
|
|
6696
|
+
if (/\/(?:src|app|pages|views|components)\/?$/i.test(b)) {
|
|
6697
|
+
return true;
|
|
6698
|
+
}
|
|
6699
|
+
if (/^https?:\/\/[^/?#]+\/?$/i.test(b)) {
|
|
6700
|
+
return true;
|
|
6701
|
+
}
|
|
6702
|
+
return false;
|
|
6703
|
+
}
|
|
6692
6704
|
function getPath(siz) {
|
|
6693
6705
|
if (typeof window !== "undefined" && window.ckplayerBasePath) {
|
|
6694
6706
|
var base = window.ckplayerBasePath;
|
|
6695
|
-
if (
|
|
6696
|
-
base = "";
|
|
6697
|
-
}
|
|
6698
|
-
if (base) {
|
|
6707
|
+
if (!isUnreliablePluginBase(base)) {
|
|
6699
6708
|
if (base.slice(-1) !== "/") {
|
|
6700
6709
|
base += "/";
|
|
6701
6710
|
}
|
|
@@ -6705,12 +6714,17 @@ var require_ckplayer = __commonJS({
|
|
|
6705
6714
|
return base;
|
|
6706
6715
|
}
|
|
6707
6716
|
}
|
|
6708
|
-
var scriptList = document.scripts || []
|
|
6717
|
+
var scriptList = document.scripts || [];
|
|
6718
|
+
var thisPath = "";
|
|
6709
6719
|
for (var i = 0; i < scriptList.length; i++) {
|
|
6710
6720
|
var scriptName = scriptList[i].getAttribute("name") || scriptList[i].getAttribute("data-name");
|
|
6711
|
-
var
|
|
6712
|
-
if (
|
|
6713
|
-
|
|
6721
|
+
var srcFull = scriptList[i].src || "";
|
|
6722
|
+
if (!srcFull) {
|
|
6723
|
+
continue;
|
|
6724
|
+
}
|
|
6725
|
+
var src = srcFull.slice(srcFull.lastIndexOf("/") + 1, srcFull.lastIndexOf("."));
|
|
6726
|
+
if (scriptName && (scriptName == "ckplayer" || scriptName == "ckplayer.min" || scriptName == "ckplayer-plus") || (src == "ckplayer" || src == "ckplayer.min" || src.indexOf("ckplayer") === 0)) {
|
|
6727
|
+
thisPath = srcFull;
|
|
6714
6728
|
break;
|
|
6715
6729
|
}
|
|
6716
6730
|
}
|
|
@@ -6720,6 +6734,9 @@ var require_ckplayer = __commonJS({
|
|
|
6720
6734
|
} else if (thisPath && thisPath.lastIndexOf("/") > -1) {
|
|
6721
6735
|
path = thisPath.substring(0, thisPath.lastIndexOf("/") + 1);
|
|
6722
6736
|
}
|
|
6737
|
+
if (!path || isUnreliablePluginBase(path)) {
|
|
6738
|
+
return "";
|
|
6739
|
+
}
|
|
6723
6740
|
if (!isUndefined(siz)) {
|
|
6724
6741
|
path += siz + "/";
|
|
6725
6742
|
}
|
|
@@ -7218,13 +7235,21 @@ var import_meta = {};
|
|
|
7218
7235
|
try {
|
|
7219
7236
|
if (typeof window !== "undefined" && !window.ckplayerBasePath) {
|
|
7220
7237
|
base = new URL("./", import_meta.url).href;
|
|
7221
|
-
|
|
7238
|
+
normalized = String(base).replace(/\\/g, "/");
|
|
7239
|
+
trusted = /\/dist\/$/i.test(normalized) || /\/ckplayer-plus(?:@[^/]+)?\/(?:dist\/)?$/i.test(normalized) || /\/node_modules\/ckplayer-plus\/(?:dist\/)?$/i.test(normalized);
|
|
7240
|
+
untrusted = /\/(?:assets|\.vite\/deps|_next\/static|chunks?|src|app|pages|views|components|@fs|@id|@vite)\/?$/i.test(
|
|
7241
|
+
normalized
|
|
7242
|
+
);
|
|
7243
|
+
if (trusted && !untrusted) {
|
|
7222
7244
|
window.ckplayerBasePath = base;
|
|
7223
7245
|
}
|
|
7224
7246
|
}
|
|
7225
7247
|
} catch (e) {
|
|
7226
7248
|
}
|
|
7227
7249
|
var base;
|
|
7250
|
+
var normalized;
|
|
7251
|
+
var trusted;
|
|
7252
|
+
var untrusted;
|
|
7228
7253
|
var index_default = import_ckplayer.default;
|
|
7229
7254
|
|
|
7230
7255
|
// src/shared.js
|
|
@@ -7242,6 +7267,9 @@ function buildPlayerConfig(input) {
|
|
|
7242
7267
|
live: input.live != null ? input.live : false,
|
|
7243
7268
|
plug: input.plug || "",
|
|
7244
7269
|
autoPlug: input.autoPlug !== false,
|
|
7270
|
+
// Vue/React 经 bundler 引入时无 <script ckplayer>,强制走内置插件 + CDN 回退
|
|
7271
|
+
preferBuiltinPlug: opts.preferBuiltinPlug !== false,
|
|
7272
|
+
cdnFallback: opts.cdnFallback !== false,
|
|
7245
7273
|
volume: input.volume != null ? input.volume : 0.8,
|
|
7246
7274
|
cookie: opts.cookie || input.cookie || createUid()
|
|
7247
7275
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ckplayer-plus",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "Enhanced ckplayer X3 packaging with Vue 2/3 and React wrappers — ESM-ready HTML5 video player",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckplayer",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"build": "node scripts/build.mjs",
|
|
69
69
|
"lint": "eslint src scripts",
|
|
70
70
|
"typecheck": "tsc --noEmit",
|
|
71
|
-
"test": "node scripts/smoke.mjs && node scripts/hls-resume-regress.mjs",
|
|
71
|
+
"test": "node scripts/smoke.mjs && node scripts/plugin-path-regress.mjs && node scripts/hls-resume-regress.mjs",
|
|
72
72
|
"check": "npm run lint && npm run typecheck && npm run build && npm run test",
|
|
73
73
|
"prepublishOnly": "npm run build"
|
|
74
74
|
},
|