ezuikit-js 0.4.7 → 0.5.0

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.
Files changed (2) hide show
  1. package/ezuikit.js +78 -50
  2. package/package.json +1 -1
package/ezuikit.js CHANGED
@@ -324,10 +324,17 @@ class Status {
324
324
  constructor(jSPlugin,id) {
325
325
  this.id = id;
326
326
  this.jSPlugin = jSPlugin;
327
+ this.state = {
328
+ play: false,
329
+ loading: false,
330
+ };
327
331
  }
328
332
  toString() {
329
333
  return `${this.coreX}-${this.coreY}`;
330
334
  }
335
+ setPlayStatus(options) {
336
+ this.state = Object.assign(this.state, options);
337
+ }
331
338
  loadingStart(id) {
332
339
  var oS = document.createElement('style');
333
340
  document.getElementsByTagName("head")[0].appendChild(oS);
@@ -390,6 +397,7 @@ class Status {
390
397
  loadingContainerDOM.appendChild(loadingItemContainer);
391
398
  }
392
399
  loadingSetText(opt) {
400
+ this.loadingClear();
393
401
  if (document.getElementById(`${this.id}-loading-item-0`)) {
394
402
  var textElement = document.getElementById(`${this.id}-loading-item-0`).childNodes[1];
395
403
  if(!textElement) {
@@ -24242,7 +24250,7 @@ TimeLine.prototype.setDateLine = function (news, defaultIndex) {
24242
24250
 
24243
24251
  this.primaryOffsetH();
24244
24252
  // 将当前播放时间片段传给父组件
24245
- this.getPalyParam({ current: news[defaultIndex].st });
24253
+ //this.getPalyParam({ current: news[defaultIndex].st });
24246
24254
  } else {
24247
24255
  this.setState({
24248
24256
  availTimeLine: []
@@ -24832,10 +24840,13 @@ class MobileRec {
24832
24840
  this.jSPlugin.changePlayUrl({
24833
24841
  begin: date,
24834
24842
  type: this.type
24843
+ }).then(()=> {
24844
+ this.syncTimeLine();
24835
24845
  });
24836
24846
  };
24837
24847
  const ontouchstart = () => {
24838
24848
  this.operating = true;
24849
+ this.unSyncTimeLine();
24839
24850
  // if (currentTimer) {
24840
24851
  // clearInterval(currentTimer)
24841
24852
  // }
@@ -24880,38 +24891,22 @@ class MobileRec {
24880
24891
  this.fetchDeviceRec();
24881
24892
  this.jSPlugin.changePlayUrl({
24882
24893
  type: this.type,
24883
- begin: `${new Date(this.date).Format('yyyMMdd000000')}`
24894
+ begin: `${new Date(this.date).Format('yyyyMMdd')}000000`
24895
+ })
24896
+ .then(()=>{
24897
+ console.log("切换类型成功");
24898
+ this.syncTimeLine();
24899
+ },(err)=>{
24900
+ console.log("err",err);
24901
+ })
24902
+ .catch(err=>{
24903
+ console.log(err);
24884
24904
  });
24885
24905
  // document.getElementById("cloudType").setAttribute("checked", true);
24886
24906
  // $("#cloudType").attr("checked", recType == '2');
24887
24907
  // $("#cloudType .device svg").attr("checked", recType == '2');
24888
24908
  });
24889
- var dateFormat = function (now) {
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);
24909
+ this.syncTimeLine();
24915
24910
  }
24916
24911
  fetchDeviceRec() {
24917
24912
  const doRender = (result) => {
@@ -24957,23 +24952,32 @@ class MobileRec {
24957
24952
  }
24958
24953
 
24959
24954
  syncTimeLine() {
24955
+ var dateFormat = function (now) {
24956
+ var time = new Date(now);
24957
+ var h = time.getHours(); //返回日期中的小时数(0到23)
24958
+ var m = time.getMinutes(); //返回日期中的分钟数(0到59)
24959
+ var s = time.getSeconds(); //返回日期中的秒数(0到59)
24960
+ return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m) + ':' + (s > 9 ? s : '0' + s);
24961
+ };
24960
24962
  if (this.timer) {
24961
24963
  clearInterval(this.timer);
24962
24964
  }
24963
24965
  this.timer = setInterval(() => {
24964
- var getOSDTimePromise = this.jSPlugin.getOSDTime();
24965
- getOSDTimePromise.then((v) => {
24966
- if (v == -1) {
24967
- console.log("获取播放时间错误");
24968
- } else {
24969
- if (v > 0) {
24970
- //console.log("获取播放时间", v, this.timeLine.run);
24971
- this.timeLine.run({ time: new Date(v > 1000000000000 ? v : v * 1000) });
24972
- //$(".current-time").text(new Date(new Date(v > 1000000000000 ? v : v * 1000)).Format('yyyy-MM-dd hh:mm:ss'))
24966
+ // 定时器
24967
+ if (this.operating) {
24968
+ console.log("操作中");
24969
+ return false;
24970
+ }
24971
+ this.jSPlugin.getOSDTime()
24972
+ .then((res)=>{
24973
+ if (res.data > 0) {
24974
+ this.TimeLineOBJ.stepScrollTimeLine(dateFormat(res.data * 1000));
24975
+ } else {
24976
+ console.log("未找到当前获取播放时间,等待中...");
24973
24977
  }
24974
- }
24975
- })
24976
- .catch((err) => {
24978
+ })
24979
+ .catch((err)=>{
24980
+ console.log("未找到当前获取播放时间,等待中...");
24977
24981
  });
24978
24982
  }, 1000);
24979
24983
  }
@@ -26115,21 +26119,12 @@ class Theme {
26115
26119
  this.themeData = this.jSPlugin.params.themeData;
26116
26120
  this.initThemeData();
26117
26121
  this.renderThemeData();
26122
+ break;
26118
26123
  default:
26119
26124
  this.fetchThemeData(this.jSPlugin.themeId);
26120
26125
  break;
26121
26126
  }
26122
26127
  }
26123
- var isNeedRenderTimeLine = lodash.findIndex(this.themeData.header.btnList, (v)=>{
26124
- return (v.iconId === 'cloudRec' && v.isrender === 1) || (v.iconId === 'rec' && v.isrender === 1) ;
26125
- }) >= 0 || (this.isMobile &&matchEzopenUrl(jSPlugin.url).type.indexOf('rec') !== -1);
26126
- if (isNeedRenderTimeLine) {
26127
- if (this.isMobile) {
26128
- this.Rec = new MobileRec(jSPlugin);
26129
- } else {
26130
- this.Rec = new Rec(jSPlugin);
26131
- }
26132
- }
26133
26128
  if (!this.jSPlugin.Talk) {
26134
26129
  this.jSPlugin.Talk = new Talk(this.jSPlugin);
26135
26130
  }
@@ -26971,6 +26966,16 @@ class Theme {
26971
26966
  }
26972
26967
  });
26973
26968
  }
26969
+ var isNeedRenderTimeLine = lodash.findIndex(this.themeData.header.btnList, (v)=>{
26970
+ return (v.iconId === 'cloudRec' && v.isrender === 1) || (v.iconId === 'rec' && v.isrender === 1) ;
26971
+ }) >= 0 || (this.isMobile &&matchEzopenUrl(this.jSPlugin.url).type.indexOf('rec') !== -1);
26972
+ if (isNeedRenderTimeLine) {
26973
+ if (this.isMobile) {
26974
+ this.Rec = new MobileRec(this.jSPlugin);
26975
+ } else {
26976
+ this.Rec = new Rec(this.jSPlugin);
26977
+ }
26978
+ }
26974
26979
  // 监听全屏事件触发
26975
26980
  const fullscreenchange = () => {
26976
26981
  const { expend, webExpend } = this.decoderState.state;
@@ -27622,6 +27627,9 @@ class Monitor {
27622
27627
  }
27623
27628
  }
27624
27629
  EZUIKit.opt = _this.opt;
27630
+ if(window.EZUIKit) {
27631
+ window.EZUIKit.opt = this.opt;
27632
+ }
27625
27633
  }
27626
27634
  request(_this.opt.apiDomain, 'POST', {
27627
27635
  accessToken: _this.opt.accessToken,
@@ -28580,6 +28588,9 @@ class Monitor {
28580
28588
  console.log(this.opt);
28581
28589
  var _this = this;
28582
28590
  EZUIKit.opt = this.opt;
28591
+ if(window.EZUIKit) {
28592
+ window.EZUIKit.opt = this.opt;
28593
+ }
28583
28594
  var apiSuccess = function(data) {
28584
28595
  if (data.code == 200) {
28585
28596
  var apiResult = data.data;
@@ -29840,6 +29851,7 @@ class EZUIKitPlayer {
29840
29851
  this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(() => {
29841
29852
  console.log("播放成功");
29842
29853
  this.pluginStatus.loadingClear();
29854
+ this.pluginStatus.setPlayStatus({play: true, loading: false});
29843
29855
  if (this.Theme) {
29844
29856
  this.Theme.setDecoderState({ play: true });
29845
29857
  }
@@ -29887,6 +29899,7 @@ class EZUIKitPlayer {
29887
29899
  });
29888
29900
  }
29889
29901
  play(options) {
29902
+ this.pluginStatus.setPlayStatus({play: false, loading: true});
29890
29903
  this.playStartTime = new Date().getTime();
29891
29904
  this.Monitor.dclog({
29892
29905
  url: this.url,
@@ -29930,8 +29943,10 @@ class EZUIKitPlayer {
29930
29943
  return promise;
29931
29944
  }
29932
29945
  stop() {
29946
+ this.pluginStatus.setPlayStatus({loading: true});
29933
29947
  return this.jSPlugin.JS_Stop(0).then(() => {
29934
29948
  console.log("停止成功");
29949
+ this.pluginStatus.setPlayStatus({play: false,loading: false});
29935
29950
  if (this.Theme) {
29936
29951
  this.Theme.setDecoderState({ play: false });
29937
29952
  }
@@ -29950,11 +29965,18 @@ class EZUIKitPlayer {
29950
29965
  return this.play({
29951
29966
  accessToken: options.accessToken,
29952
29967
  url: url
29968
+ }).then(() => {
29969
+ resolve(url);
29970
+ }).catch((err) => {
29971
+ reject(url);
29953
29972
  });
29954
29973
  }
29955
29974
  this.play(url)
29956
29975
  .then(() => {
29957
29976
  resolve(url);
29977
+ })
29978
+ .catch((err) => {
29979
+ reject(url);
29958
29980
  });
29959
29981
  })
29960
29982
  .catch((err) => {
@@ -29964,11 +29986,17 @@ class EZUIKitPlayer {
29964
29986
  return this.play({
29965
29987
  accessToken: options.accessToken,
29966
29988
  url: url
29989
+ }).then(() => {
29990
+ resolve(url);
29991
+ }).catch((err) => {
29992
+ reject(url);
29967
29993
  });
29968
29994
  }
29969
29995
  this.play(url)
29970
29996
  .then(() => {
29971
29997
  resolve(url);
29998
+ }).catch((err) => {
29999
+ reject(url);
29972
30000
  });
29973
30001
  });
29974
30002
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezuikit-js",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "description": "ezuikit javascript for npm",
5
5
  "main": "ezuikit.js",
6
6
  "scripts": {