@besovideo/webrtc-player 0.8.55 → 0.8.57

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.
@@ -664,7 +664,7 @@
664
664
  transition: all 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
665
665
  display: flex;
666
666
  justify-content: space-between;
667
- height: 25%;
667
+ height: 30%;
668
668
  min-height: 110px;
669
669
  max-height: 150px;
670
670
  width: 60%;
@@ -714,7 +714,7 @@
714
714
  white-space: nowrap;
715
715
  }
716
716
  .bvplayer-ptz_control_camera-option_item:not(:last-child) {
717
- margin-bottom: 8px;
717
+ margin-bottom: 4%;
718
718
  }
719
719
  .bvplayer-ptz_control_camera-option_item_label {
720
720
  display: inline-block;
@@ -23,6 +23,18 @@ var bvPlayerCore = (() => {
23
23
  return a2;
24
24
  };
25
25
  var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
26
38
  var __esm = (fn2, res) => function __init() {
27
39
  return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
28
40
  };
@@ -105,7 +117,7 @@ var bvPlayerCore = (() => {
105
117
  var define_processenv_default;
106
118
  var init_define_processenv = __esm({
107
119
  "<define:processenv>"() {
108
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.55", PROJECT_NAMESPACE: "bvplayer" };
120
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.57", PROJECT_NAMESPACE: "bvplayer" };
109
121
  }
110
122
  });
111
123
 
@@ -9238,9 +9250,20 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
9238
9250
  });
9239
9251
  return data;
9240
9252
  });
9253
+ var put = (url, param, option) => __async(void 0, null, function* () {
9254
+ const data = yield request(url, {
9255
+ method: "PUT" /* PUT */,
9256
+ headers: __spreadValues({
9257
+ "Content-Type": "application/json;charset=UTF-8"
9258
+ }, option == null ? void 0 : option.headers),
9259
+ bodyData: param
9260
+ });
9261
+ return data;
9262
+ });
9241
9263
  var http = {
9242
9264
  get: get3,
9243
- post
9265
+ post,
9266
+ put
9244
9267
  };
9245
9268
  var http_default = http;
9246
9269
 
@@ -11208,6 +11231,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
11208
11231
  var MikeOn = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h(SvgElementbvPlayerCoreMikeOn, null));
11209
11232
  var MikeOff = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h(SvgElementbvPlayerCoreMikeOff, null));
11210
11233
  var MikeDoing = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h("span", { style: `display: inline-block; --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='18' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.67' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.33' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='0' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3C!-- 1702453639037 --%3E%3C/svg%3E"); width: 20px; height: 20px; background-color: currentcolor; mask-image: var(--svg); mask-repeat: no-repeat; mask-size: 100% 100%;` }));
11234
+ var GoPresetPoint = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 1024 1024" }, /* @__PURE__ */ jsx.h("path", { fill: "currentColor", d: "M992 480h-97.44C879.168 293.472 730.512 144.96 544 129.536V32c0-17.664-14.336-32-32-32s-32 14.336-32 32v97.536C293.504 144.96 144.832 293.472 129.424 480H32c-17.664 0-32 14.336-32 32s14.336 32 32 32h97.424C144.832 730.512 293.504 879.04 480 894.464V992c0 17.664 14.336 32 32 32s32-14.336 32-32v-97.536C730.512 879.04 879.168 730.512 894.56 544H992c17.664 0 32-14.336 32-32s-14.336-32-32-32M480 193.584V480H193.552C208.56 328.8 328.8 208.592 480 193.584M193.552 544H480v286.416C328.8 815.408 208.56 695.2 193.552 544M544 830.416V544h286.448C815.44 695.2 695.2 815.408 544 830.416M544 480V193.584C695.2 208.592 815.44 328.8 830.448 480z" })));
11211
11235
  var directionDeg = {
11212
11236
  top: {
11213
11237
  value: 0,
@@ -11276,7 +11300,8 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
11276
11300
  Operator,
11277
11301
  MikeOn,
11278
11302
  MikeOff,
11279
- MikeDoing
11303
+ MikeDoing,
11304
+ GoPresetPoint
11280
11305
  };
11281
11306
  var icons_default = Icons;
11282
11307
 
@@ -12149,6 +12174,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
12149
12174
  // src/plugins/player/infoList.tsx
12150
12175
  init_define_processenv();
12151
12176
  init_jsx_shim();
12177
+ init_jsx();
12152
12178
  var InfoListItem = ({
12153
12179
  label,
12154
12180
  value,
@@ -12198,7 +12224,21 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
12198
12224
  if (!resData || resData.code !== 0)
12199
12225
  throw new PtzCameraError(`ptz control failed: ${resData == null ? void 0 : resData.msg}`);
12200
12226
  });
12227
+ var ptzGoPresetPoint = (puId, index, id, params, token) => __async(void 0, null, function* () {
12228
+ const headers = {
12229
+ Authorization: token || ""
12230
+ };
12231
+ const resData = yield http_default.put(
12232
+ `${apiUrls.bvscpV1()}/pu/ptz/preset/go/${puId}/${index}/${id}`,
12233
+ params,
12234
+ { headers }
12235
+ );
12236
+ logger_default.api("\u53BB\u9884\u5236\u70B9\u63A7\u5236: ", { params, resData });
12237
+ if (!resData || resData.code !== 0)
12238
+ throw new PtzCameraError(`ptz preset point failed: ${resData == null ? void 0 : resData.msg}`);
12239
+ });
12201
12240
  var deviceApi = {
12241
+ ptzGoPresetPoint,
12202
12242
  ptzCamera
12203
12243
  };
12204
12244
  var device_default = deviceApi;
@@ -12278,6 +12318,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
12278
12318
  init() {
12279
12319
  const el = this.el;
12280
12320
  this.domEventStore.add(el, "mousedown", this.start.bind(this));
12321
+ this.domEventStore.add(el, "click", () => this.dispatch("click"));
12281
12322
  core_default.dom.append(el, core_default.dom.createByJsx(this._icon));
12282
12323
  return el;
12283
12324
  }
@@ -15465,6 +15506,64 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
15465
15506
  };
15466
15507
  var speedSlider_default = PtzSpeedSliderPlugin;
15467
15508
 
15509
+ // src/plugins/ptz/index.tsx
15510
+ init_jsx();
15511
+
15512
+ // src/templates/input.tsx
15513
+ init_define_processenv();
15514
+ init_jsx_shim();
15515
+ init_jsx();
15516
+ var Input = (_a) => {
15517
+ var _b = _a, {
15518
+ className,
15519
+ type = "text",
15520
+ name,
15521
+ placeholder,
15522
+ readonly = false,
15523
+ disabled = false,
15524
+ onChange
15525
+ } = _b, rest = __objRest(_b, [
15526
+ "className",
15527
+ "type",
15528
+ "name",
15529
+ "placeholder",
15530
+ "readonly",
15531
+ "disabled",
15532
+ "onChange"
15533
+ ]);
15534
+ HTMLInputElement;
15535
+ const clsName = core_default.style.prefixCls(["input", className]);
15536
+ const handleChange = (e) => {
15537
+ const input = e.target;
15538
+ if (input.type == "number") {
15539
+ const min2 = Number(input.min);
15540
+ const max2 = Number(input.max);
15541
+ const value = Number(input.value);
15542
+ if (value < min2) {
15543
+ input.value = input.min;
15544
+ }
15545
+ if (value > max2) {
15546
+ input.value = input.max;
15547
+ }
15548
+ }
15549
+ onChange && onChange(input.value);
15550
+ };
15551
+ return /* @__PURE__ */ jsx.h(
15552
+ "input",
15553
+ __spreadValues({
15554
+ className: clsName,
15555
+ withNamespace: true,
15556
+ type,
15557
+ name,
15558
+ placeholder,
15559
+ readonly,
15560
+ disabled,
15561
+ onChange: handleChange
15562
+ }, rest)
15563
+ );
15564
+ };
15565
+ var input_default = Input;
15566
+
15468
15567
  // src/plugins/ptz/index.tsx
15469
15568
  var directionOperateVariants = {
15470
15569
  ["lefttop" /* LEFT_TOP */]: {
@@ -15507,6 +15606,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
15507
15606
  // 0 - 100
15508
15607
  this.hSpeed = 50;
15509
15608
  this.vSpeed = 50;
15609
+ this.iPresetPoint = 1;
15510
15610
  this._buttons = [];
15511
15611
  this._speedSlider = new speedSlider_default(this.hSpeed);
15512
15612
  }
@@ -15542,6 +15642,26 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
15542
15642
  button.addEventListener("start", () => sendOperate(false));
15543
15643
  button.addEventListener("stop", () => sendOperate(true));
15544
15644
  }
15645
+ sendGoPresetPoint() {
15646
+ return __async(this, null, function* () {
15647
+ if (!this.puOption || !this.token)
15648
+ return;
15649
+ try {
15650
+ yield device_default.ptzGoPresetPoint(
15651
+ this.puOption.id,
15652
+ this.puOption.index,
15653
+ this.iPresetPoint.toString(),
15654
+ {
15655
+ hSpeed: this.hSpeed,
15656
+ vSpeed: this.vSpeed
15657
+ },
15658
+ this.token
15659
+ );
15660
+ } catch (e) {
15661
+ logger_default.error(e);
15662
+ }
15663
+ });
15664
+ }
15545
15665
  beforeDestroy() {
15546
15666
  this._buttons.forEach((plugin) => plugin.destroy());
15547
15667
  }
@@ -15615,7 +15735,32 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
15615
15735
  minusButton.init(),
15616
15736
  plusButton.init()
15617
15737
  ));
15618
- })), /* @__PURE__ */ jsx.h(
15738
+ }).concat(Array.from({ length: 1 }).map(() => {
15739
+ const goButton = new button_default3(
15740
+ /* @__PURE__ */ jsx.h(icons_default.GoPresetPoint, null),
15741
+ "ptz_control_operator-button"
15742
+ );
15743
+ goButton.addEventListener("click", () => this.sendGoPresetPoint());
15744
+ return /* @__PURE__ */ jsx.h("div", { className: "ptz_control_camera-option_item", withNamespace: true }, /* @__PURE__ */ jsx.h(
15745
+ "span",
15746
+ {
15747
+ className: "ptz_control_camera-option_item_label",
15748
+ withNamespace: true
15749
+ },
15750
+ t("yu-zhi-dian"),
15751
+ "\uFF1A"
15752
+ ), /* @__PURE__ */ jsx.h(
15753
+ "span",
15754
+ {
15755
+ className: "ptz_control_camera-option_item_value",
15756
+ withNamespace: true
15757
+ },
15758
+ /* @__PURE__ */ jsx.h(input_default, { type: "number", style: "width: 50px; vertical-align: middle;height: 16px;", min: "1", max: "255", value: "1", onChange: (value) => {
15759
+ this.iPresetPoint = Number(value);
15760
+ } }),
15761
+ goButton.init()
15762
+ ));
15763
+ }))), /* @__PURE__ */ jsx.h(
15619
15764
  button_default2,
15620
15765
  {
15621
15766
  className: "ptz_control_close-button",
@@ -15826,6 +15971,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
15826
15971
  }
15827
15972
  close() {
15828
15973
  return __async(this, null, function* () {
15974
+ this._infoModal.dispatch("hide");
15829
15975
  this.dispatch("close");
15830
15976
  this.closeWebrtc();
15831
15977
  });
@@ -16033,7 +16179,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
16033
16179
  lastRecv = recv;
16034
16180
  const currentLost = lost - lastLost;
16035
16181
  lastLost = lost;
16036
- lastRate = currentLost > 0 ? currentLost / currentRecv : 0;
16182
+ lastRate = currentLost > 0 ? currentLost / (currentRecv + currentLost) : 0;
16037
16183
  lastRate = Math.floor(lastRate * 100);
16038
16184
  return lastRate;
16039
16185
  }
@@ -16075,7 +16221,6 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
16075
16221
  },
16076
16222
  packetsLost(v2, info) {
16077
16223
  const lostRate = audioLostCalc(info.packetsReceived, info.packetsLost);
16078
- console.log("lost rate", lostRate);
16079
16224
  return {
16080
16225
  label: t("lostpackrate"),
16081
16226
  value: String(lostRate) + "%"
@@ -16102,7 +16247,6 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
16102
16247
  },
16103
16248
  packetsRecved(v2, info) {
16104
16249
  const lostRate = videoLostCalc(info.packetsRecved, info.packetsLost);
16105
- console.log("lost rate", lostRate);
16106
16250
  return {
16107
16251
  label: t("lostpackrate"),
16108
16252
  value: String(lostRate) + "%"
@@ -17414,7 +17558,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
17414
17558
  connecting: "connecting",
17415
17559
  connected: "connected",
17416
17560
  transfer: "transfer",
17417
- type: "type"
17561
+ type: "type",
17562
+ "yu-zhi-dian": "preset"
17418
17563
  };
17419
17564
 
17420
17565
  // src/locales/zh.json
@@ -17452,7 +17597,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
17452
17597
  connecting: "\u8FDE\u63A5\u4E2D",
17453
17598
  connected: "\u5DF2\u8FDE\u63A5",
17454
17599
  transfer: "\u4F20\u8F93",
17455
- type: "\u65B9\u5F0F"
17600
+ type: "\u65B9\u5F0F",
17601
+ "yu-zhi-dian": "\u9884\u5236\u70B9"
17456
17602
  };
17457
17603
 
17458
17604
  // src/locales/i18n.ts
@@ -18882,6 +19028,8 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
18882
19028
  player.mask.visible = true;
18883
19029
  player.mask.text = t("video-closed");
18884
19030
  useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
19031
+ removeRefresh();
19032
+ player.close();
18885
19033
  }
18886
19034
  };
18887
19035
  hplayer.onvideo = () => {
@@ -18902,7 +19050,6 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
18902
19050
  player.clearEventListener("recordStart");
18903
19051
  player.clearEventListener("recordStop");
18904
19052
  player.clearEventListener("screenshot");
18905
- removeRefresh();
18906
19053
  hplayer == null ? void 0 : hplayer.close();
18907
19054
  yield dialog_default.closeDialogs(
18908
19055
  [hplayer == null ? void 0 : hplayer.getDialogID()],
@@ -18924,7 +19071,6 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
18924
19071
  yield hplayer.getPlayerStatistic();
18925
19072
  const staticInfo = hplayer.mediaStatisticInfo;
18926
19073
  const { infoModal } = e2.target;
18927
- console.log(staticInfo.audioStatistic);
18928
19074
  const audioList = hplayer.getAudioInfo().codec == "none" ? [] : [
18929
19075
  {
18930
19076
  label: t("codec"),
package/dist/main.es.css CHANGED
@@ -664,7 +664,7 @@
664
664
  transition: all 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
665
665
  display: flex;
666
666
  justify-content: space-between;
667
- height: 25%;
667
+ height: 30%;
668
668
  min-height: 110px;
669
669
  max-height: 150px;
670
670
  width: 60%;
@@ -714,7 +714,7 @@
714
714
  white-space: nowrap;
715
715
  }
716
716
  .bvplayer-ptz_control_camera-option_item:not(:last-child) {
717
- margin-bottom: 8px;
717
+ margin-bottom: 4%;
718
718
  }
719
719
  .bvplayer-ptz_control_camera-option_item_label {
720
720
  display: inline-block;
package/dist/main.es.js CHANGED
@@ -21,6 +21,18 @@ var __spreadValues = (a2, b2) => {
21
21
  return a2;
22
22
  };
23
23
  var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
24
36
  var __esm = (fn2, res) => function __init() {
25
37
  return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
26
38
  };
@@ -99,7 +111,7 @@ var __async = (__this, __arguments, generator) => {
99
111
  var define_processenv_default;
100
112
  var init_define_processenv = __esm({
101
113
  "<define:processenv>"() {
102
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.55", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.57", PROJECT_NAMESPACE: "bvplayer" };
103
115
  }
104
116
  });
105
117
 
@@ -9224,9 +9236,20 @@ var post = (url, param, option) => __async(void 0, null, function* () {
9224
9236
  });
9225
9237
  return data;
9226
9238
  });
9239
+ var put = (url, param, option) => __async(void 0, null, function* () {
9240
+ const data = yield request(url, {
9241
+ method: "PUT" /* PUT */,
9242
+ headers: __spreadValues({
9243
+ "Content-Type": "application/json;charset=UTF-8"
9244
+ }, option == null ? void 0 : option.headers),
9245
+ bodyData: param
9246
+ });
9247
+ return data;
9248
+ });
9227
9249
  var http = {
9228
9250
  get: get3,
9229
- post
9251
+ post,
9252
+ put
9230
9253
  };
9231
9254
  var http_default = http;
9232
9255
 
@@ -11194,6 +11217,7 @@ var PtzControl = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h(S
11194
11217
  var MikeOn = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h(SvgElementbvPlayerCoreMikeOn, null));
11195
11218
  var MikeOff = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h(SvgElementbvPlayerCoreMikeOff, null));
11196
11219
  var MikeDoing = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h("span", { style: `display: inline-block; --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='18' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.67' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.33' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='0' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3C!-- 1702453639037 --%3E%3C/svg%3E"); width: 20px; height: 20px; background-color: currentcolor; mask-image: var(--svg); mask-repeat: no-repeat; mask-size: 100% 100%;` }));
11220
+ var GoPresetPoint = () => /* @__PURE__ */ jsx.h(Icon, null, /* @__PURE__ */ jsx.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 1024 1024" }, /* @__PURE__ */ jsx.h("path", { fill: "currentColor", d: "M992 480h-97.44C879.168 293.472 730.512 144.96 544 129.536V32c0-17.664-14.336-32-32-32s-32 14.336-32 32v97.536C293.504 144.96 144.832 293.472 129.424 480H32c-17.664 0-32 14.336-32 32s14.336 32 32 32h97.424C144.832 730.512 293.504 879.04 480 894.464V992c0 17.664 14.336 32 32 32s32-14.336 32-32v-97.536C730.512 879.04 879.168 730.512 894.56 544H992c17.664 0 32-14.336 32-32s-14.336-32-32-32M480 193.584V480H193.552C208.56 328.8 328.8 208.592 480 193.584M193.552 544H480v286.416C328.8 815.408 208.56 695.2 193.552 544M544 830.416V544h286.448C815.44 695.2 695.2 815.408 544 830.416M544 480V193.584C695.2 208.592 815.44 328.8 830.448 480z" })));
11197
11221
  var directionDeg = {
11198
11222
  top: {
11199
11223
  value: 0,
@@ -11262,7 +11286,8 @@ var Icons = {
11262
11286
  Operator,
11263
11287
  MikeOn,
11264
11288
  MikeOff,
11265
- MikeDoing
11289
+ MikeDoing,
11290
+ GoPresetPoint
11266
11291
  };
11267
11292
  var icons_default = Icons;
11268
11293
 
@@ -12135,6 +12160,7 @@ var fullscreen_default = fullscreen;
12135
12160
  // src/plugins/player/infoList.tsx
12136
12161
  init_define_processenv();
12137
12162
  init_jsx_shim();
12163
+ init_jsx();
12138
12164
  var InfoListItem = ({
12139
12165
  label,
12140
12166
  value,
@@ -12184,7 +12210,21 @@ var ptzCamera = (puId, index, params, token) => __async(void 0, null, function*
12184
12210
  if (!resData || resData.code !== 0)
12185
12211
  throw new PtzCameraError(`ptz control failed: ${resData == null ? void 0 : resData.msg}`);
12186
12212
  });
12213
+ var ptzGoPresetPoint = (puId, index, id, params, token) => __async(void 0, null, function* () {
12214
+ const headers = {
12215
+ Authorization: token || ""
12216
+ };
12217
+ const resData = yield http_default.put(
12218
+ `${apiUrls.bvscpV1()}/pu/ptz/preset/go/${puId}/${index}/${id}`,
12219
+ params,
12220
+ { headers }
12221
+ );
12222
+ logger_default.api("\u53BB\u9884\u5236\u70B9\u63A7\u5236: ", { params, resData });
12223
+ if (!resData || resData.code !== 0)
12224
+ throw new PtzCameraError(`ptz preset point failed: ${resData == null ? void 0 : resData.msg}`);
12225
+ });
12187
12226
  var deviceApi = {
12227
+ ptzGoPresetPoint,
12188
12228
  ptzCamera
12189
12229
  };
12190
12230
  var device_default = deviceApi;
@@ -12264,6 +12304,7 @@ var PtzControlButtonPlugin = class extends Plugin {
12264
12304
  init() {
12265
12305
  const el = this.el;
12266
12306
  this.domEventStore.add(el, "mousedown", this.start.bind(this));
12307
+ this.domEventStore.add(el, "click", () => this.dispatch("click"));
12267
12308
  core_default.dom.append(el, core_default.dom.createByJsx(this._icon));
12268
12309
  return el;
12269
12310
  }
@@ -15451,6 +15492,64 @@ var PtzSpeedSliderPlugin = class extends Plugin {
15451
15492
  };
15452
15493
  var speedSlider_default = PtzSpeedSliderPlugin;
15453
15494
 
15495
+ // src/plugins/ptz/index.tsx
15496
+ init_jsx();
15497
+
15498
+ // src/templates/input.tsx
15499
+ init_define_processenv();
15500
+ init_jsx_shim();
15501
+ init_jsx();
15502
+ var Input = (_a) => {
15503
+ var _b = _a, {
15504
+ className,
15505
+ type = "text",
15506
+ name,
15507
+ placeholder,
15508
+ readonly = false,
15509
+ disabled = false,
15510
+ onChange
15511
+ } = _b, rest = __objRest(_b, [
15512
+ "className",
15513
+ "type",
15514
+ "name",
15515
+ "placeholder",
15516
+ "readonly",
15517
+ "disabled",
15518
+ "onChange"
15519
+ ]);
15520
+ HTMLInputElement;
15521
+ const clsName = core_default.style.prefixCls(["input", className]);
15522
+ const handleChange = (e) => {
15523
+ const input = e.target;
15524
+ if (input.type == "number") {
15525
+ const min2 = Number(input.min);
15526
+ const max2 = Number(input.max);
15527
+ const value = Number(input.value);
15528
+ if (value < min2) {
15529
+ input.value = input.min;
15530
+ }
15531
+ if (value > max2) {
15532
+ input.value = input.max;
15533
+ }
15534
+ }
15535
+ onChange && onChange(input.value);
15536
+ };
15537
+ return /* @__PURE__ */ jsx.h(
15538
+ "input",
15539
+ __spreadValues({
15540
+ className: clsName,
15541
+ withNamespace: true,
15542
+ type,
15543
+ name,
15544
+ placeholder,
15545
+ readonly,
15546
+ disabled,
15547
+ onChange: handleChange
15548
+ }, rest)
15549
+ );
15550
+ };
15551
+ var input_default = Input;
15552
+
15454
15553
  // src/plugins/ptz/index.tsx
15455
15554
  var directionOperateVariants = {
15456
15555
  ["lefttop" /* LEFT_TOP */]: {
@@ -15493,6 +15592,7 @@ var PtzPluginBase = class extends Plugin {
15493
15592
  // 0 - 100
15494
15593
  this.hSpeed = 50;
15495
15594
  this.vSpeed = 50;
15595
+ this.iPresetPoint = 1;
15496
15596
  this._buttons = [];
15497
15597
  this._speedSlider = new speedSlider_default(this.hSpeed);
15498
15598
  }
@@ -15528,6 +15628,26 @@ var PtzPluginBase = class extends Plugin {
15528
15628
  button.addEventListener("start", () => sendOperate(false));
15529
15629
  button.addEventListener("stop", () => sendOperate(true));
15530
15630
  }
15631
+ sendGoPresetPoint() {
15632
+ return __async(this, null, function* () {
15633
+ if (!this.puOption || !this.token)
15634
+ return;
15635
+ try {
15636
+ yield device_default.ptzGoPresetPoint(
15637
+ this.puOption.id,
15638
+ this.puOption.index,
15639
+ this.iPresetPoint.toString(),
15640
+ {
15641
+ hSpeed: this.hSpeed,
15642
+ vSpeed: this.vSpeed
15643
+ },
15644
+ this.token
15645
+ );
15646
+ } catch (e) {
15647
+ logger_default.error(e);
15648
+ }
15649
+ });
15650
+ }
15531
15651
  beforeDestroy() {
15532
15652
  this._buttons.forEach((plugin) => plugin.destroy());
15533
15653
  }
@@ -15601,7 +15721,32 @@ var PtzPluginBase = class extends Plugin {
15601
15721
  minusButton.init(),
15602
15722
  plusButton.init()
15603
15723
  ));
15604
- })), /* @__PURE__ */ jsx.h(
15724
+ }).concat(Array.from({ length: 1 }).map(() => {
15725
+ const goButton = new button_default3(
15726
+ /* @__PURE__ */ jsx.h(icons_default.GoPresetPoint, null),
15727
+ "ptz_control_operator-button"
15728
+ );
15729
+ goButton.addEventListener("click", () => this.sendGoPresetPoint());
15730
+ return /* @__PURE__ */ jsx.h("div", { className: "ptz_control_camera-option_item", withNamespace: true }, /* @__PURE__ */ jsx.h(
15731
+ "span",
15732
+ {
15733
+ className: "ptz_control_camera-option_item_label",
15734
+ withNamespace: true
15735
+ },
15736
+ t("yu-zhi-dian"),
15737
+ "\uFF1A"
15738
+ ), /* @__PURE__ */ jsx.h(
15739
+ "span",
15740
+ {
15741
+ className: "ptz_control_camera-option_item_value",
15742
+ withNamespace: true
15743
+ },
15744
+ /* @__PURE__ */ jsx.h(input_default, { type: "number", style: "width: 50px; vertical-align: middle;height: 16px;", min: "1", max: "255", value: "1", onChange: (value) => {
15745
+ this.iPresetPoint = Number(value);
15746
+ } }),
15747
+ goButton.init()
15748
+ ));
15749
+ }))), /* @__PURE__ */ jsx.h(
15605
15750
  button_default2,
15606
15751
  {
15607
15752
  className: "ptz_control_close-button",
@@ -15812,6 +15957,7 @@ var PlayerPlugin = class extends Plugin {
15812
15957
  }
15813
15958
  close() {
15814
15959
  return __async(this, null, function* () {
15960
+ this._infoModal.dispatch("hide");
15815
15961
  this.dispatch("close");
15816
15962
  this.closeWebrtc();
15817
15963
  });
@@ -16019,7 +16165,7 @@ var PlayerPlugin = class extends Plugin {
16019
16165
  lastRecv = recv;
16020
16166
  const currentLost = lost - lastLost;
16021
16167
  lastLost = lost;
16022
- lastRate = currentLost > 0 ? currentLost / currentRecv : 0;
16168
+ lastRate = currentLost > 0 ? currentLost / (currentRecv + currentLost) : 0;
16023
16169
  lastRate = Math.floor(lastRate * 100);
16024
16170
  return lastRate;
16025
16171
  }
@@ -16061,7 +16207,6 @@ var PlayerPlugin = class extends Plugin {
16061
16207
  },
16062
16208
  packetsLost(v2, info) {
16063
16209
  const lostRate = audioLostCalc(info.packetsReceived, info.packetsLost);
16064
- console.log("lost rate", lostRate);
16065
16210
  return {
16066
16211
  label: t("lostpackrate"),
16067
16212
  value: String(lostRate) + "%"
@@ -16088,7 +16233,6 @@ var PlayerPlugin = class extends Plugin {
16088
16233
  },
16089
16234
  packetsRecved(v2, info) {
16090
16235
  const lostRate = videoLostCalc(info.packetsRecved, info.packetsLost);
16091
- console.log("lost rate", lostRate);
16092
16236
  return {
16093
16237
  label: t("lostpackrate"),
16094
16238
  value: String(lostRate) + "%"
@@ -17400,7 +17544,8 @@ var en_default = {
17400
17544
  connecting: "connecting",
17401
17545
  connected: "connected",
17402
17546
  transfer: "transfer",
17403
- type: "type"
17547
+ type: "type",
17548
+ "yu-zhi-dian": "preset"
17404
17549
  };
17405
17550
 
17406
17551
  // src/locales/zh.json
@@ -17438,7 +17583,8 @@ var zh_default = {
17438
17583
  connecting: "\u8FDE\u63A5\u4E2D",
17439
17584
  connected: "\u5DF2\u8FDE\u63A5",
17440
17585
  transfer: "\u4F20\u8F93",
17441
- type: "\u65B9\u5F0F"
17586
+ type: "\u65B9\u5F0F",
17587
+ "yu-zhi-dian": "\u9884\u5236\u70B9"
17442
17588
  };
17443
17589
 
17444
17590
  // src/locales/i18n.ts
@@ -18868,6 +19014,8 @@ var PuPlayer = (props) => {
18868
19014
  player.mask.visible = true;
18869
19015
  player.mask.text = t("video-closed");
18870
19016
  useRecntMgr == null ? void 0 : useRecntMgr.reconnect();
19017
+ removeRefresh();
19018
+ player.close();
18871
19019
  }
18872
19020
  };
18873
19021
  hplayer.onvideo = () => {
@@ -18888,7 +19036,6 @@ var PuPlayer = (props) => {
18888
19036
  player.clearEventListener("recordStart");
18889
19037
  player.clearEventListener("recordStop");
18890
19038
  player.clearEventListener("screenshot");
18891
- removeRefresh();
18892
19039
  hplayer == null ? void 0 : hplayer.close();
18893
19040
  yield dialog_default.closeDialogs(
18894
19041
  [hplayer == null ? void 0 : hplayer.getDialogID()],
@@ -18910,7 +19057,6 @@ var PuPlayer = (props) => {
18910
19057
  yield hplayer.getPlayerStatistic();
18911
19058
  const staticInfo = hplayer.mediaStatisticInfo;
18912
19059
  const { infoModal } = e2.target;
18913
- console.log(staticInfo.audioStatistic);
18914
19060
  const audioList = hplayer.getAudioInfo().codec == "none" ? [] : [
18915
19061
  {
18916
19062
  label: t("codec"),
@@ -26,7 +26,12 @@ interface IPtzParams {
26
26
  vSpeed?: number;
27
27
  stop?: boolean;
28
28
  }
29
+ interface IPrestParams {
30
+ hSpeed: number;
31
+ vSpeed: number;
32
+ }
29
33
  declare const deviceApi: {
34
+ ptzGoPresetPoint: (puId: string, index: number, id: string, params: IPrestParams, token: string) => Promise<void>;
30
35
  ptzCamera: (puId: string, index: number, params: IPtzParams, token: string) => Promise<void>;
31
36
  };
32
37
  export default deviceApi;
@@ -2,6 +2,7 @@ import { IPluginEventMap, Plugin } from "../types";
2
2
  interface IPtzControlButtonPluginEventMap extends IPluginEventMap {
3
3
  start: undefined;
4
4
  stop: undefined;
5
+ click: undefined;
5
6
  }
6
7
  declare class PtzControlButtonPlugin extends Plugin<HTMLButtonElement, IPtzControlButtonPluginEventMap> {
7
8
  private _icon;
@@ -20,11 +20,13 @@ declare class PtzPluginBase extends Plugin<HTMLDivElement, IControllerPluginEven
20
20
  token?: string;
21
21
  hSpeed: number;
22
22
  vSpeed: number;
23
+ iPresetPoint: number;
23
24
  private _speedSlider;
24
25
  private _buttons;
25
26
  constructor();
26
27
  setPuParam(puOption: IPuOption, token: string): void;
27
28
  bindOperate(button: PtzControlButtonPlugin, operate: DIRECTION_OPERATE | CAMERA_OPERATE | undefined): void;
29
+ sendGoPresetPoint(): Promise<void>;
28
30
  protected beforeDestroy(): void;
29
31
  init(): HTMLDivElement;
30
32
  }
@@ -30,6 +30,7 @@ declare const Icons: {
30
30
  MikeOn: FC<IIconsProps>;
31
31
  MikeOff: FC<IIconsProps>;
32
32
  MikeDoing: FC<IIconsProps>;
33
+ GoPresetPoint: FC<IIconsProps>;
33
34
  };
34
35
  export { Icon };
35
36
  export default Icons;
@@ -1,6 +1,6 @@
1
1
  interface IJsxInputProps extends IJsxProps {
2
2
  className?: string;
3
- type?: "text" | "password";
3
+ type?: "text" | "password" | 'number';
4
4
  name?: string;
5
5
  placeholder?: string;
6
6
  readonly?: boolean;
@@ -4,6 +4,7 @@ interface HttpOption {
4
4
  interface Http {
5
5
  get(url: string, param?: URLSearchParams, option?: HttpOption): Promise<any>;
6
6
  post(url: string, param?: object, option?: HttpOption): Promise<any>;
7
+ put(url: string, param?: object, option?: HttpOption): Promise<any>;
7
8
  }
8
9
  declare const http: Http;
9
10
  export default http;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.55",
3
+ "version": "0.8.57",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",