ezuikit-js 0.4.2 → 0.4.3

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 +278 -90
  2. package/package.json +1 -1
package/ezuikit.js CHANGED
@@ -317,8 +317,9 @@ class FLV {
317
317
  function insertAfter(newElement, targetElement) { var parent = targetElement.parentNode; if (parent.lastChild == targetElement) { parent.appendChild(newElement); } else { parent.insertBefore(newElement, targetElement.nextSibling); } }
318
318
 
319
319
  class Status {
320
- constructor(id) {
320
+ constructor(jSPlugin,id) {
321
321
  this.id = id;
322
+ this.jSPlugin = jSPlugin;
322
323
  }
323
324
  toString() {
324
325
  return `${this.coreX}-${this.coreY}`;
@@ -340,6 +341,10 @@ class Status {
340
341
  var loadingContainerDOM = document.createElement('div');
341
342
  loadingContainerDOM.setAttribute('id', `${id}-loading-id-0`);
342
343
  var style = 'position:absolute;outline:none;pointer-events:none;';
344
+ console.log("this.jSPlugin",this.jSPlugin);
345
+ if(typeof this.jSPlugin.poster === 'string') {
346
+ style += `background: url(${this.jSPlugin.poster}) no-repeat;background-size: cover;`;
347
+ }
343
348
  style += 'width: 100%;';
344
349
  style += 'height: 100%;';
345
350
  style += 'top:' + offsetTop + ';';
@@ -400,6 +405,14 @@ class Status {
400
405
  for (var i = elements.length - 1; i >= 0; i--) {
401
406
  elements[i].parentNode.removeChild(elements[i]);
402
407
  }
408
+ if(document.getElementById(`${this.id}-loading-id-0`)) {
409
+ document.getElementById(`${this.id}-loading-id-0`).style.background = 'none';
410
+ }
411
+ }
412
+ setPoster(pic) {
413
+ if(document.getElementById(`${this.id}-loading-id-0`)) {
414
+ document.getElementById(`${this.id}-loading-id-0`).style.backgroundImage = `url(${pic})`;
415
+ }
403
416
  }
404
417
  loadingEnd() {
405
418
  var loadingItemContainerDOM = document.getElementById(`${this.id}-loading-item-0`);
@@ -410,6 +423,7 @@ class Status {
410
423
  loadingContainerDOM.parentNode.removeChild(loadingContainerDOM);
411
424
  }
412
425
  }
426
+ document.getElementById(`${this.id}-loading-item-0`).style.background = 'none';
413
427
  }
414
428
  }
415
429
 
@@ -28587,22 +28601,22 @@ var EZUIKitV3$1 = EZUIKitV3;
28587
28601
 
28588
28602
  // iframe模板 - 兼容旧版本
28589
28603
  const matchTemplate = (templateName, params) => {
28590
- const IFRAMETEMPLATE = ['simple','standard','security','vioce','theme'];
28591
- const LOCALTEMPLATE = ['pcLive','pcRec','mobileLive','mobileRec','noData'];
28592
- if(typeof templateName === 'undefined') {
28604
+ const IFRAMETEMPLATE = ['simple', 'standard', 'security', 'vioce', 'theme'];
28605
+ const LOCALTEMPLATE = ['pcLive', 'pcRec', 'mobileLive', 'mobileRec', 'noData'];
28606
+ if (typeof templateName === 'undefined') {
28593
28607
  return {
28594
28608
  templateType: 'local',
28595
28609
  templateId: ''
28596
28610
  }
28597
28611
  } if (typeof templateName === 'string') {
28598
28612
 
28599
- if(templateName.length === 32) {
28613
+ if (templateName.length === 32) {
28600
28614
  return {
28601
28615
  templateType: 'remote',
28602
28616
  templateId: templateName
28603
28617
  }
28604
28618
  } else if (IFRAMETEMPLATE.indexOf(templateName) !== -1) {
28605
- // 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
28619
+ // 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
28606
28620
  if (templateName === 'simple' && typeof params.header === 'undefined' && typeof params.footer === 'undefined') {
28607
28621
  return {
28608
28622
  templateType: 'local',
@@ -28626,14 +28640,16 @@ class EZUIKitPlayer {
28626
28640
  constructor(params) {
28627
28641
  const { autoplay = true } = params;
28628
28642
  this.params = params;
28629
- window.EZUIKit[params.id] = {state: {
28630
- EZUIKitPlayer: {
28631
- init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
28632
- themeInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit || false,
28633
- talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
28634
- }}
28643
+ window.EZUIKit[params.id] = {
28644
+ state: {
28645
+ EZUIKitPlayer: {
28646
+ init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
28647
+ themeInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit || false,
28648
+ talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
28649
+ }
28650
+ }
28635
28651
  };
28636
- if(matchTemplate(this.params.template, params).templateType !== 'iframe'){
28652
+ if (matchTemplate(this.params.template, params).templateType !== 'iframe') {
28637
28653
  this.id = params.id;
28638
28654
  this.width = params.width;
28639
28655
  this.height = params.height;
@@ -28642,25 +28658,41 @@ class EZUIKitPlayer {
28642
28658
  this.themeId = matchTemplate(params.template, params).templateId;
28643
28659
  this.id = params.id;
28644
28660
  this.audio = params.audio;
28661
+ this.poster = params.poster;
28662
+ this.speed = 1;
28645
28663
  this.staticPath = "https://open.ys7.com/assets/ezuikit_v4.0";
28646
- if(typeof params.staticPath === 'string') {
28664
+ if (typeof params.staticPath === 'string') {
28647
28665
  this.staticPath = params.staticPath;
28648
28666
  }
28649
28667
  addJs(`${this.staticPath}/js/AudioRenderer.js`, () => {
28650
28668
  addJs(`${this.staticPath}/js/SuperRender_10.js`, () => {
28651
28669
  addJs(`${this.staticPath}/js/jsPlugin-4.0.2.min.js`, () => {
28652
- var initEZUIKitPlayerPromise = this.initEZUIKitPlayer(params);
28653
- initEZUIKitPlayerPromise.then((data) => {
28654
- console.log("初始化成功", data);
28655
- window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
28656
- if (document.getElementById(`${params.id}canvas_draw0`)) {
28657
- document.getElementById(`${params.id}canvas_draw0`).style.border = "none";
28658
- }
28659
- if (autoplay) {
28660
- //next version 此处可采用promise.all将播放接口部分同步到初始化阶段。
28661
- this.play();
28662
- }
28663
- });
28670
+ if (autoplay) {
28671
+ var initEZUIKitPlayerPromise = this.initEZUIKitPlayer(params);
28672
+ var getRealUrlPromise = this._getRealUrlPromise(params.accessToken, params.url);
28673
+ Promise.all([initEZUIKitPlayerPromise, getRealUrlPromise]).then(values => {
28674
+ console.log("values", values);
28675
+ if (values[1]) {
28676
+ this._pluginPlay(values[1],
28677
+ () => { console.log("自动播放成功"); },
28678
+ () => { console.log("自动播放失败"); },
28679
+ );
28680
+ }
28681
+ window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
28682
+ if (document.getElementById(`${params.id}canvas_draw0`)) {
28683
+ document.getElementById(`${params.id}canvas_draw0`).style.border = "none";
28684
+ }
28685
+ });
28686
+ } else {
28687
+ var initEZUIKitPlayerPromise = this.initEZUIKitPlayer(params);
28688
+ initEZUIKitPlayerPromise.then((data) => {
28689
+ console.log("初始化成功", data);
28690
+ window.EZUIKit[params.id].state.EZUIKitPlayer.init = true;
28691
+ if (document.getElementById(`${params.id}canvas_draw0`)) {
28692
+ document.getElementById(`${params.id}canvas_draw0`).style.border = "none";
28693
+ }
28694
+ });
28695
+ }
28664
28696
  });
28665
28697
  });
28666
28698
  });
@@ -28740,7 +28772,7 @@ class EZUIKitPlayer {
28740
28772
  }
28741
28773
  };
28742
28774
  // 增加视频容器
28743
- var pluginStatus = new Status(id);
28775
+ var pluginStatus = new Status(this, id);
28744
28776
  pluginStatus.loadingStart(id);
28745
28777
  pluginStatus.loadingSetText({ text: '初始化播放器完成' });
28746
28778
  this.env = {
@@ -29065,67 +29097,136 @@ class EZUIKitPlayer {
29065
29097
  return new Date(date.replace(/-/g, '/')).getTime();
29066
29098
  }
29067
29099
  }
29068
- play() {
29100
+ _pluginPlay(data, successCallback, errorCallback) {
29101
+ console.log("get real url result ===", data);
29102
+ function getPlayParams(url) {
29103
+ var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
29104
+ var websocketStreamingParam = (url.indexOf('/live') === -1 ? (url.indexOf('cloudplayback') !== -1 ? '/cloudplayback?' : '/playback?') : '/live?') + url.split('?')[1];
29105
+ if (websocketStreamingParam.indexOf('/playback') !== -1) {
29106
+ websocketStreamingParam = websocketStreamingParam.replace("stream=2", 'stream=1');
29107
+ }
29108
+ // 本地回放仅支持主码流
29109
+ return {
29110
+ websocketConnectUrl: websocketConnectUrl,
29111
+ websocketStreamingParam: websocketStreamingParam
29112
+ };
29113
+ }
29114
+ var wsUrl = getPlayParams(data).websocketConnectUrl;
29115
+ if (this.env && this.env.wsUrl) {
29116
+ wsUrl = this.env.wsUrl;
29117
+ }
29118
+ var wsParams = {
29119
+ playURL: getPlayParams(data).websocketStreamingParam
29120
+ };
29121
+
29122
+ this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(() => {
29123
+ console.log("播放成功");
29124
+ this.pluginStatus.loadingClear();
29125
+ if (this.Theme) {
29126
+ this.Theme.setDecoderState({ play: true });
29127
+ }
29128
+ if (this.audio) {
29129
+ setTimeout(() => {
29130
+ this.openSound();
29131
+ }, 500);
29132
+ }
29133
+ if (typeof this.params.handleSuccess === 'function') {
29134
+ this.params.handleSuccess({
29135
+ retcode: 0,
29136
+ id: this.params.id,
29137
+ type: "handleSuccess"
29138
+ });
29139
+ }
29140
+ successCallback();
29141
+ }, (err) => {
29142
+ var errorInfo = this.errorHander.matchErrorInfo(err.oError.errorCode);
29143
+ var msg = errorInfo ? errorInfo.description : '播放失败,请检查设备及客户端网络';
29144
+ this.pluginStatus.loadingSetText({
29145
+ text: msg,
29146
+ color: 'red'
29147
+ });
29148
+ if (typeof this.params.handleError === 'function') {
29149
+ this.params.handleError({
29150
+ retcode: err.oError.errorCode,
29151
+ msg: msg,
29152
+ id: this.params.id,
29153
+ type: "handleError"
29154
+ });
29155
+ }
29156
+ successCallback(errorCallback);
29157
+ });
29158
+ }
29159
+ play(options) {
29160
+ if(typeof options.url === 'string') {
29161
+ this.url = options.url;
29162
+ }
29163
+ if(typeof options.accessToken === 'string') {
29164
+ this.accessToken = options.accessToken;
29165
+ }
29166
+ if(this.Theme && (typeof options.url === 'string' || typeof options.accessToken === 'string')) {
29167
+ this.Theme.getDeviceInfo();
29168
+ }
29069
29169
  const promise = new Promise((resolve, reject) => {
29070
29170
  this._getRealUrlPromise(this.accessToken, this.url)
29071
29171
  .then((data) => {
29072
- console.log("get real url result ===", data);
29073
- function getPlayParams(url) {
29074
- var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
29075
- var websocketStreamingParam = (url.indexOf('/live') === -1 ? (url.indexOf('cloudplayback') !== -1 ? '/cloudplayback?' : '/playback?') : '/live?') + url.split('?')[1];
29076
- if (websocketStreamingParam.indexOf('/playback') !== -1) {
29077
- websocketStreamingParam = websocketStreamingParam.replace("stream=2", 'stream=1');
29078
- }
29079
- // 本地回放仅支持主码流
29080
- return {
29081
- websocketConnectUrl: websocketConnectUrl,
29082
- websocketStreamingParam: websocketStreamingParam
29083
- };
29084
- }
29085
- var wsUrl = getPlayParams(data).websocketConnectUrl;
29086
- if(this.env && this.env.wsUrl) {
29087
- wsUrl = this.env.wsUrl;
29088
- }
29089
- var wsParams = {
29090
- playURL: getPlayParams(data).websocketStreamingParam
29091
- };
29092
-
29093
- this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(() => {
29094
- console.log("播放成功");
29095
- this.pluginStatus.loadingClear();
29096
- if (this.Theme) {
29097
- this.Theme.setDecoderState({ play: true });
29098
- }
29099
- if (this.audio) {
29100
- setTimeout(() => {
29101
- this.openSound();
29102
- }, 500);
29103
- }
29104
- if (typeof this.params.handleSuccess === 'function') {
29105
- this.params.handleSuccess({
29106
- retcode: 0,
29107
- id: this.params.id,
29108
- type: "handleSuccess"
29109
- });
29110
- }
29111
- resolve(true);
29112
- }, (err) => {
29113
- var errorInfo = this.errorHander.matchErrorInfo(err.oError.errorCode);
29114
- var msg = errorInfo ? errorInfo.description : '播放失败,请检查设备及客户端网络';
29115
- this.pluginStatus.loadingSetText({
29116
- text: msg,
29117
- color: 'red'
29118
- });
29119
- if (typeof this.params.handleError === 'function') {
29120
- this.params.handleError({
29121
- retcode: err.oError.errorCode,
29122
- msg: msg,
29123
- id: this.params.id,
29124
- type: "handleError"
29125
- });
29126
- }
29127
- reject(false);
29128
- });
29172
+ this._pluginPlay(data, () => resolve(true), () => reject(false));
29173
+ // console.log("get real url result ===", data);
29174
+ // function getPlayParams(url) {
29175
+ // var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
29176
+ // var websocketStreamingParam = (url.indexOf('/live') === -1 ? (url.indexOf('cloudplayback') !== -1 ? '/cloudplayback?' : '/playback?') : '/live?') + url.split('?')[1];
29177
+ // if (websocketStreamingParam.indexOf('/playback') !== -1) {
29178
+ // websocketStreamingParam = websocketStreamingParam.replace("stream=2", 'stream=1');
29179
+ // }
29180
+ // // 本地回放仅支持主码流
29181
+ // return {
29182
+ // websocketConnectUrl: websocketConnectUrl,
29183
+ // websocketStreamingParam: websocketStreamingParam
29184
+ // };
29185
+ // }
29186
+ // var wsUrl = getPlayParams(data).websocketConnectUrl;
29187
+ // if(this.env && this.env.wsUrl) {
29188
+ // wsUrl = this.env.wsUrl;
29189
+ // }
29190
+ // var wsParams = {
29191
+ // playURL: getPlayParams(data).websocketStreamingParam
29192
+ // };
29193
+
29194
+ // this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(() => {
29195
+ // console.log("播放成功");
29196
+ // this.pluginStatus.loadingClear();
29197
+ // if (this.Theme) {
29198
+ // this.Theme.setDecoderState({ play: true });
29199
+ // }
29200
+ // if (this.audio) {
29201
+ // setTimeout(() => {
29202
+ // this.openSound();
29203
+ // }, 500);
29204
+ // }
29205
+ // if (typeof this.params.handleSuccess === 'function') {
29206
+ // this.params.handleSuccess({
29207
+ // retcode: 0,
29208
+ // id: this.params.id,
29209
+ // type: "handleSuccess"
29210
+ // });
29211
+ // }
29212
+ // resolve(true);
29213
+ // }, (err) => {
29214
+ // var errorInfo = this.errorHander.matchErrorInfo(err.oError.errorCode);
29215
+ // var msg = errorInfo ? errorInfo.description : '播放失败,请检查设备及客户端网络';
29216
+ // this.pluginStatus.loadingSetText({
29217
+ // text: msg,
29218
+ // color: 'red'
29219
+ // });
29220
+ // if (typeof this.params.handleError === 'function') {
29221
+ // this.params.handleError({
29222
+ // retcode: err.oError.errorCode,
29223
+ // msg: msg,
29224
+ // id: this.params.id,
29225
+ // type: "handleError"
29226
+ // });
29227
+ // }
29228
+ // reject(false);
29229
+ // });
29129
29230
  })
29130
29231
  .catch((err) => {
29131
29232
  var msg = err.msg ? err.msg : '播放失败,请检查设备及客户端网络';
@@ -29241,21 +29342,29 @@ class EZUIKitPlayer {
29241
29342
  return promise;
29242
29343
  }
29243
29344
  getOSDTime() {
29244
- var promise = new Promise((resolve,reject) => {
29345
+ var promise = new Promise((resolve, reject) => {
29245
29346
  this.jSPlugin.JS_GetOSDTime(0)
29246
- .then((data)=>{
29347
+ .then((data) => {
29247
29348
  resolve({
29248
29349
  code: 0,
29249
29350
  retcode: 0,
29250
29351
  data: data
29251
29352
  });
29353
+ // 兼容旧版本callback
29354
+ if (typeof this.params.getOSDTimeCallBack === 'function') {
29355
+ this.params.getOSDTimeCallBack({ id: this.id, type: 'getOSDTime', code: 0, data: data});
29356
+ }
29252
29357
  })
29253
- .catch(err=>{
29358
+ .catch(err => {
29254
29359
  reject({
29255
29360
  code: -1,
29256
29361
  retcode: -1,
29257
29362
  data: err
29258
29363
  });
29364
+ // 兼容旧版本callback
29365
+ if (typeof this.params.getOSDTimeCallBack === 'function') {
29366
+ this.params.getOSDTimeCallBack({ id: this.id, type: 'getOSDTime', code: -1,data: -1 });
29367
+ }
29259
29368
  });
29260
29369
  });
29261
29370
  return promise;
@@ -29263,6 +29372,15 @@ class EZUIKitPlayer {
29263
29372
  capturePicture(name, callback = false) {
29264
29373
  var capturePictureRT = this.jSPlugin.JS_CapturePicture(0, name, "JPEG", callback, !!callback);
29265
29374
  if (isPromise(capturePictureRT)) {
29375
+ // 兼容旧版本callback
29376
+ if (typeof this.params.capturePictureCallBack === 'function') {
29377
+ capturePictureRT.then(() => {
29378
+ this.params.capturePictureCallBack({ id: this.id, type: 'capturePicture', code: 0 });
29379
+ })
29380
+ .catch(() => {
29381
+ this.params.capturePictureCallBack({ id: this.id, type: 'capturePicture', code: -1 });
29382
+ });
29383
+ }
29266
29384
  return capturePictureRT;
29267
29385
  }
29268
29386
  return new Promise(function (resolve) {
@@ -29272,6 +29390,15 @@ class EZUIKitPlayer {
29272
29390
  startSave(name) {
29273
29391
  var startSaveRT = this.jSPlugin.JS_StartSave(0, name);
29274
29392
  if (isPromise(startSaveRT)) {
29393
+ // 兼容旧版本callback
29394
+ if (typeof this.params.startSaveCallBack === 'function') {
29395
+ startSaveRT.then(() => {
29396
+ this.params.startSaveCallBack({ id: this.id, type: 'startSave', code: 0 });
29397
+ })
29398
+ .catch(() => {
29399
+ this.params.startSaveCallBack({ id: this.id, type: 'startSave', code: -1 });
29400
+ });
29401
+ }
29275
29402
  return startSaveRT;
29276
29403
  }
29277
29404
  if (this.Theme) {
@@ -29284,6 +29411,15 @@ class EZUIKitPlayer {
29284
29411
  stopSave() {
29285
29412
  var stopSaveRT = this.jSPlugin.JS_StopSave(0);
29286
29413
  if (isPromise(stopSaveRT)) {
29414
+ // 兼容旧版本callback
29415
+ if (typeof this.params.startSaveCallBack === 'function') {
29416
+ stopSaveRT.then(() => {
29417
+ this.params.stopSaveCallBack({ id: this.id, type: 'stopSave', code: 0 });
29418
+ })
29419
+ .catch(() => {
29420
+ this.params.stopSaveCallBack({ id: this.id, type: 'stopSave', code: -1 });
29421
+ });
29422
+ }
29287
29423
  return stopSaveRT;
29288
29424
  }
29289
29425
  if (this.Theme) {
@@ -29302,6 +29438,10 @@ class EZUIKitPlayer {
29302
29438
  if (this.Theme) {
29303
29439
  this.Theme.setDecoderState({ sound: true });
29304
29440
  }
29441
+ // 兼容旧版本callback
29442
+ if (typeof this.params.openSoundCallBack === 'function') {
29443
+ this.params.openSoundCallBack({ id: this.id, type: 'openSound', code: openSoundRT });
29444
+ }
29305
29445
  return new Promise(function (resolve) {
29306
29446
  resolve(openSoundRT);
29307
29447
  });
@@ -29314,6 +29454,10 @@ class EZUIKitPlayer {
29314
29454
  if (this.Theme) {
29315
29455
  this.Theme.setDecoderState({ sound: false });
29316
29456
  }
29457
+ // 兼容旧版本callback
29458
+ if (typeof this.params.closeSoundCallBack === 'function') {
29459
+ this.params.closeSoundCallBack({ id: this.id, type: 'closeSound', code: closeSoundRT });
29460
+ }
29317
29461
  return new Promise(function (resolve) {
29318
29462
  resolve(closeSoundRT);
29319
29463
  });
@@ -29336,6 +29480,9 @@ class EZUIKitPlayer {
29336
29480
  resolve(closeZoomRT);
29337
29481
  });
29338
29482
  }
29483
+ setPoster(url) {
29484
+ this.pluginStatus.setPoster(url);
29485
+ }
29339
29486
  reSize(width, height) {
29340
29487
  this.width = width;
29341
29488
  this.height = height;
@@ -29343,27 +29490,60 @@ class EZUIKitPlayer {
29343
29490
  this.jSPlugin.JS_Resize(width, height);
29344
29491
  }
29345
29492
  fast() {
29493
+ var speed = this.speed;
29494
+ if (speed === 1) {
29495
+ speed = 2;
29496
+ } else if (speed === 2) {
29497
+ speed = 4;
29498
+ } else {
29499
+ if (typeof this.params.handleError === 'function') {
29500
+ this.params.handleError({
29501
+ msg: "播放速度最大为4倍速度",
29502
+ retcode: 1003,
29503
+ id: this.id,
29504
+ type: "handleError"
29505
+ });
29506
+ }
29507
+ }
29346
29508
  var fastRT = this.jSPlugin.JS_Fast(0);
29347
- console.log("JS_Fast", fastRT);
29348
29509
  if (isPromise(fastRT)) {
29510
+ this.speed = speed;
29349
29511
  return fastRT;
29350
29512
  }
29351
29513
  return new Promise(function (resolve) {
29514
+ this.speed = speed;
29352
29515
  resolve(fastRT);
29353
29516
  });
29354
29517
  }
29355
29518
  slow() {
29519
+ var speed = this.speed;
29520
+ if (speed === 4) {
29521
+ speed = 2;
29522
+ } else if (speed === 2) {
29523
+ speed = 1;
29524
+ } else {
29525
+ if (typeof this.params.handleError === 'function') {
29526
+ this.params.handleError({
29527
+ msg: "播放速度最小为1倍速度",
29528
+ retcode: 1003,
29529
+ id: this.id,
29530
+ type: "handleError"
29531
+ });
29532
+ }
29533
+ }
29356
29534
  var slowRT = this.jSPlugin.JS_Slow(0);
29357
29535
  console.log("slowRT", slowRT);
29358
29536
  if (isPromise(slowRT)) {
29537
+ this.speed = speed;
29359
29538
  return slowRT;
29360
29539
  }
29361
29540
  return new Promise(function (resolve) {
29541
+ this.speed = speed;
29362
29542
  resolve(slowRT);
29363
29543
  });
29364
29544
  }
29365
29545
  seek(startTime, endTime) {
29366
- var seekRT = this.jSPlugin.JS_Seek(0,startTime, endTime);
29546
+ var seekRT = this.jSPlugin.JS_Seek(0, startTime, endTime);
29367
29547
  console.log("seekRT", seekRT);
29368
29548
  if (isPromise(seekRT)) {
29369
29549
  return seekRT;
@@ -29377,6 +29557,10 @@ class EZUIKitPlayer {
29377
29557
  promise.then((data) => {
29378
29558
  console.log("全屏promise", window.screen.availWidth);
29379
29559
  this.jSPlugin.JS_Resize(window.screen.availWidth, window.screen.availHeight);
29560
+ // 兼容旧版本callback
29561
+ if (typeof this.params.fullScreenCallBack === 'function') {
29562
+ this.params.fullScreenCallBack({ id: this.id, type: 'fullScreen', code: 0 });
29563
+ }
29380
29564
  });
29381
29565
  // 监听全屏事件触发
29382
29566
  const fullscreenchange = () => {
@@ -29384,6 +29568,10 @@ class EZUIKitPlayer {
29384
29568
  if (!isFullScreen) {
29385
29569
  this.jSPlugin.JS_Resize(this.width, this.height);
29386
29570
  }
29571
+ // 兼容旧版本callback
29572
+ if (typeof this.params.fullScreenChangeCallBack === 'function') {
29573
+ this.params.fullScreenChangeCallBack({ id: this.id, type: 'fullScreen', code: isFullScreen });
29574
+ }
29387
29575
  };
29388
29576
  ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach((item) => {
29389
29577
  window.addEventListener(item, (data) => fullscreenchange());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezuikit-js",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "ezuikit javascript for npm",
5
5
  "main": "ezuikit.js",
6
6
  "scripts": {