@besovideo/webrtc-player 0.8.40 → 0.8.41

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.
@@ -77,7 +77,7 @@ var bvPlayerCore = (() => {
77
77
  };
78
78
 
79
79
  // <define:process.env>
80
- var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.39", PROJECT_NAMESPACE: "bvplayer" };
80
+ var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.40", PROJECT_NAMESPACE: "bvplayer" };
81
81
 
82
82
  // node_modules/@shirtiny/logger/dist/main.es.js
83
83
  var _ = Object.defineProperty;
@@ -4431,10 +4431,12 @@ var bvPlayerCore = (() => {
4431
4431
  this._notifier.unSubscribe(name, callBack);
4432
4432
  }
4433
4433
  clearEventListener(name) {
4434
- this._notifier.clear(name);
4434
+ var _a;
4435
+ (_a = this._notifier) == null ? void 0 : _a.clear(name);
4435
4436
  }
4436
4437
  dispatch(name, event) {
4437
- this._notifier.publish(name, event);
4438
+ var _a;
4439
+ (_a = this._notifier) == null ? void 0 : _a.publish(name, event);
4438
4440
  }
4439
4441
  dispatchSync(name, event) {
4440
4442
  return __async(this, null, function* () {
@@ -9563,6 +9565,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9563
9565
  constructor(options) {
9564
9566
  super(PLUGIN_NAME_PLAYER, "div");
9565
9567
  this._lastTotalReceivedBytes = 0;
9568
+ this._isInClose = false;
9566
9569
  this._video = new video_default({
9567
9570
  puOptions: options == null ? void 0 : options.puOptions
9568
9571
  });
@@ -9685,6 +9688,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9685
9688
  prepareWebrtc() {
9686
9689
  return __async(this, null, function* () {
9687
9690
  var _a;
9691
+ this._isInClose = false;
9688
9692
  if (this._mode !== "plugin" /* PLUGIN */)
9689
9693
  return;
9690
9694
  logger_default.debug("PuPlayer Plugin prepareWebrtc");
@@ -9714,12 +9718,17 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9714
9718
  }
9715
9719
  close() {
9716
9720
  return __async(this, null, function* () {
9717
- yield this.dispatchSync("close");
9718
- this.closeWebrtc();
9721
+ if (!this._isInClose) {
9722
+ this._isInClose = true;
9723
+ yield this.dispatchSync("close");
9724
+ this.closeWebrtc();
9725
+ }
9719
9726
  });
9720
9727
  }
9721
9728
  beforeDestroy() {
9722
- this.close();
9729
+ if (!this._isInClose) {
9730
+ this.close();
9731
+ }
9723
9732
  }
9724
9733
  // 应用和加载播放器设置
9725
9734
  loadPlayerConfig() {
@@ -9833,6 +9842,16 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9833
9842
  }
9834
9843
  };
9835
9844
  updateVolumeButton(true);
9845
+ function DisplayVolumn(volume) {
9846
+ const button = panel == null ? void 0 : panel.controller.VolumeButton;
9847
+ if (panel && button) {
9848
+ const volumeSlider2 = panel.controller.VolumeSlider;
9849
+ if (volumeSlider2) {
9850
+ volumeSlider2.percent = volume;
9851
+ }
9852
+ volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
9853
+ }
9854
+ }
9836
9855
  panel.controller.addEventListener("volume", () => updateVolumeButton());
9837
9856
  const volumeSlider = panel.controller.VolumeSlider;
9838
9857
  if (volumeSlider) {
@@ -9841,6 +9860,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9841
9860
  panel.controller.activeVolume();
9842
9861
  this.video.volume = Number(e == null ? void 0 : e.percent);
9843
9862
  volumeSlider.percent = this.video.volume;
9863
+ DisplayVolumn(Number(e == null ? void 0 : e.percent));
9844
9864
  });
9845
9865
  }
9846
9866
  }
@@ -9886,7 +9906,9 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
9886
9906
  peerConnection: (_a = this._webrtcConnect) == null ? void 0 : _a.pc
9887
9907
  });
9888
9908
  this._webrtcConnect = null;
9889
- this._video.srcObject = null;
9909
+ if (this._video) {
9910
+ this._video.srcObject = null;
9911
+ }
9890
9912
  }
9891
9913
  refreshInfoModal() {
9892
9914
  return __async(this, null, function* () {
@@ -12316,6 +12338,18 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
12316
12338
  player.mikeBtn.intercom = intercom == null ? void 0 : intercom.instance;
12317
12339
  } catch (e) {
12318
12340
  try {
12341
+ let DisplayVolumn2 = function(volume) {
12342
+ var _a3;
12343
+ const button = (_a3 = player.panel) == null ? void 0 : _a3.controller.VolumeButton;
12344
+ if (player.panel && button && hplayer) {
12345
+ const volumeSlider2 = player.panel.controller.VolumeSlider;
12346
+ if (volumeSlider2) {
12347
+ volumeSlider2.percent = hplayer.getVolume();
12348
+ }
12349
+ volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
12350
+ }
12351
+ };
12352
+ var DisplayVolumn = DisplayVolumn2;
12319
12353
  logger_default.debug("error\u7684\u7C7B\u578B", e.name, e instanceof OpenDialogError);
12320
12354
  if (e instanceof OpenDialogError || protocol === "webrtc")
12321
12355
  throw e;
@@ -12495,6 +12529,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
12495
12529
  (_a3 = player.panel) == null ? void 0 : _a3.controller.activeVolume();
12496
12530
  hplayer.setVolume(Number(e2 == null ? void 0 : e2.percent));
12497
12531
  volumeSlider.percent = hplayer.getVolume();
12532
+ DisplayVolumn2(Number(e2 == null ? void 0 : e2.percent));
12498
12533
  });
12499
12534
  }
12500
12535
  if (player.mikeBtn)
package/dist/main.es.js CHANGED
@@ -71,7 +71,7 @@ var __async = (__this, __arguments, generator) => {
71
71
  };
72
72
 
73
73
  // <define:process.env>
74
- var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.39", PROJECT_NAMESPACE: "bvplayer" };
74
+ var define_process_env_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.40", PROJECT_NAMESPACE: "bvplayer" };
75
75
 
76
76
  // node_modules/@shirtiny/logger/dist/main.es.js
77
77
  var _ = Object.defineProperty;
@@ -4415,10 +4415,12 @@ var Events = class {
4415
4415
  this._notifier.unSubscribe(name, callBack);
4416
4416
  }
4417
4417
  clearEventListener(name) {
4418
- this._notifier.clear(name);
4418
+ var _a;
4419
+ (_a = this._notifier) == null ? void 0 : _a.clear(name);
4419
4420
  }
4420
4421
  dispatch(name, event) {
4421
- this._notifier.publish(name, event);
4422
+ var _a;
4423
+ (_a = this._notifier) == null ? void 0 : _a.publish(name, event);
4422
4424
  }
4423
4425
  dispatchSync(name, event) {
4424
4426
  return __async(this, null, function* () {
@@ -9547,6 +9549,7 @@ var PlayerPlugin = class extends Plugin {
9547
9549
  constructor(options) {
9548
9550
  super(PLUGIN_NAME_PLAYER, "div");
9549
9551
  this._lastTotalReceivedBytes = 0;
9552
+ this._isInClose = false;
9550
9553
  this._video = new video_default({
9551
9554
  puOptions: options == null ? void 0 : options.puOptions
9552
9555
  });
@@ -9669,6 +9672,7 @@ var PlayerPlugin = class extends Plugin {
9669
9672
  prepareWebrtc() {
9670
9673
  return __async(this, null, function* () {
9671
9674
  var _a;
9675
+ this._isInClose = false;
9672
9676
  if (this._mode !== "plugin" /* PLUGIN */)
9673
9677
  return;
9674
9678
  logger_default.debug("PuPlayer Plugin prepareWebrtc");
@@ -9698,12 +9702,17 @@ var PlayerPlugin = class extends Plugin {
9698
9702
  }
9699
9703
  close() {
9700
9704
  return __async(this, null, function* () {
9701
- yield this.dispatchSync("close");
9702
- this.closeWebrtc();
9705
+ if (!this._isInClose) {
9706
+ this._isInClose = true;
9707
+ yield this.dispatchSync("close");
9708
+ this.closeWebrtc();
9709
+ }
9703
9710
  });
9704
9711
  }
9705
9712
  beforeDestroy() {
9706
- this.close();
9713
+ if (!this._isInClose) {
9714
+ this.close();
9715
+ }
9707
9716
  }
9708
9717
  // 应用和加载播放器设置
9709
9718
  loadPlayerConfig() {
@@ -9817,6 +9826,16 @@ var PlayerPlugin = class extends Plugin {
9817
9826
  }
9818
9827
  };
9819
9828
  updateVolumeButton(true);
9829
+ function DisplayVolumn(volume) {
9830
+ const button = panel == null ? void 0 : panel.controller.VolumeButton;
9831
+ if (panel && button) {
9832
+ const volumeSlider2 = panel.controller.VolumeSlider;
9833
+ if (volumeSlider2) {
9834
+ volumeSlider2.percent = volume;
9835
+ }
9836
+ volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
9837
+ }
9838
+ }
9820
9839
  panel.controller.addEventListener("volume", () => updateVolumeButton());
9821
9840
  const volumeSlider = panel.controller.VolumeSlider;
9822
9841
  if (volumeSlider) {
@@ -9825,6 +9844,7 @@ var PlayerPlugin = class extends Plugin {
9825
9844
  panel.controller.activeVolume();
9826
9845
  this.video.volume = Number(e == null ? void 0 : e.percent);
9827
9846
  volumeSlider.percent = this.video.volume;
9847
+ DisplayVolumn(Number(e == null ? void 0 : e.percent));
9828
9848
  });
9829
9849
  }
9830
9850
  }
@@ -9870,7 +9890,9 @@ var PlayerPlugin = class extends Plugin {
9870
9890
  peerConnection: (_a = this._webrtcConnect) == null ? void 0 : _a.pc
9871
9891
  });
9872
9892
  this._webrtcConnect = null;
9873
- this._video.srcObject = null;
9893
+ if (this._video) {
9894
+ this._video.srcObject = null;
9895
+ }
9874
9896
  }
9875
9897
  refreshInfoModal() {
9876
9898
  return __async(this, null, function* () {
@@ -12300,6 +12322,18 @@ var PuPlayer = (props) => {
12300
12322
  player.mikeBtn.intercom = intercom == null ? void 0 : intercom.instance;
12301
12323
  } catch (e) {
12302
12324
  try {
12325
+ let DisplayVolumn2 = function(volume) {
12326
+ var _a3;
12327
+ const button = (_a3 = player.panel) == null ? void 0 : _a3.controller.VolumeButton;
12328
+ if (player.panel && button && hplayer) {
12329
+ const volumeSlider2 = player.panel.controller.VolumeSlider;
12330
+ if (volumeSlider2) {
12331
+ volumeSlider2.percent = hplayer.getVolume();
12332
+ }
12333
+ volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
12334
+ }
12335
+ };
12336
+ var DisplayVolumn = DisplayVolumn2;
12303
12337
  logger_default.debug("error\u7684\u7C7B\u578B", e.name, e instanceof OpenDialogError);
12304
12338
  if (e instanceof OpenDialogError || protocol === "webrtc")
12305
12339
  throw e;
@@ -12479,6 +12513,7 @@ var PuPlayer = (props) => {
12479
12513
  (_a3 = player.panel) == null ? void 0 : _a3.controller.activeVolume();
12480
12514
  hplayer.setVolume(Number(e2 == null ? void 0 : e2.percent));
12481
12515
  volumeSlider.percent = hplayer.getVolume();
12516
+ DisplayVolumn2(Number(e2 == null ? void 0 : e2.percent));
12482
12517
  });
12483
12518
  }
12484
12519
  if (player.mikeBtn)
@@ -83,6 +83,7 @@ declare class PlayerPlugin extends Plugin<HTMLDivElement, IPlayerPluginEventMap>
83
83
  setProductRemoteSdp(productRemoteSdp: (localDescription: RTCSessionDescription) => Promise<string | undefined>): void;
84
84
  prepareWebrtc(): Promise<void>;
85
85
  close(): Promise<void>;
86
+ private _isInClose;
86
87
  protected beforeDestroy(): void;
87
88
  private loadPlayerConfig;
88
89
  private initEvents;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.40",
3
+ "version": "0.8.41",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",