ckplayer-plus 1.0.3 → 1.0.6
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 +7 -11
- package/dist/ckplayer.js +204 -23
- package/dist/ckplayer.min.js +2 -2
- package/dist/index.cjs +194 -32
- package/dist/index.js +194 -32
- package/dist/react.cjs +241 -64
- package/dist/react.js +241 -64
- package/dist/vue.cjs +308 -108
- package/dist/vue.js +308 -108
- package/package.json +1 -1
- package/types/vue.d.ts +11 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ckplayer-plus
|
|
2
2
|
|
|
3
|
-
基于 [ckplayer](https://www.ckplayer.com) X3 的工程化封装:支持 **npm / ESM**,并提供 **Vue 2
|
|
3
|
+
基于 [ckplayer](https://www.ckplayer.com) X3 的工程化封装:支持 **npm / ESM**,并提供 **Vue 2.7+/3** 与 **React** 组件。
|
|
4
4
|
|
|
5
5
|
> **免责声明**:本包为社区/工程化封装,**非 ckplayer 官方包**。播放内核来自 ckplayer(MIT)。完整能力与参数请同时参考 [官方手册](https://www.ckplayer.com/manual/)。npm 上的官方包名为 [`ckplayer`](https://www.npmjs.com/package/ckplayer),请勿混淆。
|
|
6
6
|
|
|
@@ -77,7 +77,7 @@ React:
|
|
|
77
77
|
| `preferBuiltinPlug` | `true` | 优先加载本包内置脚本,避免复用页面上其它全局 `Hls` |
|
|
78
78
|
| `cdnFallback` | `true` | `getPath` 失败时回退 jsDelivr;内网无外网请设 `false` 并配 `pluginPath` |
|
|
79
79
|
| `pluginPath` | 自动 | 插件脚本根路径。默认:`window.ckplayerBasePath` → 本包 `dist/` → jsDelivr CDN |
|
|
80
|
-
| `seek` | `0` | 续播秒数(number 或数字字符串);会同步 `maxSeeTime
|
|
80
|
+
| `seek` | `0` | 续播秒数(number 或数字字符串);会同步 `maxSeeTime`。HLS 优先用 `startPosition`,并等待缓冲后再跳,降低非关键帧解码失败 |
|
|
81
81
|
| `loaded` | — | **只支持函数**;字符串形式已禁用(防 XSS) |
|
|
82
82
|
|
|
83
83
|
### 进阶(按需)
|
|
@@ -95,14 +95,16 @@ React:
|
|
|
95
95
|
### 插件加载优先级
|
|
96
96
|
|
|
97
97
|
1. `preferBuiltinPlug: false` 且页面已有全局 `Hls` / `flvjs` / `mpegts` → 直接复用
|
|
98
|
-
2. 否则加载本包脚本:`pluginPath`
|
|
98
|
+
2. 否则加载本包脚本:`pluginPath` 或可信的 `window.ckplayerBasePath`(仅 dist / npm 包路径会自动设置;Vite/Webpack chunk 目录会忽略)
|
|
99
99
|
3. 传统 `<script src=".../ckplayer.min.js">` 同级目录推导
|
|
100
|
-
4. `cdnFallback !== false` 时回退:`https://cdn.jsdelivr.net/npm/ckplayer-plus@x.y.z/dist
|
|
100
|
+
4. `cdnFallback !== false` 时回退:`https://cdn.jsdelivr.net/npm/ckplayer-plus@x.y.z/dist/`;若本地路径 404 会再自动重试一次 CDN
|
|
101
101
|
|
|
102
102
|
> 内网离线:把 `node_modules/ckplayer-plus/dist/` 里的 `hls.js/` 等目录放到可访问静态路径,并设置 `pluginPath` 或 `window.ckplayerBasePath`,建议同时 `cdnFallback: false`。
|
|
103
103
|
> 样式请使用 `import 'ckplayer-plus/style.css'`,保证 `./images/` 图标能被打包工具解析。
|
|
104
104
|
|
|
105
|
-
## Vue 2 / Vue 3
|
|
105
|
+
## Vue 2.7 / Vue 3
|
|
106
|
+
|
|
107
|
+
支持 **Vue 2.7+** 与 **Vue 3**(需从 `vue` 解析 `h`,与 peerDependencies 一致)。
|
|
106
108
|
|
|
107
109
|
```vue
|
|
108
110
|
<template>
|
|
@@ -170,9 +172,3 @@ npm publish --access public
|
|
|
170
172
|
## License
|
|
171
173
|
|
|
172
174
|
MIT。内置的 hls.js / flv.js / mpegts.js 遵循各自许可证(多为 Apache-2.0)。
|
|
173
|
-
|
|
174
|
-
## 相关链接
|
|
175
|
-
|
|
176
|
-
- 官网:https://www.ckplayer.com
|
|
177
|
-
- 手册:https://www.ckplayer.com/manual/
|
|
178
|
-
- 官方 npm:https://www.npmjs.com/package/ckplayer
|
package/dist/ckplayer.js
CHANGED
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
cdnFallback:true// getPath 失败时是否回退到 jsDelivr(内网可设 false,并配置 pluginPath)
|
|
142
142
|
};
|
|
143
143
|
// 打包时替换为真实版本;用于 bundler 下 getPath 失效时的 CDN 回退
|
|
144
|
-
var ckplayerPlusDefaultCdn='https://cdn.jsdelivr.net/npm/ckplayer-plus@1.0.
|
|
144
|
+
var ckplayerPlusDefaultCdn='https://cdn.jsdelivr.net/npm/ckplayer-plus@1.0.6/dist/';
|
|
145
145
|
function ckplayerEmbed(videoObj){
|
|
146
146
|
/*
|
|
147
147
|
* rightMenu
|
|
@@ -171,6 +171,11 @@
|
|
|
171
171
|
var paused=true;//默认暂停状态
|
|
172
172
|
var loadTime=0;//已加载部分
|
|
173
173
|
var seekTime=0;//需要跳转的时间,初次播放以及切换清晰度后会用该变量记录需要seek的时间
|
|
174
|
+
var seekRetryTimer=null;//续播等待缓冲的重试计时器
|
|
175
|
+
var seekRetryCount=0;//续播重试次数
|
|
176
|
+
var seekApplyLock=false;//防止并发多次 currentTime 赋值
|
|
177
|
+
var decodeRecoverCount=0;//MEDIA_ERR_DECODE 恢复次数
|
|
178
|
+
var hlsStartPositionUsed=false;//是否已用 hls.js startPosition 处理续播
|
|
174
179
|
var oldTime=0,playTime=0,firstSeekTime=-1,maxSeeTime=0;//oldTime=记录上次播放时间,playTime=当前播放时间,firstSeekTime=记录第一次拖动的时间,maxSeeTime=看过的最大时间
|
|
175
180
|
var isChangeDef=true;//是否需要重置清晰度
|
|
176
181
|
var playType='';//播放类别,默认='',是通过api接口播放,='button'则判定是通过点击按钮播放
|
|
@@ -371,6 +376,16 @@
|
|
|
371
376
|
return embed(obj);
|
|
372
377
|
}
|
|
373
378
|
},
|
|
379
|
+
/*
|
|
380
|
+
* isUnreliablePluginBase
|
|
381
|
+
* 功能:识别 bundler chunk 目录(不含 hls.js 等插件),避免短路 CDN 回退
|
|
382
|
+
*/
|
|
383
|
+
isUnreliablePluginBase=function(base){
|
|
384
|
+
if(!base || valType(base)!='string'){
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
return /\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base);
|
|
388
|
+
},
|
|
374
389
|
/*
|
|
375
390
|
* resolveAssetPath
|
|
376
391
|
* 功能:解析插件/语言包路径
|
|
@@ -384,6 +399,9 @@
|
|
|
384
399
|
else if(typeof window!=='undefined' && window.ckplayerBasePath){
|
|
385
400
|
base=window.ckplayerBasePath;
|
|
386
401
|
}
|
|
402
|
+
if(base && isUnreliablePluginBase(base)){
|
|
403
|
+
base='';
|
|
404
|
+
}
|
|
387
405
|
if(base){
|
|
388
406
|
if(base.slice(-1)!=='/'){
|
|
389
407
|
base+='/';
|
|
@@ -391,12 +409,12 @@
|
|
|
391
409
|
return base+folder+'/'+file;
|
|
392
410
|
}
|
|
393
411
|
var fromScript=getPath(folder)+file;
|
|
394
|
-
if(fromScript && fromScript.indexOf(folder+'/')>-1 && fromScript.indexOf('undefined')===-1){
|
|
412
|
+
if(fromScript && fromScript.indexOf(folder+'/')>-1 && fromScript.indexOf('undefined')===-1 && !isUnreliablePluginBase(getPath())){
|
|
395
413
|
return fromScript;
|
|
396
414
|
}
|
|
397
415
|
var allowCdn=!vars || vars['cdnFallback']!==false;
|
|
398
416
|
var cdn=(typeof window!=='undefined' && window.ckplayerPlusCdn) ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
399
|
-
if(!allowCdn || !cdn || cdn.indexOf('1.0.
|
|
417
|
+
if(!allowCdn || !cdn || cdn.indexOf('1.0.6')>-1){
|
|
400
418
|
// 避免占位版本或显式关闭 CDN 时请求坏地址;交给相对路径或业务 pluginPath
|
|
401
419
|
return folder+'/'+file;
|
|
402
420
|
}
|
|
@@ -829,11 +847,25 @@
|
|
|
829
847
|
hlsPlayer=function (url){
|
|
830
848
|
var startHls=function(){
|
|
831
849
|
if (typeof Hls!=='undefined' && !isUndefined(Hls) && Hls.isSupported()) {
|
|
832
|
-
|
|
850
|
+
var hlsConf={};
|
|
851
|
+
// 断点续播:优先用 startPosition,让 hls 从正确分片/关键帧起播,避免裸 currentTime 解码失败
|
|
852
|
+
if(seekTime && seekTime>0 && (isUndefined(vars['live']) || !vars['live'])){
|
|
853
|
+
hlsConf.startPosition=seekTime;
|
|
854
|
+
maxSeeTime=Math.max(maxSeeTime,seekTime);
|
|
855
|
+
if(firstSeekTime<0){
|
|
856
|
+
firstSeekTime=seekTime;
|
|
857
|
+
}
|
|
858
|
+
seekTime=0;
|
|
859
|
+
hlsStartPositionUsed=true;
|
|
860
|
+
clearSeekRetry();
|
|
861
|
+
}
|
|
862
|
+
hls = new Hls(hlsConf);
|
|
833
863
|
hls.loadSource(url);
|
|
834
864
|
hls.attachMedia(video);
|
|
835
865
|
hls.on(Hls.Events.MANIFEST_PARSED, function(){
|
|
836
|
-
|
|
866
|
+
if(!hlsStartPositionUsed){
|
|
867
|
+
applyPendingSeek();
|
|
868
|
+
}
|
|
837
869
|
});
|
|
838
870
|
hls.on(Hls.Events.ERROR, function(event, data){
|
|
839
871
|
var code=9;
|
|
@@ -852,6 +884,13 @@
|
|
|
852
884
|
}
|
|
853
885
|
}
|
|
854
886
|
}
|
|
887
|
+
// 媒体解码类错误先尝试恢复,避免续播直接黑屏
|
|
888
|
+
if(fatal && data.type===Hls.ErrorTypes.MEDIA_ERROR && hls && typeof hls.recoverMediaError==='function'){
|
|
889
|
+
try{
|
|
890
|
+
hls.recoverMediaError();
|
|
891
|
+
fatal=false;
|
|
892
|
+
}catch(errRecover){}
|
|
893
|
+
}
|
|
855
894
|
CT.error={code:code,message:message};
|
|
856
895
|
eventTarget('error',CT.error);//注册监听error
|
|
857
896
|
if(fatal){
|
|
@@ -1601,12 +1640,42 @@
|
|
|
1601
1640
|
}
|
|
1602
1641
|
}
|
|
1603
1642
|
},
|
|
1643
|
+
/*
|
|
1644
|
+
* timeInBuffered
|
|
1645
|
+
* 功能:判断目标时间是否已在 buffered 区间内(续播前避免跳到未缓冲的非关键帧)
|
|
1646
|
+
*/
|
|
1647
|
+
timeInBuffered=function(t){
|
|
1648
|
+
if(!video || isUndefined(video.buffered)){
|
|
1649
|
+
return false;
|
|
1650
|
+
}
|
|
1651
|
+
try{
|
|
1652
|
+
var buf=video.buffered;
|
|
1653
|
+
for(var i=0;i<buf.length;i++){
|
|
1654
|
+
if(t>=buf.start(i)-0.35 && t<=buf.end(i)+0.15){
|
|
1655
|
+
return true;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}catch(event){}
|
|
1659
|
+
return false;
|
|
1660
|
+
},
|
|
1661
|
+
/*
|
|
1662
|
+
* clearSeekRetry
|
|
1663
|
+
* 功能:清理续播等待计时器
|
|
1664
|
+
*/
|
|
1665
|
+
clearSeekRetry=function(){
|
|
1666
|
+
if(seekRetryTimer){
|
|
1667
|
+
clearTimeout(seekRetryTimer);
|
|
1668
|
+
seekRetryTimer=null;
|
|
1669
|
+
}
|
|
1670
|
+
seekRetryCount=0;
|
|
1671
|
+
},
|
|
1604
1672
|
/*
|
|
1605
1673
|
* applyPendingSeek
|
|
1606
|
-
*
|
|
1674
|
+
* 功能:在媒体就绪且目标时间可解码后再应用挂起的 seekTime
|
|
1675
|
+
* 避免断点续播过早 seek 触发 PIPELINE_ERROR_DECODE(非关键帧)
|
|
1607
1676
|
*/
|
|
1608
|
-
applyPendingSeek=function(){
|
|
1609
|
-
if(!seekTime || !video){
|
|
1677
|
+
applyPendingSeek=function(force){
|
|
1678
|
+
if(!seekTime || !video || seekApplyLock){
|
|
1610
1679
|
return;
|
|
1611
1680
|
}
|
|
1612
1681
|
if(!isUndefined(vars['live']) && ((valType(vars['live'])=='boolean' && vars['live']) || valType(vars['live'])=='number')){
|
|
@@ -1617,19 +1686,93 @@
|
|
|
1617
1686
|
if(dur && isFinite(dur) && dur>0 && t>=dur){
|
|
1618
1687
|
t=Math.max(0,dur-0.3);
|
|
1619
1688
|
}
|
|
1620
|
-
|
|
1689
|
+
if(t<=0){
|
|
1690
|
+
seekTime=0;
|
|
1691
|
+
clearSeekRetry();
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
var readyEnough=!isUndefined(video.readyState) && video.readyState>=2;
|
|
1695
|
+
var bufferedOk=timeInBuffered(t);
|
|
1696
|
+
// 未进入可播缓冲时先等待,并引导 hls 加载目标位置
|
|
1697
|
+
if(!force && !bufferedOk && (!readyEnough || video.readyState<3)){
|
|
1698
|
+
seekRetryCount++;
|
|
1699
|
+
if(seekRetryCount<=50){
|
|
1700
|
+
try{
|
|
1701
|
+
if(hls && typeof hls.startLoad==='function'){
|
|
1702
|
+
hls.startLoad(t);
|
|
1703
|
+
}
|
|
1704
|
+
}catch(event){}
|
|
1705
|
+
if(seekRetryTimer){
|
|
1706
|
+
clearTimeout(seekRetryTimer);
|
|
1707
|
+
}
|
|
1708
|
+
seekRetryTimer=setTimeout(function(){
|
|
1709
|
+
applyPendingSeek(false);
|
|
1710
|
+
},200);
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
clearSeekRetry();
|
|
1621
1715
|
if(t>0){
|
|
1622
1716
|
maxSeeTime=Math.max(maxSeeTime,t);
|
|
1623
1717
|
if(firstSeekTime<0){
|
|
1624
1718
|
firstSeekTime=t;
|
|
1625
1719
|
}
|
|
1626
1720
|
}
|
|
1721
|
+
seekApplyLock=true;
|
|
1627
1722
|
seekTime=0;
|
|
1628
1723
|
try{
|
|
1629
1724
|
video.currentTime=t;
|
|
1630
1725
|
}catch(event){
|
|
1631
1726
|
seekTime=t;
|
|
1727
|
+
seekApplyLock=false;
|
|
1728
|
+
}
|
|
1729
|
+
// seeked / 短暂延时后解锁,允许后续切换清晰度再 seek
|
|
1730
|
+
setTimeout(function(){
|
|
1731
|
+
seekApplyLock=false;
|
|
1732
|
+
},800);
|
|
1733
|
+
},
|
|
1734
|
+
/*
|
|
1735
|
+
* recoverDecodeError
|
|
1736
|
+
* 功能:断点续播触发的解码错误尝试恢复(Chrome PIPELINE_ERROR_DECODE)
|
|
1737
|
+
*/
|
|
1738
|
+
recoverDecodeError=function(){
|
|
1739
|
+
if(decodeRecoverCount>=2){
|
|
1740
|
+
return false;
|
|
1632
1741
|
}
|
|
1742
|
+
decodeRecoverCount++;
|
|
1743
|
+
var resumeAt=playTime>0?playTime:(vars['seek']?parseFloat(vars['seek']):0);
|
|
1744
|
+
if(isNaN(resumeAt) || resumeAt<0){
|
|
1745
|
+
resumeAt=0;
|
|
1746
|
+
}
|
|
1747
|
+
try{
|
|
1748
|
+
if(hls && typeof hls.recoverMediaError==='function'){
|
|
1749
|
+
hls.recoverMediaError();
|
|
1750
|
+
if(resumeAt>0){
|
|
1751
|
+
seekTime=resumeAt;
|
|
1752
|
+
seekApplyLock=false;
|
|
1753
|
+
setTimeout(function(){
|
|
1754
|
+
applyPendingSeek(true);
|
|
1755
|
+
},300);
|
|
1756
|
+
}
|
|
1757
|
+
return true;
|
|
1758
|
+
}
|
|
1759
|
+
}catch(event){}
|
|
1760
|
+
try{
|
|
1761
|
+
var soft=Math.max(0,resumeAt-1.5);
|
|
1762
|
+
seekTime=resumeAt;
|
|
1763
|
+
seekApplyLock=false;
|
|
1764
|
+
if(video){
|
|
1765
|
+
video.currentTime=soft;
|
|
1766
|
+
}
|
|
1767
|
+
setTimeout(function(){
|
|
1768
|
+
applyPendingSeek(true);
|
|
1769
|
+
if(video && video.paused && vars['autoplay']){
|
|
1770
|
+
try{video.play();}catch(e2){}
|
|
1771
|
+
}
|
|
1772
|
+
},400);
|
|
1773
|
+
return true;
|
|
1774
|
+
}catch(event){}
|
|
1775
|
+
return false;
|
|
1633
1776
|
},
|
|
1634
1777
|
/*
|
|
1635
1778
|
* loadedMetaData
|
|
@@ -1821,6 +1964,12 @@
|
|
|
1821
1964
|
if(!isUndefined(errorInfo.message)){
|
|
1822
1965
|
msg=errorInfo.message;
|
|
1823
1966
|
}
|
|
1967
|
+
// code=3 MEDIA_ERR_DECODE:续播非关键帧常见,先尝试恢复
|
|
1968
|
+
if(code===3 && recoverDecodeError()){
|
|
1969
|
+
CT.error={code:code,message:msg};
|
|
1970
|
+
eventTarget('error',CT.error);
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1824
1973
|
CT.error={code:code,message:msg};
|
|
1825
1974
|
showError();
|
|
1826
1975
|
}
|
|
@@ -1874,6 +2023,8 @@
|
|
|
1874
2023
|
eventTarget('error',CT.error);//注册监听error
|
|
1875
2024
|
},
|
|
1876
2025
|
seeked:function(){
|
|
2026
|
+
seekApplyLock=false;
|
|
2027
|
+
decodeRecoverCount=0;
|
|
1877
2028
|
if(paused){
|
|
1878
2029
|
player.play();
|
|
1879
2030
|
}
|
|
@@ -2907,7 +3058,7 @@
|
|
|
2907
3058
|
break;
|
|
2908
3059
|
}
|
|
2909
3060
|
pSliderMouseDown=false;
|
|
2910
|
-
//
|
|
3061
|
+
// 媒体未就绪时只记录目标,禁止抢先 currentTime(会触发非关键帧解码失败)
|
|
2911
3062
|
var ready=video.readyState>=2 || (duration && isFinite(duration) && duration>0);
|
|
2912
3063
|
if(!ready){
|
|
2913
3064
|
seekTime=target;
|
|
@@ -2917,7 +3068,6 @@
|
|
|
2917
3068
|
firstSeekTime=target;
|
|
2918
3069
|
}
|
|
2919
3070
|
}
|
|
2920
|
-
try{video.currentTime=target;}catch(event){}
|
|
2921
3071
|
return player;
|
|
2922
3072
|
}
|
|
2923
3073
|
if(duration && isFinite(duration) && duration>0 && target>duration){
|
|
@@ -2930,6 +3080,12 @@
|
|
|
2930
3080
|
if(vars['timeScheduleAdjust']==5 && target>maxSeeTime && seekTime && Math.abs(seekTime-target)<0.5){
|
|
2931
3081
|
maxSeeTime=Math.max(maxSeeTime,target);
|
|
2932
3082
|
}
|
|
3083
|
+
// 目标尚未进入缓冲时改为挂起,由 applyPendingSeek 等待后再跳
|
|
3084
|
+
if(target>0.5 && !timeInBuffered(target) && video.readyState<3){
|
|
3085
|
+
seekTime=target;
|
|
3086
|
+
applyPendingSeek(false);
|
|
3087
|
+
return player;
|
|
3088
|
+
}
|
|
2933
3089
|
try{
|
|
2934
3090
|
video.currentTime=target;
|
|
2935
3091
|
seekTime=0;
|
|
@@ -6693,7 +6849,7 @@
|
|
|
6693
6849
|
* @file:js文件地址
|
|
6694
6850
|
* @callback:加载完成后执行的函数
|
|
6695
6851
|
*/
|
|
6696
|
-
loadJs=function(file, callback) {
|
|
6852
|
+
loadJs=function(file, callback, isRetry) {
|
|
6697
6853
|
var fn =function() {};
|
|
6698
6854
|
if(!isUndefined(callback)){
|
|
6699
6855
|
fn=callback;
|
|
@@ -6725,19 +6881,38 @@
|
|
|
6725
6881
|
} catch(event) {};
|
|
6726
6882
|
}, 10);
|
|
6727
6883
|
};
|
|
6884
|
+
var removeScript = function() {
|
|
6885
|
+
try {
|
|
6886
|
+
if(script.parentNode){
|
|
6887
|
+
script.parentNode.removeChild(script);
|
|
6888
|
+
}
|
|
6889
|
+
} catch(event) {}
|
|
6890
|
+
};
|
|
6728
6891
|
var w3c = function() {
|
|
6729
|
-
if(valType(fn) == 'function') {
|
|
6730
|
-
fn();
|
|
6731
|
-
}
|
|
6732
6892
|
removeListener(script, 'load', w3c);
|
|
6733
6893
|
removeListener(script, 'error', w3cError);
|
|
6894
|
+
doReady();
|
|
6734
6895
|
};
|
|
6735
6896
|
var w3cError = function() {
|
|
6736
|
-
if(valType(fn) == 'function') {
|
|
6737
|
-
fn();
|
|
6738
|
-
}
|
|
6739
6897
|
removeListener(script, 'load', w3c);
|
|
6740
6898
|
removeListener(script, 'error', w3cError);
|
|
6899
|
+
removeScript();
|
|
6900
|
+
// bundler 下错误 base 路径 404 时,回退 jsDelivr 再试一次
|
|
6901
|
+
if(!isRetry && (!vars || vars['cdnFallback']!==false)){
|
|
6902
|
+
var cdn=(typeof window!=='undefined' && window.ckplayerPlusCdn) ? window.ckplayerPlusCdn : ckplayerPlusDefaultCdn;
|
|
6903
|
+
var m=String(file).match(/\/(hls\.js|flv\.js|mpegts\.js|language)\/([^/?#]+)(?:[?#].*)?$/i);
|
|
6904
|
+
if(cdn && cdn.indexOf('1.0.6')===-1 && m){
|
|
6905
|
+
if(cdn.slice(-1)!=='/'){
|
|
6906
|
+
cdn+='/';
|
|
6907
|
+
}
|
|
6908
|
+
var retryUrl=cdn+m[1]+'/'+m[2];
|
|
6909
|
+
if(retryUrl!==file){
|
|
6910
|
+
loadJs(retryUrl, callback, true);
|
|
6911
|
+
return;
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
// 加载失败不再假装成功,避免在 Hls/flvjs 未定义时继续执行
|
|
6741
6916
|
};
|
|
6742
6917
|
try {
|
|
6743
6918
|
addListener(script, 'load', w3c);
|
|
@@ -7021,13 +7196,19 @@
|
|
|
7021
7196
|
function getPath(siz) {
|
|
7022
7197
|
if (typeof window !== 'undefined' && window.ckplayerBasePath) {
|
|
7023
7198
|
var base = window.ckplayerBasePath;
|
|
7024
|
-
|
|
7025
|
-
|
|
7199
|
+
// bundler chunk 目录不含插件文件,忽略并继续 script/CDN 推导
|
|
7200
|
+
if (/\/(?:assets|\.vite\/deps|_next\/static|chunks?)\/?$/i.test(base)) {
|
|
7201
|
+
base = '';
|
|
7026
7202
|
}
|
|
7027
|
-
if (
|
|
7028
|
-
|
|
7203
|
+
if (base) {
|
|
7204
|
+
if (base.slice(-1) !== '/') {
|
|
7205
|
+
base += '/';
|
|
7206
|
+
}
|
|
7207
|
+
if (!isUndefined(siz)) {
|
|
7208
|
+
return base + siz + '/';
|
|
7209
|
+
}
|
|
7210
|
+
return base;
|
|
7029
7211
|
}
|
|
7030
|
-
return base;
|
|
7031
7212
|
}
|
|
7032
7213
|
var scriptList = document.scripts || [],
|
|
7033
7214
|
thisPath = scriptList.length ? scriptList[scriptList.length - 1].src : '';
|