ezuikit-js 0.4.8 → 0.5.1
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/CHANGELOG.md +10 -0
- package/demos/react-demo/package.json +0 -1
- package/ezuikit.js +124 -49
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
package/ezuikit.js
CHANGED
|
@@ -32,6 +32,8 @@ const addJs = (filepath, callback, isReadyFun) => {
|
|
|
32
32
|
oJs.setAttribute("src", filepath);
|
|
33
33
|
oJs.onload = callback;
|
|
34
34
|
document.getElementsByTagName("head")[0].appendChild(oJs);
|
|
35
|
+
} else {
|
|
36
|
+
callback();
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
const addCss = (filepath, callback) => {
|
|
@@ -324,10 +326,17 @@ class Status {
|
|
|
324
326
|
constructor(jSPlugin,id) {
|
|
325
327
|
this.id = id;
|
|
326
328
|
this.jSPlugin = jSPlugin;
|
|
329
|
+
this.state = {
|
|
330
|
+
play: false,
|
|
331
|
+
loading: false,
|
|
332
|
+
};
|
|
327
333
|
}
|
|
328
334
|
toString() {
|
|
329
335
|
return `${this.coreX}-${this.coreY}`;
|
|
330
336
|
}
|
|
337
|
+
setPlayStatus(options) {
|
|
338
|
+
this.state = Object.assign(this.state, options);
|
|
339
|
+
}
|
|
331
340
|
loadingStart(id) {
|
|
332
341
|
var oS = document.createElement('style');
|
|
333
342
|
document.getElementsByTagName("head")[0].appendChild(oS);
|
|
@@ -390,6 +399,7 @@ class Status {
|
|
|
390
399
|
loadingContainerDOM.appendChild(loadingItemContainer);
|
|
391
400
|
}
|
|
392
401
|
loadingSetText(opt) {
|
|
402
|
+
this.loadingClearText();
|
|
393
403
|
if (document.getElementById(`${this.id}-loading-item-0`)) {
|
|
394
404
|
var textElement = document.getElementById(`${this.id}-loading-item-0`).childNodes[1];
|
|
395
405
|
if(!textElement) {
|
|
@@ -399,9 +409,13 @@ class Status {
|
|
|
399
409
|
loadingItemContainer.appendChild(textElement);
|
|
400
410
|
}
|
|
401
411
|
textElement.innerHTML = opt.text;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
412
|
+
textElement.style.color = opt.color || "#FFFFFF";
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
loadingClearText() {
|
|
416
|
+
var elements = document.getElementById(`${this.id}-loading-item-0`).childNodes;
|
|
417
|
+
if(elements.length > 1) {
|
|
418
|
+
elements[1].parentNode.removeChild(elements[1]);
|
|
405
419
|
}
|
|
406
420
|
}
|
|
407
421
|
loadingClear() {
|
|
@@ -24242,7 +24256,7 @@ TimeLine.prototype.setDateLine = function (news, defaultIndex) {
|
|
|
24242
24256
|
|
|
24243
24257
|
this.primaryOffsetH();
|
|
24244
24258
|
// 将当前播放时间片段传给父组件
|
|
24245
|
-
this.getPalyParam({ current: news[defaultIndex].st });
|
|
24259
|
+
//this.getPalyParam({ current: news[defaultIndex].st });
|
|
24246
24260
|
} else {
|
|
24247
24261
|
this.setState({
|
|
24248
24262
|
availTimeLine: []
|
|
@@ -24832,10 +24846,13 @@ class MobileRec {
|
|
|
24832
24846
|
this.jSPlugin.changePlayUrl({
|
|
24833
24847
|
begin: date,
|
|
24834
24848
|
type: this.type
|
|
24849
|
+
}).then(()=> {
|
|
24850
|
+
this.syncTimeLine();
|
|
24835
24851
|
});
|
|
24836
24852
|
};
|
|
24837
24853
|
const ontouchstart = () => {
|
|
24838
24854
|
this.operating = true;
|
|
24855
|
+
this.unSyncTimeLine();
|
|
24839
24856
|
// if (currentTimer) {
|
|
24840
24857
|
// clearInterval(currentTimer)
|
|
24841
24858
|
// }
|
|
@@ -24880,38 +24897,22 @@ class MobileRec {
|
|
|
24880
24897
|
this.fetchDeviceRec();
|
|
24881
24898
|
this.jSPlugin.changePlayUrl({
|
|
24882
24899
|
type: this.type,
|
|
24883
|
-
begin: `${new Date(this.date).Format('
|
|
24900
|
+
begin: `${new Date(this.date).Format('yyyyMMdd')}000000`
|
|
24901
|
+
})
|
|
24902
|
+
.then(()=>{
|
|
24903
|
+
console.log("切换类型成功");
|
|
24904
|
+
this.syncTimeLine();
|
|
24905
|
+
},(err)=>{
|
|
24906
|
+
console.log("err",err);
|
|
24907
|
+
})
|
|
24908
|
+
.catch(err=>{
|
|
24909
|
+
console.log(err);
|
|
24884
24910
|
});
|
|
24885
24911
|
// document.getElementById("cloudType").setAttribute("checked", true);
|
|
24886
24912
|
// $("#cloudType").attr("checked", recType == '2');
|
|
24887
24913
|
// $("#cloudType .device svg").attr("checked", recType == '2');
|
|
24888
24914
|
});
|
|
24889
|
-
|
|
24890
|
-
var time = new Date(now);
|
|
24891
|
-
var h = time.getHours(); //返回日期中的小时数(0到23)
|
|
24892
|
-
var m = time.getMinutes(); //返回日期中的分钟数(0到59)
|
|
24893
|
-
var s = time.getSeconds(); //返回日期中的秒数(0到59)
|
|
24894
|
-
return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
|
|
24895
|
-
};
|
|
24896
|
-
this.timer = setInterval(() => {
|
|
24897
|
-
// 定时器
|
|
24898
|
-
console.log("定时器", this.jSPlugin.getOSDTime());
|
|
24899
|
-
if (this.operating) {
|
|
24900
|
-
console.log("操作中");
|
|
24901
|
-
return false;
|
|
24902
|
-
}
|
|
24903
|
-
this.jSPlugin.getOSDTime()
|
|
24904
|
-
.then((data)=>{
|
|
24905
|
-
if (data.data > 0) {
|
|
24906
|
-
this.TimeLineOBJ.stepScrollTimeLine(dateFormat(data.data * 1000));
|
|
24907
|
-
} else {
|
|
24908
|
-
console.log("未找到当前获取播放时间,等待中...");
|
|
24909
|
-
}
|
|
24910
|
-
})
|
|
24911
|
-
.catch((err)=>{
|
|
24912
|
-
console.log("未找到当前获取播放时间,等待中...");
|
|
24913
|
-
});
|
|
24914
|
-
}, 1000);
|
|
24915
|
+
this.syncTimeLine();
|
|
24915
24916
|
}
|
|
24916
24917
|
fetchDeviceRec() {
|
|
24917
24918
|
const doRender = (result) => {
|
|
@@ -24957,23 +24958,32 @@ class MobileRec {
|
|
|
24957
24958
|
}
|
|
24958
24959
|
|
|
24959
24960
|
syncTimeLine() {
|
|
24961
|
+
var dateFormat = function (now) {
|
|
24962
|
+
var time = new Date(now);
|
|
24963
|
+
var h = time.getHours(); //返回日期中的小时数(0到23)
|
|
24964
|
+
var m = time.getMinutes(); //返回日期中的分钟数(0到59)
|
|
24965
|
+
var s = time.getSeconds(); //返回日期中的秒数(0到59)
|
|
24966
|
+
return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
|
|
24967
|
+
};
|
|
24960
24968
|
if (this.timer) {
|
|
24961
24969
|
clearInterval(this.timer);
|
|
24962
24970
|
}
|
|
24963
24971
|
this.timer = setInterval(() => {
|
|
24964
|
-
|
|
24965
|
-
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
24972
|
+
// 定时器
|
|
24973
|
+
if (this.operating) {
|
|
24974
|
+
console.log("操作中");
|
|
24975
|
+
return false;
|
|
24976
|
+
}
|
|
24977
|
+
this.jSPlugin.getOSDTime()
|
|
24978
|
+
.then((res)=>{
|
|
24979
|
+
if (res.data > 0) {
|
|
24980
|
+
this.TimeLineOBJ.stepScrollTimeLine(dateFormat(res.data * 1000));
|
|
24981
|
+
} else {
|
|
24982
|
+
console.log("未找到当前获取播放时间,等待中...");
|
|
24973
24983
|
}
|
|
24974
|
-
}
|
|
24975
|
-
|
|
24976
|
-
|
|
24984
|
+
})
|
|
24985
|
+
.catch((err)=>{
|
|
24986
|
+
console.log("未找到当前获取播放时间,等待中...");
|
|
24977
24987
|
});
|
|
24978
24988
|
}, 1000);
|
|
24979
24989
|
}
|
|
@@ -26160,6 +26170,44 @@ class Theme {
|
|
|
26160
26170
|
this.renderThemeData();
|
|
26161
26171
|
});
|
|
26162
26172
|
}
|
|
26173
|
+
changeTheme(options) {
|
|
26174
|
+
if(typeof options === 'string') {
|
|
26175
|
+
switch (this.jSPlugin.themeId) {
|
|
26176
|
+
case 'pcLive':
|
|
26177
|
+
this.themeData = pcLiveData.data;
|
|
26178
|
+
this.initThemeData();
|
|
26179
|
+
this.renderThemeData();
|
|
26180
|
+
break;
|
|
26181
|
+
case 'pcRec':
|
|
26182
|
+
this.themeData = pcRecData.data;
|
|
26183
|
+
this.initThemeData();
|
|
26184
|
+
this.renderThemeData();
|
|
26185
|
+
break;
|
|
26186
|
+
case 'mobileLive':
|
|
26187
|
+
this.themeData = mobileLiveData.data;
|
|
26188
|
+
this.initThemeData();
|
|
26189
|
+
this.renderThemeData();
|
|
26190
|
+
break;
|
|
26191
|
+
case 'mobileRec':
|
|
26192
|
+
this.themeData = mobileRecData.data;
|
|
26193
|
+
this.initThemeData();
|
|
26194
|
+
this.renderThemeData();
|
|
26195
|
+
break;
|
|
26196
|
+
case 'themeData':
|
|
26197
|
+
this.themeData = this.jSPlugin.params.themeData;
|
|
26198
|
+
this.initThemeData();
|
|
26199
|
+
this.renderThemeData();
|
|
26200
|
+
break;
|
|
26201
|
+
default:
|
|
26202
|
+
this.fetchThemeData(options);
|
|
26203
|
+
break;
|
|
26204
|
+
}
|
|
26205
|
+
} else if (typeof options === 'object') {
|
|
26206
|
+
this.themeData = options;
|
|
26207
|
+
this.initThemeData();
|
|
26208
|
+
this.renderThemeData();
|
|
26209
|
+
}
|
|
26210
|
+
}
|
|
26163
26211
|
renderThemeData() {
|
|
26164
26212
|
const { header, footer } = this.themeData;
|
|
26165
26213
|
if (this.isNeedRenderHeader && header) {
|
|
@@ -26880,10 +26928,10 @@ class Theme {
|
|
|
26880
26928
|
this.header = defaultTheme.header;
|
|
26881
26929
|
this.footer = defaultTheme.footer;
|
|
26882
26930
|
this.isNeedRenderHeader = lodash.findIndex(header.btnList, (v)=>{
|
|
26883
|
-
return v.isrender
|
|
26931
|
+
return v.isrender > 0;
|
|
26884
26932
|
}) >= 0;
|
|
26885
26933
|
this.isNeedRenderFooter = lodash.findIndex(footer.btnList, (v)=>{
|
|
26886
|
-
return v.isrender
|
|
26934
|
+
return v.isrender > 0;
|
|
26887
26935
|
}) >= 0;
|
|
26888
26936
|
if (this.isNeedRenderHeader) {
|
|
26889
26937
|
if (!document.getElementById(`${this.jSPlugin.id}-headControl`)) {
|
|
@@ -26962,9 +27010,9 @@ class Theme {
|
|
|
26962
27010
|
}
|
|
26963
27011
|
});
|
|
26964
27012
|
}
|
|
26965
|
-
var isNeedRenderTimeLine = lodash.findIndex(this.themeData.header.btnList, (v)=>{
|
|
27013
|
+
var isNeedRenderTimeLine = (lodash.findIndex(this.themeData.header.btnList, (v)=>{
|
|
26966
27014
|
return (v.iconId === 'cloudRec' && v.isrender === 1) || (v.iconId === 'rec' && v.isrender === 1) ;
|
|
26967
|
-
}) >= 0 || (this.isMobile &&matchEzopenUrl(jSPlugin.url).type.indexOf('rec') !== -1);
|
|
27015
|
+
}) >= 0 || (this.isMobile && matchEzopenUrl(this.jSPlugin.url).type.indexOf('rec') !== -1)) && !this.jSPlugin.disabledTimeLine;
|
|
26968
27016
|
if (isNeedRenderTimeLine) {
|
|
26969
27017
|
if (this.isMobile) {
|
|
26970
27018
|
this.Rec = new MobileRec(this.jSPlugin);
|
|
@@ -27623,6 +27671,9 @@ class Monitor {
|
|
|
27623
27671
|
}
|
|
27624
27672
|
}
|
|
27625
27673
|
EZUIKit.opt = _this.opt;
|
|
27674
|
+
if(window.EZUIKit) {
|
|
27675
|
+
window.EZUIKit.opt = _this.opt;
|
|
27676
|
+
}
|
|
27626
27677
|
}
|
|
27627
27678
|
request(_this.opt.apiDomain, 'POST', {
|
|
27628
27679
|
accessToken: _this.opt.accessToken,
|
|
@@ -28236,7 +28287,7 @@ class Monitor {
|
|
|
28236
28287
|
break;
|
|
28237
28288
|
case 'stopTalk':
|
|
28238
28289
|
// window.stopTalk()
|
|
28239
|
-
|
|
28290
|
+
_this.stopTalk();
|
|
28240
28291
|
_this.openSound();
|
|
28241
28292
|
break;
|
|
28242
28293
|
case 'clickEventHandle':
|
|
@@ -28581,6 +28632,9 @@ class Monitor {
|
|
|
28581
28632
|
console.log(this.opt);
|
|
28582
28633
|
var _this = this;
|
|
28583
28634
|
EZUIKit.opt = this.opt;
|
|
28635
|
+
if(window.EZUIKit) {
|
|
28636
|
+
window.EZUIKit.opt = this.opt;
|
|
28637
|
+
}
|
|
28584
28638
|
var apiSuccess = function(data) {
|
|
28585
28639
|
if (data.code == 200) {
|
|
28586
28640
|
var apiResult = data.data;
|
|
@@ -29340,6 +29394,7 @@ class EZUIKitPlayer {
|
|
|
29340
29394
|
this.audio = true;
|
|
29341
29395
|
this.poster = params.poster;
|
|
29342
29396
|
this.speed = 1;
|
|
29397
|
+
this.disabledTimeLine = false;
|
|
29343
29398
|
this.env = {
|
|
29344
29399
|
domain: "https://open.ys7.com"
|
|
29345
29400
|
};
|
|
@@ -29350,6 +29405,9 @@ class EZUIKitPlayer {
|
|
|
29350
29405
|
if (typeof params.audio !== 'undefined') {
|
|
29351
29406
|
this.audio = params.audio;
|
|
29352
29407
|
}
|
|
29408
|
+
if (typeof params.disabledTimeLine !== 'undefined') {
|
|
29409
|
+
this.disabledTimeLine = params.disabledTimeLine;
|
|
29410
|
+
}
|
|
29353
29411
|
addJs(`${this.staticPath}/js/jsPlugin-4.0.2.min.js`, () => {
|
|
29354
29412
|
if (autoplay) {
|
|
29355
29413
|
this.initTime = new Date().getTime();
|
|
@@ -29841,6 +29899,7 @@ class EZUIKitPlayer {
|
|
|
29841
29899
|
this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(() => {
|
|
29842
29900
|
console.log("播放成功");
|
|
29843
29901
|
this.pluginStatus.loadingClear();
|
|
29902
|
+
this.pluginStatus.setPlayStatus({play: true, loading: false});
|
|
29844
29903
|
if (this.Theme) {
|
|
29845
29904
|
this.Theme.setDecoderState({ play: true });
|
|
29846
29905
|
}
|
|
@@ -29888,6 +29947,7 @@ class EZUIKitPlayer {
|
|
|
29888
29947
|
});
|
|
29889
29948
|
}
|
|
29890
29949
|
play(options) {
|
|
29950
|
+
this.pluginStatus.setPlayStatus({play: false, loading: true});
|
|
29891
29951
|
this.playStartTime = new Date().getTime();
|
|
29892
29952
|
this.Monitor.dclog({
|
|
29893
29953
|
url: this.url,
|
|
@@ -29931,8 +29991,10 @@ class EZUIKitPlayer {
|
|
|
29931
29991
|
return promise;
|
|
29932
29992
|
}
|
|
29933
29993
|
stop() {
|
|
29994
|
+
this.pluginStatus.setPlayStatus({loading: true});
|
|
29934
29995
|
return this.jSPlugin.JS_Stop(0).then(() => {
|
|
29935
29996
|
console.log("停止成功");
|
|
29997
|
+
this.pluginStatus.setPlayStatus({play: false,loading: false});
|
|
29936
29998
|
if (this.Theme) {
|
|
29937
29999
|
this.Theme.setDecoderState({ play: false });
|
|
29938
30000
|
}
|
|
@@ -29951,11 +30013,18 @@ class EZUIKitPlayer {
|
|
|
29951
30013
|
return this.play({
|
|
29952
30014
|
accessToken: options.accessToken,
|
|
29953
30015
|
url: url
|
|
30016
|
+
}).then(() => {
|
|
30017
|
+
resolve(url);
|
|
30018
|
+
}).catch((err) => {
|
|
30019
|
+
reject(url);
|
|
29954
30020
|
});
|
|
29955
30021
|
}
|
|
29956
30022
|
this.play(url)
|
|
29957
30023
|
.then(() => {
|
|
29958
30024
|
resolve(url);
|
|
30025
|
+
})
|
|
30026
|
+
.catch((err) => {
|
|
30027
|
+
reject(url);
|
|
29959
30028
|
});
|
|
29960
30029
|
})
|
|
29961
30030
|
.catch((err) => {
|
|
@@ -29965,11 +30034,17 @@ class EZUIKitPlayer {
|
|
|
29965
30034
|
return this.play({
|
|
29966
30035
|
accessToken: options.accessToken,
|
|
29967
30036
|
url: url
|
|
30037
|
+
}).then(() => {
|
|
30038
|
+
resolve(url);
|
|
30039
|
+
}).catch((err) => {
|
|
30040
|
+
reject(url);
|
|
29968
30041
|
});
|
|
29969
30042
|
}
|
|
29970
30043
|
this.play(url)
|
|
29971
30044
|
.then(() => {
|
|
29972
30045
|
resolve(url);
|
|
30046
|
+
}).catch((err) => {
|
|
30047
|
+
reject(url);
|
|
29973
30048
|
});
|
|
29974
30049
|
});
|
|
29975
30050
|
});
|
|
@@ -30318,7 +30393,7 @@ class EZUIKitPlayer {
|
|
|
30318
30393
|
this.Talk.startTalk();
|
|
30319
30394
|
}
|
|
30320
30395
|
stopTalk() {
|
|
30321
|
-
this.Talk.
|
|
30396
|
+
this.Talk.stopTalk();
|
|
30322
30397
|
}
|
|
30323
30398
|
destroy() {
|
|
30324
30399
|
var destroyRT = this.jSPlugin.JS_DestroyWorker(0);
|