@besovideo/webrtc-player 0.10.28 → 0.10.30

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.
package/README.md CHANGED
@@ -484,10 +484,16 @@ instance.open()
484
484
 
485
485
  **水印配置**
486
486
 
487
- `PuPlayer` 和 `PlayBack` 支持水印层。水印是播放窗口上的 DOM/CSS 叠层,不会写入本地录像文件。
487
+ `PuPlayer`、`PlayBack`、`CreateCallEndPoint` 和 `callEndPointUtils.pushLocalMedia` 支持水印层。水印是播放窗口上的 DOM/CSS 叠层,不会写入本地录像文件。
488
488
 
489
489
  ```typescript
490
- import { globalConfigHandler, PuPlayer, PlayBack } from "@besovideo/webrtc-player";
490
+ import {
491
+ globalConfigHandler,
492
+ PuPlayer,
493
+ PlayBack,
494
+ CreateCallEndPoint,
495
+ callEndPointUtils,
496
+ } from "@besovideo/webrtc-player";
491
497
 
492
498
  interface IWatermarkConfig {
493
499
  // 是否启用水印
@@ -520,7 +526,7 @@ interface IWatermarkConfig {
520
526
  zIndex?: number;
521
527
  }
522
528
 
523
- // 全局配置:影响之后创建的 PuPlayer 和 PlayBack 实例
529
+ // 全局配置:影响之后创建的播放器、回放、通话和推流预览实例
524
530
  globalConfigHandler.setDefaultProps({
525
531
  watermark: {
526
532
  // 支持 string 或 string[],数组会按多行显示
@@ -571,6 +577,22 @@ PlayBack({
571
577
  enable: false,
572
578
  },
573
579
  });
580
+
581
+ // 通话端点窗口覆盖全局配置,本地和远端视频区域都会显示水印
582
+ CreateCallEndPoint({
583
+ // ...
584
+ watermark: {
585
+ text: "通话水印",
586
+ },
587
+ });
588
+
589
+ // 推送本地媒体流预览覆盖全局配置
590
+ callEndPointUtils.pushLocalMedia({
591
+ // ...
592
+ watermark: {
593
+ text: "推流预览水印",
594
+ },
595
+ });
574
596
  ```
575
597
 
576
598
  水印间距会根据播放窗口大小自动调整。`gapX` / `gapY` 表示最小间距,`maxColumns` / `maxRows` 用于限制大屏下最多显示的水印密度:
@@ -588,6 +610,8 @@ const callEndPointUtils: {
588
610
  token: string;
589
611
  // div 用于渲染
590
612
  container?: HTMLDivElement;
613
+ // 播放窗口水印配置,支持全局配置和实例覆盖
614
+ watermark?: IWatermarkConfig;
591
615
  // 是否获取视频
592
616
  video?: boolean;
593
617
  // 是否获取音频
@@ -353,7 +353,6 @@
353
353
  .bvplayer-modal_title-bar {
354
354
  display: flex;
355
355
  justify-content: space-between;
356
- margin-bottom: 8px;
357
356
  font-size: 16px;
358
357
  }
359
358
  .bvplayer-modal_title-bar_close {
@@ -361,7 +360,6 @@
361
360
  pointer-events: auto;
362
361
  }
363
362
  .bvplayer-modal_body {
364
- padding: 8px;
365
363
  overflow: hidden;
366
364
  overflow-y: auto;
367
365
  }
@@ -899,8 +897,8 @@
899
897
  position: absolute;
900
898
  }
901
899
  .bvplayer-player .bvplayer-modal {
902
- min-width: 120px;
903
- min-height: 100px;
900
+ max-width: calc(100% - 40px);
901
+ max-height: calc(100% - 40px);
904
902
  }
905
903
  .bvplayer-player-fit--contain .bvplayer-video_screen {
906
904
  -o-object-fit: contain;
@@ -924,12 +922,11 @@
924
922
  }
925
923
  .bvplayer-player_info-modal_content {
926
924
  width: 280px;
927
- min-height: 180px;
928
925
  display: flex;
929
926
  flex-direction: column;
930
927
  }
931
928
  .bvplayer-player_info-modal_section:not(:last-child) {
932
- margin-bottom: 16px;
929
+ margin-bottom: 0px;
933
930
  }
934
931
  .bvplayer-player_info-modal_section_title {
935
932
  display: inline-block;
@@ -955,7 +952,7 @@
955
952
  white-space: nowrap;
956
953
  }
957
954
  .bvplayer-player_info-modal_list_item:not(:last-child) {
958
- margin-bottom: 8px;
955
+ margin-bottom: 2px;
959
956
  }
960
957
  .bvplayer-player_info-modal_list_item_label {
961
958
  display: inline-block;
@@ -1203,6 +1200,19 @@
1203
1200
  line-height: 30px;
1204
1201
  padding-left: 10px;
1205
1202
  }
1203
+ .videoCall_dialogPanel .switchType {
1204
+ border: 1px solid #c4c4c4;
1205
+ border-radius: 4px;
1206
+ cursor: pointer;
1207
+ padding: 1px;
1208
+ position: absolute;
1209
+ right: 180px;
1210
+ top: 2px;
1211
+ color: #8d8d8d;
1212
+ }
1213
+ .videoCall_dialogPanel .switchType:hover {
1214
+ color: #636363;
1215
+ }
1206
1216
  .videoCall_dialogPanel .remoteView {
1207
1217
  display: inline-block;
1208
1218
  vertical-align: top;
@@ -124,7 +124,7 @@ var bvPlayerCore = (() => {
124
124
  var define_processenv_default;
125
125
  var init_define_processenv = __esm({
126
126
  "<define:processenv>"() {
127
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.28", PROJECT_NAMESPACE: "bvplayer" };
127
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.30", PROJECT_NAMESPACE: "bvplayer" };
128
128
  }
129
129
  });
130
130
 
@@ -22010,7 +22010,7 @@ padding: 2px 5px;
22010
22010
  logger_default.api("device media bvrtc open dialog: ", { params, resData });
22011
22011
  if (!resData || resData.code !== 0 || !((_a = resData.data) == null ? void 0 : _a.dialogid)) {
22012
22012
  if (resData.code == 7) {
22013
- throw new OpenDialogError(`${t("hui-fang-wen-jian-bu-cun-zai")}`);
22013
+ throw new OpenDialogError(`${t("X_CODE_7")}`);
22014
22014
  }
22015
22015
  throw new OpenDialogError(
22016
22016
  `${t("da-kai-chuan-shu-tong-dao-shi-bai")}: ${resData.msg}`
@@ -29705,7 +29705,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
29705
29705
  value: audio.codec.clockRate + "Hz@" + audio.rtp.sampleRates
29706
29706
  },
29707
29707
  ...Number.isNaN(audio.rtp.bitRate) ? [] : [{
29708
- label: t("data-received") + audio.rtp.bitRate,
29708
+ label: t("data-received"),
29709
29709
  value: audio.rtp.bitRate.toFixed(0) + " kbps, loss" + audio.rtp.packageLostTotal
29710
29710
  }],
29711
29711
  ...Number.isNaN(audio.rtp.avaragePackageLostRate) ? [] : [
@@ -29729,7 +29729,7 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
29729
29729
  value: `${video.codec.width}x${video.codec.height}@${video.rtp.sampleRates.toFixed(0)}fps`
29730
29730
  },
29731
29731
  ...Number.isNaN(video.rtp.bitRate) ? [] : [{
29732
- label: t("data-received") + video.rtp.bitRate,
29732
+ label: t("data-received"),
29733
29733
  value: String(video.rtp.bitRate.toFixed(0)) + " kbps, loss" + video.rtp.packageLostTotal
29734
29734
  }],
29735
29735
  ...Number.isNaN(video.rtp.avaragePackageLostRate) ? [] : [
@@ -35413,7 +35413,16 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35413
35413
  }
35414
35414
  let remoteUserTitle = core_default.dom.create("div", "remoteUserTitle");
35415
35415
  let localUserTitle = core_default.dom.create("div", "localUserTitle");
35416
- const dialog = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: `${clsName}_dialogPanel` }, /* @__PURE__ */ jsx_default.h("div", { className: "titleBar" }, titleBar, closeBtn), statusSpan, mainStatusSpan, /* @__PURE__ */ jsx_default.h("div", { className: `full-view` }, myVideo), /* @__PURE__ */ jsx_default.h("div", { className: `mini-view` }, remoteVideo, remoteUserTitle), /* @__PURE__ */ jsx_default.h("div", { className: "localUserDiv" }, localUserTitle))));
35416
+ const toggleViewType = () => {
35417
+ if (myVideo.parentElement && myVideo.parentElement.className.includes("mini-view")) {
35418
+ SetViewType("localFull", true);
35419
+ } else {
35420
+ SetViewType("remoteFull", true);
35421
+ }
35422
+ };
35423
+ const dialog = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: `${clsName}_dialogPanel` }, /* @__PURE__ */ jsx_default.h("div", { className: "titleBar" }, titleBar, closeBtn), statusSpan, mainStatusSpan, /* @__PURE__ */ jsx_default.h("div", { className: `full-view` }, myVideo), /* @__PURE__ */ jsx_default.h("div", { className: `mini-view` }, remoteVideo, remoteUserTitle), /* @__PURE__ */ jsx_default.h("div", { className: "localUserDiv", style: "position: relative;" }, localUserTitle, /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", class: "switchType", onclick: () => {
35424
+ toggleViewType();
35425
+ } }, /* @__PURE__ */ jsx_default.h("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ jsx_default.h("path", { fill: "currentColor", d: "M14.293 2.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L16.586 8H5a1 1 0 0 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414m-4.586 10a1 1 0 0 1 0 1.414L7.414 16H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1-1.414 1.414l-4-4a1 1 0 0 1 0-1.414l4-4a1 1 0 0 1 1.414 0" }))))));
35417
35426
  core_default.dom.append(callContainer, dialog);
35418
35427
  const titleBarCancelMove = EnableMoveEle(titleBar.parentElement, callContainer);
35419
35428
  if (!beCall) {
@@ -35438,13 +35447,15 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35438
35447
  }
35439
35448
  const gUserInfo = {
35440
35449
  localName: "",
35450
+ localId: "",
35441
35451
  remoteName: "",
35452
+ remoteId: "",
35442
35453
  localResolution: "",
35443
35454
  remoteResolution: ""
35444
35455
  };
35445
35456
  function updateUserTitle() {
35446
- const localTitle = gUserInfo.localName + ` ${gUserInfo.localResolution}`;
35447
- const remoteTitle = gUserInfo.remoteName + ` ${gUserInfo.remoteResolution}`;
35457
+ const localTitle = gUserInfo.localName + ` (${gUserInfo.localId})`;
35458
+ const remoteTitle = gUserInfo.remoteName + ` (${gUserInfo.remoteId})`;
35448
35459
  if (localUserTitle.innerText != localTitle) {
35449
35460
  localUserTitle.innerText = localTitle;
35450
35461
  }
@@ -35454,7 +35465,9 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35454
35465
  }
35455
35466
  function setUserInfo(userInfo) {
35456
35467
  gUserInfo.localName = userInfo.localName;
35468
+ gUserInfo.localId = userInfo.localId;
35457
35469
  gUserInfo.remoteName = userInfo.remoteName;
35470
+ gUserInfo.remoteId = userInfo.remoteId;
35458
35471
  updateUserTitle();
35459
35472
  }
35460
35473
  function setTitie(title) {
@@ -35743,6 +35756,17 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35743
35756
  dialogPanelHandle.setZIndex(createParams.zIndex);
35744
35757
  }
35745
35758
  const { myVideo, remoteVideo } = dialogPanelHandle;
35759
+ const watermarkConfig = mergeWatermarkConfig(
35760
+ globalConfigHandler.getDefaultProps().watermark,
35761
+ createParams.watermark
35762
+ );
35763
+ const addWatermark = (container) => {
35764
+ const watermark = new watermark_default(watermarkConfig);
35765
+ core_default.dom.append(container, watermark.init());
35766
+ processHandle.reg(() => {
35767
+ watermark.destroy();
35768
+ });
35769
+ };
35746
35770
  const intervalDestoryHandle = GenProcessDestoryHandle();
35747
35771
  const open = (openParams) => __async(this, null, function* () {
35748
35772
  var _a2, _b, _c;
@@ -35754,11 +35778,13 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35754
35778
  try {
35755
35779
  const useInfo = yield user_default.info(createParams.token);
35756
35780
  dialogPanelHandle.setUserInfo({
35781
+ localId: useInfo.data.id,
35757
35782
  localName: useInfo.data.name,
35783
+ remoteId: openParams.user || "",
35758
35784
  remoteName: openParams.name
35759
35785
  });
35760
35786
  processHandle.setRc("PUSH_LOCAL_MEDIA_ERROR", t("tui-song-ben-di-mei-ti-shi-bai"));
35761
- dialogPanelHandle.SetViewType("localFull");
35787
+ dialogPanelHandle.SetViewType("remoteFull", true);
35762
35788
  let currentSecond = Date.now();
35763
35789
  const intervalHandle = () => {
35764
35790
  const pastSeconds = Math.floor((Date.now() - currentSecond) / 1e3);
@@ -35793,6 +35819,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35793
35819
  }
35794
35820
  throw openMedia.message;
35795
35821
  }
35822
+ addWatermark(myVideo);
35796
35823
  const openResult = yield openMedia == null ? void 0 : openMedia.push();
35797
35824
  if (openResult.code != "SUCCESS") {
35798
35825
  throw openResult.message;
@@ -35842,6 +35869,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35842
35869
  hasVideo: !!waitRemoteResult.data.video,
35843
35870
  events: dialogPanelHandle.closeHandle
35844
35871
  }, dialogPanelHandle.pcSink);
35872
+ addWatermark(remoteVideo);
35845
35873
  processHandle.reg(() => {
35846
35874
  var _a3;
35847
35875
  (_a3 = remoteOpenResult.close) == null ? void 0 : _a3.call(remoteOpenResult);
@@ -35860,6 +35888,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35860
35888
  hasVideo: avCall2.video,
35861
35889
  events: dialogPanelHandle.closeHandle
35862
35890
  }, dialogPanelHandle.pcSink);
35891
+ addWatermark(remoteVideo);
35863
35892
  processHandle.reg(() => {
35864
35893
  var _a3;
35865
35894
  (_a3 = remoteOpenResult.close) == null ? void 0 : _a3.call(remoteOpenResult);
@@ -35975,7 +36004,8 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
35975
36004
  playerConfig: {
35976
36005
  disabledControls: (params == null ? void 0 : params.disabledControls) ? [...params == null ? void 0 : params.disabledControls, "ptzControl", "mike"] : ["ptzControl", "mike"],
35977
36006
  enableController: !!(params == null ? void 0 : params.enableController)
35978
- }
36007
+ },
36008
+ watermark: params == null ? void 0 : params.watermark
35979
36009
  });
35980
36010
  const videoEle = player.video.getVideoEl();
35981
36011
  let firstTime = 0;
@@ -36061,7 +36091,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
36061
36091
  // src/components/callEndPointUtils.ts
36062
36092
  function pushLocalMedia(params) {
36063
36093
  return __async(this, null, function* () {
36064
- var _a, _b, _c, _d, _e, _f;
36094
+ var _a, _b, _c, _d, _e, _f, _g;
36065
36095
  i18n_default(params.locale || "zh");
36066
36096
  const processHandle = GenProcessDestoryHandle();
36067
36097
  let container = null;
@@ -36071,7 +36101,13 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
36071
36101
  container.style.width = "100%";
36072
36102
  container.style.position = "relative";
36073
36103
  core_default.dom.append(params.container, container);
36074
- container.player = CreatePlayerPlugin(container, params.renderParams);
36104
+ container.player = CreatePlayerPlugin(container, __spreadProps(__spreadValues({}, params.renderParams), {
36105
+ watermark: mergeWatermarkConfig(
36106
+ globalConfigHandler.getDefaultProps().watermark,
36107
+ (_a = params.renderParams) == null ? void 0 : _a.watermark,
36108
+ params.watermark
36109
+ )
36110
+ }));
36075
36111
  }
36076
36112
  processHandle.reg(() => {
36077
36113
  if (container) {
@@ -36086,7 +36122,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
36086
36122
  });
36087
36123
  const resultResult = yield mediaEndPoint.open({
36088
36124
  container,
36089
- videoEle: (_a = container == null ? void 0 : container.player) == null ? void 0 : _a.getVideoEle(),
36125
+ videoEle: (_b = container == null ? void 0 : container.player) == null ? void 0 : _b.getVideoEle(),
36090
36126
  call: {
36091
36127
  videoCall: !!params.video,
36092
36128
  name: "",
@@ -36114,7 +36150,7 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
36114
36150
  }
36115
36151
  const pushResult = yield resultResult.push();
36116
36152
  if (pushResult.code != "SUCCESS") {
36117
- (_b = resultResult.close) == null ? void 0 : _b.call(resultResult);
36153
+ (_c = resultResult.close) == null ? void 0 : _c.call(resultResult);
36118
36154
  return pushResult;
36119
36155
  }
36120
36156
  const close = () => __async(this, null, function* () {
@@ -36123,20 +36159,20 @@ a=fmtp:${pt} x-google-start-bitrate=${bitrate}`
36123
36159
  (_b2 = resultResult.close) == null ? void 0 : _b2.call(resultResult);
36124
36160
  processHandle.invoke();
36125
36161
  });
36126
- if ((_c = pushResult.streamIdInfo) == null ? void 0 : _c.mediaStream) {
36127
- const mediaStream = (_d = pushResult.streamIdInfo) == null ? void 0 : _d.mediaStream;
36162
+ if ((_d = pushResult.streamIdInfo) == null ? void 0 : _d.mediaStream) {
36163
+ const mediaStream = (_e = pushResult.streamIdInfo) == null ? void 0 : _e.mediaStream;
36128
36164
  const configHandle = GetInnerConfig(callEndPointConfig).pushMediaStream({
36129
36165
  stream: mediaStream,
36130
36166
  isShare: !!params.displayMedia
36131
36167
  });
36132
36168
  if (params.container) {
36133
- (_e = container == null ? void 0 : container.player) == null ? void 0 : _e.setMediaStream(mediaStream);
36169
+ (_f = container == null ? void 0 : container.player) == null ? void 0 : _f.setMediaStream(mediaStream);
36134
36170
  }
36135
36171
  processHandle.reg(() => {
36136
36172
  configHandle.remove();
36137
36173
  });
36138
36174
  }
36139
- if ((_f = pushResult.streamIdInfo) == null ? void 0 : _f.duration) {
36175
+ if ((_g = pushResult.streamIdInfo) == null ? void 0 : _g.duration) {
36140
36176
  let containerTrialShow2 = function() {
36141
36177
  if (container && !params.customDisTrial) {
36142
36178
  const ele = document.createElement("div");
package/dist/main.es.css CHANGED
@@ -353,7 +353,6 @@
353
353
  .bvplayer-modal_title-bar {
354
354
  display: flex;
355
355
  justify-content: space-between;
356
- margin-bottom: 8px;
357
356
  font-size: 16px;
358
357
  }
359
358
  .bvplayer-modal_title-bar_close {
@@ -361,7 +360,6 @@
361
360
  pointer-events: auto;
362
361
  }
363
362
  .bvplayer-modal_body {
364
- padding: 8px;
365
363
  overflow: hidden;
366
364
  overflow-y: auto;
367
365
  }
@@ -899,8 +897,8 @@
899
897
  position: absolute;
900
898
  }
901
899
  .bvplayer-player .bvplayer-modal {
902
- min-width: 120px;
903
- min-height: 100px;
900
+ max-width: calc(100% - 40px);
901
+ max-height: calc(100% - 40px);
904
902
  }
905
903
  .bvplayer-player-fit--contain .bvplayer-video_screen {
906
904
  -o-object-fit: contain;
@@ -924,12 +922,11 @@
924
922
  }
925
923
  .bvplayer-player_info-modal_content {
926
924
  width: 280px;
927
- min-height: 180px;
928
925
  display: flex;
929
926
  flex-direction: column;
930
927
  }
931
928
  .bvplayer-player_info-modal_section:not(:last-child) {
932
- margin-bottom: 16px;
929
+ margin-bottom: 0px;
933
930
  }
934
931
  .bvplayer-player_info-modal_section_title {
935
932
  display: inline-block;
@@ -955,7 +952,7 @@
955
952
  white-space: nowrap;
956
953
  }
957
954
  .bvplayer-player_info-modal_list_item:not(:last-child) {
958
- margin-bottom: 8px;
955
+ margin-bottom: 2px;
959
956
  }
960
957
  .bvplayer-player_info-modal_list_item_label {
961
958
  display: inline-block;
@@ -1203,6 +1200,19 @@
1203
1200
  line-height: 30px;
1204
1201
  padding-left: 10px;
1205
1202
  }
1203
+ .videoCall_dialogPanel .switchType {
1204
+ border: 1px solid #c4c4c4;
1205
+ border-radius: 4px;
1206
+ cursor: pointer;
1207
+ padding: 1px;
1208
+ position: absolute;
1209
+ right: 180px;
1210
+ top: 2px;
1211
+ color: #8d8d8d;
1212
+ }
1213
+ .videoCall_dialogPanel .switchType:hover {
1214
+ color: #636363;
1215
+ }
1206
1216
  .videoCall_dialogPanel .remoteView {
1207
1217
  display: inline-block;
1208
1218
  vertical-align: top;
package/dist/main.es.js CHANGED
@@ -118,7 +118,7 @@ var __async = (__this, __arguments, generator) => {
118
118
  var define_processenv_default;
119
119
  var init_define_processenv = __esm({
120
120
  "<define:processenv>"() {
121
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.28", PROJECT_NAMESPACE: "bvplayer" };
121
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.30", PROJECT_NAMESPACE: "bvplayer" };
122
122
  }
123
123
  });
124
124
 
@@ -21992,7 +21992,7 @@ var getPlaybackBvrtc = (param, token, signal) => __async(void 0, null, function*
21992
21992
  logger_default.api("device media bvrtc open dialog: ", { params, resData });
21993
21993
  if (!resData || resData.code !== 0 || !((_a = resData.data) == null ? void 0 : _a.dialogid)) {
21994
21994
  if (resData.code == 7) {
21995
- throw new OpenDialogError(`${t("hui-fang-wen-jian-bu-cun-zai")}`);
21995
+ throw new OpenDialogError(`${t("X_CODE_7")}`);
21996
21996
  }
21997
21997
  throw new OpenDialogError(
21998
21998
  `${t("da-kai-chuan-shu-tong-dao-shi-bai")}: ${resData.msg}`
@@ -29687,7 +29687,7 @@ var PlayerPlugin = class extends Plugin {
29687
29687
  value: audio.codec.clockRate + "Hz@" + audio.rtp.sampleRates
29688
29688
  },
29689
29689
  ...Number.isNaN(audio.rtp.bitRate) ? [] : [{
29690
- label: t("data-received") + audio.rtp.bitRate,
29690
+ label: t("data-received"),
29691
29691
  value: audio.rtp.bitRate.toFixed(0) + " kbps, loss" + audio.rtp.packageLostTotal
29692
29692
  }],
29693
29693
  ...Number.isNaN(audio.rtp.avaragePackageLostRate) ? [] : [
@@ -29711,7 +29711,7 @@ var PlayerPlugin = class extends Plugin {
29711
29711
  value: `${video.codec.width}x${video.codec.height}@${video.rtp.sampleRates.toFixed(0)}fps`
29712
29712
  },
29713
29713
  ...Number.isNaN(video.rtp.bitRate) ? [] : [{
29714
- label: t("data-received") + video.rtp.bitRate,
29714
+ label: t("data-received"),
29715
29715
  value: String(video.rtp.bitRate.toFixed(0)) + " kbps, loss" + video.rtp.packageLostTotal
29716
29716
  }],
29717
29717
  ...Number.isNaN(video.rtp.avaragePackageLostRate) ? [] : [
@@ -35395,7 +35395,16 @@ function CreateDialogPanel(container, events, beCall) {
35395
35395
  }
35396
35396
  let remoteUserTitle = core_default.dom.create("div", "remoteUserTitle");
35397
35397
  let localUserTitle = core_default.dom.create("div", "localUserTitle");
35398
- const dialog = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: `${clsName}_dialogPanel` }, /* @__PURE__ */ jsx_default.h("div", { className: "titleBar" }, titleBar, closeBtn), statusSpan, mainStatusSpan, /* @__PURE__ */ jsx_default.h("div", { className: `full-view` }, myVideo), /* @__PURE__ */ jsx_default.h("div", { className: `mini-view` }, remoteVideo, remoteUserTitle), /* @__PURE__ */ jsx_default.h("div", { className: "localUserDiv" }, localUserTitle))));
35398
+ const toggleViewType = () => {
35399
+ if (myVideo.parentElement && myVideo.parentElement.className.includes("mini-view")) {
35400
+ SetViewType("localFull", true);
35401
+ } else {
35402
+ SetViewType("remoteFull", true);
35403
+ }
35404
+ };
35405
+ const dialog = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: `${clsName}_dialogPanel` }, /* @__PURE__ */ jsx_default.h("div", { className: "titleBar" }, titleBar, closeBtn), statusSpan, mainStatusSpan, /* @__PURE__ */ jsx_default.h("div", { className: `full-view` }, myVideo), /* @__PURE__ */ jsx_default.h("div", { className: `mini-view` }, remoteVideo, remoteUserTitle), /* @__PURE__ */ jsx_default.h("div", { className: "localUserDiv", style: "position: relative;" }, localUserTitle, /* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", class: "switchType", onclick: () => {
35406
+ toggleViewType();
35407
+ } }, /* @__PURE__ */ jsx_default.h("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ jsx_default.h("path", { fill: "currentColor", d: "M14.293 2.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L16.586 8H5a1 1 0 0 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414m-4.586 10a1 1 0 0 1 0 1.414L7.414 16H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1-1.414 1.414l-4-4a1 1 0 0 1 0-1.414l4-4a1 1 0 0 1 1.414 0" }))))));
35399
35408
  core_default.dom.append(callContainer, dialog);
35400
35409
  const titleBarCancelMove = EnableMoveEle(titleBar.parentElement, callContainer);
35401
35410
  if (!beCall) {
@@ -35420,13 +35429,15 @@ function CreateDialogPanel(container, events, beCall) {
35420
35429
  }
35421
35430
  const gUserInfo = {
35422
35431
  localName: "",
35432
+ localId: "",
35423
35433
  remoteName: "",
35434
+ remoteId: "",
35424
35435
  localResolution: "",
35425
35436
  remoteResolution: ""
35426
35437
  };
35427
35438
  function updateUserTitle() {
35428
- const localTitle = gUserInfo.localName + ` ${gUserInfo.localResolution}`;
35429
- const remoteTitle = gUserInfo.remoteName + ` ${gUserInfo.remoteResolution}`;
35439
+ const localTitle = gUserInfo.localName + ` (${gUserInfo.localId})`;
35440
+ const remoteTitle = gUserInfo.remoteName + ` (${gUserInfo.remoteId})`;
35430
35441
  if (localUserTitle.innerText != localTitle) {
35431
35442
  localUserTitle.innerText = localTitle;
35432
35443
  }
@@ -35436,7 +35447,9 @@ function CreateDialogPanel(container, events, beCall) {
35436
35447
  }
35437
35448
  function setUserInfo(userInfo) {
35438
35449
  gUserInfo.localName = userInfo.localName;
35450
+ gUserInfo.localId = userInfo.localId;
35439
35451
  gUserInfo.remoteName = userInfo.remoteName;
35452
+ gUserInfo.remoteId = userInfo.remoteId;
35440
35453
  updateUserTitle();
35441
35454
  }
35442
35455
  function setTitie(title) {
@@ -35725,6 +35738,17 @@ function CreateCallEndPoint(createParams) {
35725
35738
  dialogPanelHandle.setZIndex(createParams.zIndex);
35726
35739
  }
35727
35740
  const { myVideo, remoteVideo } = dialogPanelHandle;
35741
+ const watermarkConfig = mergeWatermarkConfig(
35742
+ globalConfigHandler.getDefaultProps().watermark,
35743
+ createParams.watermark
35744
+ );
35745
+ const addWatermark = (container) => {
35746
+ const watermark = new watermark_default(watermarkConfig);
35747
+ core_default.dom.append(container, watermark.init());
35748
+ processHandle.reg(() => {
35749
+ watermark.destroy();
35750
+ });
35751
+ };
35728
35752
  const intervalDestoryHandle = GenProcessDestoryHandle();
35729
35753
  const open = (openParams) => __async(this, null, function* () {
35730
35754
  var _a2, _b, _c;
@@ -35736,11 +35760,13 @@ function CreateCallEndPoint(createParams) {
35736
35760
  try {
35737
35761
  const useInfo = yield user_default.info(createParams.token);
35738
35762
  dialogPanelHandle.setUserInfo({
35763
+ localId: useInfo.data.id,
35739
35764
  localName: useInfo.data.name,
35765
+ remoteId: openParams.user || "",
35740
35766
  remoteName: openParams.name
35741
35767
  });
35742
35768
  processHandle.setRc("PUSH_LOCAL_MEDIA_ERROR", t("tui-song-ben-di-mei-ti-shi-bai"));
35743
- dialogPanelHandle.SetViewType("localFull");
35769
+ dialogPanelHandle.SetViewType("remoteFull", true);
35744
35770
  let currentSecond = Date.now();
35745
35771
  const intervalHandle = () => {
35746
35772
  const pastSeconds = Math.floor((Date.now() - currentSecond) / 1e3);
@@ -35775,6 +35801,7 @@ function CreateCallEndPoint(createParams) {
35775
35801
  }
35776
35802
  throw openMedia.message;
35777
35803
  }
35804
+ addWatermark(myVideo);
35778
35805
  const openResult = yield openMedia == null ? void 0 : openMedia.push();
35779
35806
  if (openResult.code != "SUCCESS") {
35780
35807
  throw openResult.message;
@@ -35824,6 +35851,7 @@ function CreateCallEndPoint(createParams) {
35824
35851
  hasVideo: !!waitRemoteResult.data.video,
35825
35852
  events: dialogPanelHandle.closeHandle
35826
35853
  }, dialogPanelHandle.pcSink);
35854
+ addWatermark(remoteVideo);
35827
35855
  processHandle.reg(() => {
35828
35856
  var _a3;
35829
35857
  (_a3 = remoteOpenResult.close) == null ? void 0 : _a3.call(remoteOpenResult);
@@ -35842,6 +35870,7 @@ function CreateCallEndPoint(createParams) {
35842
35870
  hasVideo: avCall2.video,
35843
35871
  events: dialogPanelHandle.closeHandle
35844
35872
  }, dialogPanelHandle.pcSink);
35873
+ addWatermark(remoteVideo);
35845
35874
  processHandle.reg(() => {
35846
35875
  var _a3;
35847
35876
  (_a3 = remoteOpenResult.close) == null ? void 0 : _a3.call(remoteOpenResult);
@@ -35957,7 +35986,8 @@ function CreatePlayerPlugin(container, params) {
35957
35986
  playerConfig: {
35958
35987
  disabledControls: (params == null ? void 0 : params.disabledControls) ? [...params == null ? void 0 : params.disabledControls, "ptzControl", "mike"] : ["ptzControl", "mike"],
35959
35988
  enableController: !!(params == null ? void 0 : params.enableController)
35960
- }
35989
+ },
35990
+ watermark: params == null ? void 0 : params.watermark
35961
35991
  });
35962
35992
  const videoEle = player.video.getVideoEl();
35963
35993
  let firstTime = 0;
@@ -36043,7 +36073,7 @@ function CreatePlayerPlugin(container, params) {
36043
36073
  // src/components/callEndPointUtils.ts
36044
36074
  function pushLocalMedia(params) {
36045
36075
  return __async(this, null, function* () {
36046
- var _a, _b, _c, _d, _e, _f;
36076
+ var _a, _b, _c, _d, _e, _f, _g;
36047
36077
  i18n_default(params.locale || "zh");
36048
36078
  const processHandle = GenProcessDestoryHandle();
36049
36079
  let container = null;
@@ -36053,7 +36083,13 @@ function pushLocalMedia(params) {
36053
36083
  container.style.width = "100%";
36054
36084
  container.style.position = "relative";
36055
36085
  core_default.dom.append(params.container, container);
36056
- container.player = CreatePlayerPlugin(container, params.renderParams);
36086
+ container.player = CreatePlayerPlugin(container, __spreadProps(__spreadValues({}, params.renderParams), {
36087
+ watermark: mergeWatermarkConfig(
36088
+ globalConfigHandler.getDefaultProps().watermark,
36089
+ (_a = params.renderParams) == null ? void 0 : _a.watermark,
36090
+ params.watermark
36091
+ )
36092
+ }));
36057
36093
  }
36058
36094
  processHandle.reg(() => {
36059
36095
  if (container) {
@@ -36068,7 +36104,7 @@ function pushLocalMedia(params) {
36068
36104
  });
36069
36105
  const resultResult = yield mediaEndPoint.open({
36070
36106
  container,
36071
- videoEle: (_a = container == null ? void 0 : container.player) == null ? void 0 : _a.getVideoEle(),
36107
+ videoEle: (_b = container == null ? void 0 : container.player) == null ? void 0 : _b.getVideoEle(),
36072
36108
  call: {
36073
36109
  videoCall: !!params.video,
36074
36110
  name: "",
@@ -36096,7 +36132,7 @@ function pushLocalMedia(params) {
36096
36132
  }
36097
36133
  const pushResult = yield resultResult.push();
36098
36134
  if (pushResult.code != "SUCCESS") {
36099
- (_b = resultResult.close) == null ? void 0 : _b.call(resultResult);
36135
+ (_c = resultResult.close) == null ? void 0 : _c.call(resultResult);
36100
36136
  return pushResult;
36101
36137
  }
36102
36138
  const close = () => __async(this, null, function* () {
@@ -36105,20 +36141,20 @@ function pushLocalMedia(params) {
36105
36141
  (_b2 = resultResult.close) == null ? void 0 : _b2.call(resultResult);
36106
36142
  processHandle.invoke();
36107
36143
  });
36108
- if ((_c = pushResult.streamIdInfo) == null ? void 0 : _c.mediaStream) {
36109
- const mediaStream = (_d = pushResult.streamIdInfo) == null ? void 0 : _d.mediaStream;
36144
+ if ((_d = pushResult.streamIdInfo) == null ? void 0 : _d.mediaStream) {
36145
+ const mediaStream = (_e = pushResult.streamIdInfo) == null ? void 0 : _e.mediaStream;
36110
36146
  const configHandle = GetInnerConfig(callEndPointConfig).pushMediaStream({
36111
36147
  stream: mediaStream,
36112
36148
  isShare: !!params.displayMedia
36113
36149
  });
36114
36150
  if (params.container) {
36115
- (_e = container == null ? void 0 : container.player) == null ? void 0 : _e.setMediaStream(mediaStream);
36151
+ (_f = container == null ? void 0 : container.player) == null ? void 0 : _f.setMediaStream(mediaStream);
36116
36152
  }
36117
36153
  processHandle.reg(() => {
36118
36154
  configHandle.remove();
36119
36155
  });
36120
36156
  }
36121
- if ((_f = pushResult.streamIdInfo) == null ? void 0 : _f.duration) {
36157
+ if ((_g = pushResult.streamIdInfo) == null ? void 0 : _g.duration) {
36122
36158
  let containerTrialShow2 = function() {
36123
36159
  if (container && !params.customDisTrial) {
36124
36160
  const ele = document.createElement("div");
@@ -4,6 +4,7 @@ declare const userApi: {
4
4
  code: number;
5
5
  data: {
6
6
  name: string;
7
+ id: string;
7
8
  };
8
9
  }>;
9
10
  };
@@ -2,6 +2,7 @@ import { AvCallPayload } from "src/api/call";
2
2
  import initI18n from "../locales/i18n";
3
3
  import { ICommandWsGetter } from "./callComponents/commandWsManager";
4
4
  import { CallEndPointConfigManagerUser } from "./callComponents/callEndPointConfig";
5
+ import { IWatermarkConfig } from "../plugins/watermark";
5
6
  declare enum ECallSteps {
6
7
  "GET_USER_INFO" = "GET_USER_INFO",
7
8
  "START_CALL" = "START_CALL",
@@ -24,6 +25,7 @@ type TCreateEndPointParams = ICommandWsGetter & {
24
25
  onClose?: () => void;
25
26
  zIndex?: number;
26
27
  locale?: Parameters<typeof initI18n>[0];
28
+ watermark?: IWatermarkConfig;
27
29
  };
28
30
  export declare function CreateProcessHandle<T extends string, TData = void>(): {
29
31
  reg(handle: (data: TData) => void | Promise<void>): {
@@ -1,6 +1,7 @@
1
1
  import { IOpenResult } from "./callComponents/mediaEndPoint";
2
2
  import { IOpenParams } from "./callEndPoint";
3
3
  import { CreatePlayerPlugin } from "./callEndPointUtilsPlayer";
4
+ import { IWatermarkConfig } from "../plugins/watermark";
4
5
  export type IPushLocalMediaResult = IOpenResult & {
5
6
  streamIdInfo?: {
6
7
  id: string;
@@ -15,6 +16,7 @@ declare function pushLocalMedia(params: {
15
16
  locale?: "zh" | "en";
16
17
  container?: HTMLDivElement;
17
18
  renderParams?: Parameters<typeof CreatePlayerPlugin>[1];
19
+ watermark?: IWatermarkConfig;
18
20
  video?: boolean;
19
21
  audio?: boolean;
20
22
  displayMedia?: IOpenParams["displayMedia"];
@@ -1,7 +1,9 @@
1
1
  import { IControlPluginMap } from "../plugins/controller";
2
+ import { IWatermarkConfig } from "../plugins/watermark";
2
3
  export declare function CreatePlayerPlugin(container: HTMLDivElement, params?: {
3
- disabledControls: (keyof IControlPluginMap)[];
4
- enableController: boolean;
4
+ disabledControls?: (keyof IControlPluginMap)[];
5
+ enableController?: boolean;
6
+ watermark?: IWatermarkConfig;
5
7
  }): {
6
8
  setMediaStream(stream: MediaStream): void;
7
9
  destory(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.10.28",
3
+ "version": "0.10.30",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",