@besovideo/webrtc-player 0.9.86 → 0.9.87

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.
@@ -117,7 +117,7 @@ var bvPlayerCore = (() => {
117
117
  var define_processenv_default;
118
118
  var init_define_processenv = __esm({
119
119
  "<define:processenv>"() {
120
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.86", PROJECT_NAMESPACE: "bvplayer" };
120
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.87", PROJECT_NAMESPACE: "bvplayer" };
121
121
  }
122
122
  });
123
123
 
@@ -22108,7 +22108,8 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
22108
22108
  "lian-jie-yi-wai-guan-bi": "Unexpected closure",
22109
22109
  "da-kai-chuan-shu-tong-dao-shi-bai": "Failed to open transmission channel",
22110
22110
  "hui-fang-wen-jian-bu-cun-zai": "File Not Found",
22111
- "shi-pin-jie-ma-shi-bai": "Video decode fail"
22111
+ "shi-pin-jie-ma-shi-bai": "Video decode fail",
22112
+ "hui-fang-chu-xian-wen-ti": "There is a problem with playback:"
22112
22113
  };
22113
22114
 
22114
22115
  // src/locales/zh.json
@@ -22168,7 +22169,8 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
22168
22169
  "lian-jie-yi-wai-guan-bi": "\u8FDE\u63A5\u610F\u5916\u5173\u95ED",
22169
22170
  "da-kai-chuan-shu-tong-dao-shi-bai": "\u6253\u5F00\u4F20\u8F93\u901A\u9053\u5931\u8D25",
22170
22171
  "hui-fang-wen-jian-bu-cun-zai": "\u56DE\u653E\u6587\u4EF6\u4E0D\u5B58\u5728",
22171
- "shi-pin-jie-ma-shi-bai": "\u89C6\u9891\u89E3\u7801\u5931\u8D25"
22172
+ "shi-pin-jie-ma-shi-bai": "\u89C6\u9891\u89E3\u7801\u5931\u8D25",
22173
+ "hui-fang-chu-xian-wen-ti": "\u56DE\u653E\u51FA\u73B0\u95EE\u9898\uFF1A"
22172
22174
  };
22173
22175
 
22174
22176
  // src/locales/i18n.ts
@@ -24441,6 +24443,14 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
24441
24443
  svgLoading.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><g fill="none" stroke="black" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity="0.3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>`;
24442
24444
  return svgLoading;
24443
24445
  }
24446
+ function CreateLoadingSvgWhite() {
24447
+ const svgLoading = document.createElement("div");
24448
+ svgLoading.style.position = "absolute";
24449
+ svgLoading.style.top = "calc(50% - 48px)";
24450
+ svgLoading.style.left = "calc(50% - 48px)";
24451
+ svgLoading.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><rect width="24" height="24" fill="none"/><g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-dasharray="16" stroke-dashoffset="16" d="M12 3c4.97 0 9 4.03 9 9"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="16;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path><path stroke-dasharray="64" stroke-dashoffset="64" stroke-opacity="0.45" d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.2s" values="64;0"/></path></g></svg>`;
24452
+ return svgLoading;
24453
+ }
24444
24454
  var PlaybackBar = class extends Plugin {
24445
24455
  constructor() {
24446
24456
  super(PLUGIN_NAME_PLAYBAR, "div", core_default.style.cls("blaybackbar"));
@@ -24451,6 +24461,7 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
24451
24461
  this.isShowControls = true;
24452
24462
  this.svgPause = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" }, /* @__PURE__ */ jsx_default.h("path", { fill: "currentColor", d: "M6 5h2v14H6zm10 0h2v14h-2z" })));
24453
24463
  this.svgPlay = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 32 32" }, /* @__PURE__ */ jsx_default.h("path", { fill: "white", d: "M6.684 25.682L24.316 15.5L6.684 5.318z" })));
24464
+ this.svgLoadingWhite = CreateLoadingSvgWhite();
24454
24465
  this.svgLoading = CreateLoadingSvg();
24455
24466
  this.volumeCurrent = 100;
24456
24467
  this.svgSoundZero = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", onclick: () => {
@@ -24601,6 +24612,16 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
24601
24612
  });
24602
24613
  }
24603
24614
  }
24615
+ showInitLoading(isShow) {
24616
+ var _a;
24617
+ if (isShow) {
24618
+ core_default.dom.append(this._container, this.svgLoadingWhite);
24619
+ } else {
24620
+ if ((_a = this.svgLoadingWhite) == null ? void 0 : _a.parentNode) {
24621
+ core_default.dom.removeSelf(this.svgLoadingWhite);
24622
+ }
24623
+ }
24624
+ }
24604
24625
  showLoading(isShow) {
24605
24626
  var _a;
24606
24627
  if (isShow) {
@@ -25333,14 +25354,17 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
25333
25354
  let hplayer = void 0;
25334
25355
  const handle2 = {};
25335
25356
  let type = type1;
25357
+ let onOpenHandleOver = null;
25336
25358
  const instance2 = {
25359
+ inBusy: false,
25337
25360
  videoFit: "contain",
25338
25361
  open() {
25339
25362
  return __async(this, null, function* () {
25340
25363
  var _a2, _b;
25341
- if (hplayer) {
25364
+ if (instance2.inBusy) {
25342
25365
  return;
25343
25366
  }
25367
+ instance2.inBusy = true;
25344
25368
  const audioWaveShow = new MediaStreamAudioWavePlaybackShow();
25345
25369
  const markerHandle = new MarkerHandle({
25346
25370
  token,
@@ -25436,6 +25460,21 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
25436
25460
  player.mask.visible = true;
25437
25461
  return r(false);
25438
25462
  }
25463
+ videoEle.onerror = () => __async(this, null, function* () {
25464
+ var _a3;
25465
+ player.mask.text = t("hui-fang-chu-xian-wen-ti") + ((_a3 = videoEle.error) == null ? void 0 : _a3.code);
25466
+ player.mask.visible = true;
25467
+ if (instance2.protocol == "auto") {
25468
+ instance2.inBusy = true;
25469
+ barHandle.showInitLoading(true);
25470
+ yield RunHandle("ws-bvrtc");
25471
+ barHandle.showInitLoading(false);
25472
+ instance2.inBusy = false;
25473
+ }
25474
+ });
25475
+ removeHooks.push(() => {
25476
+ videoEle.onerror = null;
25477
+ });
25439
25478
  videoEle.src = srcFile;
25440
25479
  videoEle.controls = false;
25441
25480
  removeHooks.push(
@@ -25690,6 +25729,7 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
25690
25729
  }
25691
25730
  return false;
25692
25731
  }
25732
+ barHandle.showInitLoading(true);
25693
25733
  if (this.protocol == "auto") {
25694
25734
  if (!(yield RunHandle("web"))) {
25695
25735
  yield RunHandle("ws-bvrtc");
@@ -25697,12 +25737,30 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
25697
25737
  } else {
25698
25738
  yield RunHandle(this.protocol);
25699
25739
  }
25740
+ barHandle.showInitLoading(false);
25741
+ instance2.inBusy = false;
25700
25742
  });
25701
25743
  },
25702
25744
  close() {
25703
25745
  return __async(this, null, function* () {
25704
25746
  var _a2;
25705
- (_a2 = handle2.close) == null ? void 0 : _a2.call(handle2);
25747
+ if (!instance2.inBusy) {
25748
+ (_a2 = handle2.close) == null ? void 0 : _a2.call(handle2);
25749
+ } else if (instance2.inBusy) {
25750
+ yield new Promise((r) => {
25751
+ const oriOnOpenHandleOver = onOpenHandleOver;
25752
+ onOpenHandleOver = () => {
25753
+ var _a3;
25754
+ onOpenHandleOver = null;
25755
+ try {
25756
+ oriOnOpenHandleOver == null ? void 0 : oriOnOpenHandleOver();
25757
+ (_a3 = handle2.close) == null ? void 0 : _a3.call(handle2);
25758
+ } catch (e) {
25759
+ }
25760
+ r();
25761
+ };
25762
+ });
25763
+ }
25706
25764
  });
25707
25765
  },
25708
25766
  pause() {
@@ -25731,6 +25789,9 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
25731
25789
  this.videoFit = fit;
25732
25790
  },
25733
25791
  setProtocol: function(protocol) {
25792
+ if (this.protocol == protocol || this.inBusy) {
25793
+ return;
25794
+ }
25734
25795
  this.close();
25735
25796
  this.protocol = (puOption == null ? void 0 : puOption.puId) ? protocol : protocol;
25736
25797
  this.open();
package/dist/main.es.js CHANGED
@@ -111,7 +111,7 @@ var __async = (__this, __arguments, generator) => {
111
111
  var define_processenv_default;
112
112
  var init_define_processenv = __esm({
113
113
  "<define:processenv>"() {
114
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.86", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.9.87", PROJECT_NAMESPACE: "bvplayer" };
115
115
  }
116
116
  });
117
117
 
@@ -22092,7 +22092,8 @@ var en_default = {
22092
22092
  "lian-jie-yi-wai-guan-bi": "Unexpected closure",
22093
22093
  "da-kai-chuan-shu-tong-dao-shi-bai": "Failed to open transmission channel",
22094
22094
  "hui-fang-wen-jian-bu-cun-zai": "File Not Found",
22095
- "shi-pin-jie-ma-shi-bai": "Video decode fail"
22095
+ "shi-pin-jie-ma-shi-bai": "Video decode fail",
22096
+ "hui-fang-chu-xian-wen-ti": "There is a problem with playback:"
22096
22097
  };
22097
22098
 
22098
22099
  // src/locales/zh.json
@@ -22152,7 +22153,8 @@ var zh_default = {
22152
22153
  "lian-jie-yi-wai-guan-bi": "\u8FDE\u63A5\u610F\u5916\u5173\u95ED",
22153
22154
  "da-kai-chuan-shu-tong-dao-shi-bai": "\u6253\u5F00\u4F20\u8F93\u901A\u9053\u5931\u8D25",
22154
22155
  "hui-fang-wen-jian-bu-cun-zai": "\u56DE\u653E\u6587\u4EF6\u4E0D\u5B58\u5728",
22155
- "shi-pin-jie-ma-shi-bai": "\u89C6\u9891\u89E3\u7801\u5931\u8D25"
22156
+ "shi-pin-jie-ma-shi-bai": "\u89C6\u9891\u89E3\u7801\u5931\u8D25",
22157
+ "hui-fang-chu-xian-wen-ti": "\u56DE\u653E\u51FA\u73B0\u95EE\u9898\uFF1A"
22156
22158
  };
22157
22159
 
22158
22160
  // src/locales/i18n.ts
@@ -24425,6 +24427,14 @@ function CreateLoadingSvg() {
24425
24427
  svgLoading.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><g fill="none" stroke="black" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity="0.3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>`;
24426
24428
  return svgLoading;
24427
24429
  }
24430
+ function CreateLoadingSvgWhite() {
24431
+ const svgLoading = document.createElement("div");
24432
+ svgLoading.style.position = "absolute";
24433
+ svgLoading.style.top = "calc(50% - 48px)";
24434
+ svgLoading.style.left = "calc(50% - 48px)";
24435
+ svgLoading.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><rect width="24" height="24" fill="none"/><g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-dasharray="16" stroke-dashoffset="16" d="M12 3c4.97 0 9 4.03 9 9"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="16;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path><path stroke-dasharray="64" stroke-dashoffset="64" stroke-opacity="0.45" d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.2s" values="64;0"/></path></g></svg>`;
24436
+ return svgLoading;
24437
+ }
24428
24438
  var PlaybackBar = class extends Plugin {
24429
24439
  constructor() {
24430
24440
  super(PLUGIN_NAME_PLAYBAR, "div", core_default.style.cls("blaybackbar"));
@@ -24435,6 +24445,7 @@ var PlaybackBar = class extends Plugin {
24435
24445
  this.isShowControls = true;
24436
24446
  this.svgPause = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" }, /* @__PURE__ */ jsx_default.h("path", { fill: "currentColor", d: "M6 5h2v14H6zm10 0h2v14h-2z" })));
24437
24447
  this.svgPlay = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 32 32" }, /* @__PURE__ */ jsx_default.h("path", { fill: "white", d: "M6.684 25.682L24.316 15.5L6.684 5.318z" })));
24448
+ this.svgLoadingWhite = CreateLoadingSvgWhite();
24438
24449
  this.svgLoading = CreateLoadingSvg();
24439
24450
  this.volumeCurrent = 100;
24440
24451
  this.svgSoundZero = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", onclick: () => {
@@ -24585,6 +24596,16 @@ var PlaybackBar = class extends Plugin {
24585
24596
  });
24586
24597
  }
24587
24598
  }
24599
+ showInitLoading(isShow) {
24600
+ var _a;
24601
+ if (isShow) {
24602
+ core_default.dom.append(this._container, this.svgLoadingWhite);
24603
+ } else {
24604
+ if ((_a = this.svgLoadingWhite) == null ? void 0 : _a.parentNode) {
24605
+ core_default.dom.removeSelf(this.svgLoadingWhite);
24606
+ }
24607
+ }
24608
+ }
24588
24609
  showLoading(isShow) {
24589
24610
  var _a;
24590
24611
  if (isShow) {
@@ -25317,14 +25338,17 @@ var PlayBack = (props) => {
25317
25338
  let hplayer = void 0;
25318
25339
  const handle2 = {};
25319
25340
  let type = type1;
25341
+ let onOpenHandleOver = null;
25320
25342
  const instance2 = {
25343
+ inBusy: false,
25321
25344
  videoFit: "contain",
25322
25345
  open() {
25323
25346
  return __async(this, null, function* () {
25324
25347
  var _a2, _b;
25325
- if (hplayer) {
25348
+ if (instance2.inBusy) {
25326
25349
  return;
25327
25350
  }
25351
+ instance2.inBusy = true;
25328
25352
  const audioWaveShow = new MediaStreamAudioWavePlaybackShow();
25329
25353
  const markerHandle = new MarkerHandle({
25330
25354
  token,
@@ -25420,6 +25444,21 @@ var PlayBack = (props) => {
25420
25444
  player.mask.visible = true;
25421
25445
  return r(false);
25422
25446
  }
25447
+ videoEle.onerror = () => __async(this, null, function* () {
25448
+ var _a3;
25449
+ player.mask.text = t("hui-fang-chu-xian-wen-ti") + ((_a3 = videoEle.error) == null ? void 0 : _a3.code);
25450
+ player.mask.visible = true;
25451
+ if (instance2.protocol == "auto") {
25452
+ instance2.inBusy = true;
25453
+ barHandle.showInitLoading(true);
25454
+ yield RunHandle("ws-bvrtc");
25455
+ barHandle.showInitLoading(false);
25456
+ instance2.inBusy = false;
25457
+ }
25458
+ });
25459
+ removeHooks.push(() => {
25460
+ videoEle.onerror = null;
25461
+ });
25423
25462
  videoEle.src = srcFile;
25424
25463
  videoEle.controls = false;
25425
25464
  removeHooks.push(
@@ -25674,6 +25713,7 @@ var PlayBack = (props) => {
25674
25713
  }
25675
25714
  return false;
25676
25715
  }
25716
+ barHandle.showInitLoading(true);
25677
25717
  if (this.protocol == "auto") {
25678
25718
  if (!(yield RunHandle("web"))) {
25679
25719
  yield RunHandle("ws-bvrtc");
@@ -25681,12 +25721,30 @@ var PlayBack = (props) => {
25681
25721
  } else {
25682
25722
  yield RunHandle(this.protocol);
25683
25723
  }
25724
+ barHandle.showInitLoading(false);
25725
+ instance2.inBusy = false;
25684
25726
  });
25685
25727
  },
25686
25728
  close() {
25687
25729
  return __async(this, null, function* () {
25688
25730
  var _a2;
25689
- (_a2 = handle2.close) == null ? void 0 : _a2.call(handle2);
25731
+ if (!instance2.inBusy) {
25732
+ (_a2 = handle2.close) == null ? void 0 : _a2.call(handle2);
25733
+ } else if (instance2.inBusy) {
25734
+ yield new Promise((r) => {
25735
+ const oriOnOpenHandleOver = onOpenHandleOver;
25736
+ onOpenHandleOver = () => {
25737
+ var _a3;
25738
+ onOpenHandleOver = null;
25739
+ try {
25740
+ oriOnOpenHandleOver == null ? void 0 : oriOnOpenHandleOver();
25741
+ (_a3 = handle2.close) == null ? void 0 : _a3.call(handle2);
25742
+ } catch (e) {
25743
+ }
25744
+ r();
25745
+ };
25746
+ });
25747
+ }
25690
25748
  });
25691
25749
  },
25692
25750
  pause() {
@@ -25715,6 +25773,9 @@ var PlayBack = (props) => {
25715
25773
  this.videoFit = fit;
25716
25774
  },
25717
25775
  setProtocol: function(protocol) {
25776
+ if (this.protocol == protocol || this.inBusy) {
25777
+ return;
25778
+ }
25718
25779
  this.close();
25719
25780
  this.protocol = (puOption == null ? void 0 : puOption.puId) ? protocol : protocol;
25720
25781
  this.open();
@@ -36,6 +36,7 @@ interface IPlaybackInstance extends IComponentInstance {
36
36
  setProtocol: (protocol: IPlaybackPlayType) => void;
37
37
  videoFit: keyof IVideoFits;
38
38
  protocol: IPlaybackPlayType;
39
+ inBusy: boolean;
39
40
  }
40
41
  declare type helperFunc = {
41
42
  getDefaultProps: () => Partial<IPlaybackProps>;
@@ -40,8 +40,10 @@ declare class PlaybackBar extends Plugin<HTMLDivElement, IPlaybackBarEventMap> {
40
40
  private onClickJump;
41
41
  private svgPause;
42
42
  private svgPlay;
43
+ private svgLoadingWhite;
44
+ showInitLoading(isShow: boolean): void;
43
45
  private svgLoading;
44
- private showLoading;
46
+ showLoading(isShow: boolean): void;
45
47
  jumpToTargetSeconds(params: IJumpEventParams): void;
46
48
  private onSooundClick;
47
49
  private onVolumeChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.9.86",
3
+ "version": "0.9.87",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",