@besovideo/webrtc-player 0.8.76 → 0.8.78

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
@@ -139,7 +139,130 @@ instance.playerStatus : {
139
139
  addEventListener(handle: ((bFullscreen: boolean) => void)):void;
140
140
  // 移除事件监听
141
141
  removeEventListener(handle: ((bFullscreen: boolean) => void)):void;
142
- }
142
+ },
143
+ volume: {
144
+ // 获取音量 0 - 1 之间
145
+ Get(): number,
146
+ // 设置音量 0 - 1 之间
147
+ Set(volume: number): void;
148
+ // 添加事件监听
149
+ addEventListener(handle: ((volume: number) => void)):void;
150
+ // 移除事件监听
151
+ removeEventListener(handle: ((volume: number) => void)):void;
152
+ },
153
+ information: {
154
+ // 获取信息窗口显示状态,是否显示
155
+ Get(): boolean,
156
+ // 设置信息窗口显示状态,是否显示
157
+ Set(bShow: boolean): void;
158
+ // 添加事件监听
159
+ addEventListener(handle: ((bShow: boolean) => void)):void;
160
+ // 移除事件监听
161
+ removeEventListener(handle: ((bShow: boolean) => void)):void;
162
+ },
163
+ record:{
164
+ // 获取录像状态,是否在录像
165
+ //"recordStart" 录像已经开始
166
+ //"recordStop" 录像已结束
167
+ Get(): {type: "recordStart" | "recordStop"},
168
+ // 设置录像状态
169
+ Set(status: {type: "recordStart" | "recordStop"}): void;
170
+ // 添加事件监听
171
+ addEventListener(handle: ((status: {type: "recordStart" | "recordStop"}) => void)):void;
172
+ // 移除事件监听
173
+ removeEventListener(handle: ((status: {type: "recordStart" | "recordStop"}) => void)):void;
174
+ },
175
+ rotate: {
176
+ // 获取旋转状态,顺时针方向
177
+ // "Rotate0" 0度
178
+ // "Rotate90" 90度
179
+ // "Rotate180" 180度
180
+ // "Rotate270" 270度
181
+ Get(): {type: "Rotate0" | "Rotate90" | "Rotate180" | "Rotate270"},
182
+ // 设置画面旋转状态
183
+ Set(status: {type: "Rotate0" | "Rotate90" | "Rotate180" | "Rotate270"}): void;
184
+ // 添加事件监听
185
+ addEventListener(handle: ((status: {type: "Rotate0" | "Rotate90" | "Rotate180" | "Rotate270"}) => void)):void;
186
+ // 移除事件监听
187
+ removeEventListener(handle: ((status: {type: "Rotate0" | "Rotate90" | "Rotate180" | "Rotate270"}) => void)):void;
188
+ },
189
+ ptzControl: {
190
+ // 获取云台控制面板显示状态,是否显示
191
+ Get(): {show?: boolean},
192
+ // 设置云台控制面板显示状态
193
+ Set(status: {show?: boolean}): void;
194
+ // 添加事件监听
195
+ addEventListener(handle: ((status: {show: boolean})) => void)):void;
196
+ // 移除事件监听
197
+ removeEventListener(handle: ((status: {show: boolean})) => void)):void;
198
+ },
199
+ mike: {
200
+ // 获取对讲状态,是否在对讲
201
+ Get(): {talking?: boolean},
202
+ // 设置对讲状态
203
+ Set(status: {talking?: boolean}): void;
204
+ // 添加事件监听
205
+ addEventListener(handle: ((status: {talking?: boolean})) => void)):void;
206
+ // 移除事件监听
207
+ removeEventListener(handle: ((status: {talking?: boolean})) => void)):void;
208
+ },
209
+ screenshot:{
210
+ //进行截图
211
+ exec(): void;
212
+ // 添加事件监听,获取截图结果,
213
+ // cancelAutoDownload 函数,调用会取消掉下载图片
214
+ addEventListener(handle: ((status: {img?: Blob, cancelAutoDownload?: ()=>void})) => void)):void;
215
+ // 移除事件监听
216
+ removeEventListener(handle: ((status: {img?: Blob, cancelAutoDownload?: ()=>void })) => void)):void;
217
+ },
218
+ informationGet: () => Promise<{
219
+ //音频统计信息
220
+ audio?: {
221
+ //编码相关
222
+ codec: {
223
+ //https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats/channels
224
+ channels?: number; //通道数
225
+ //https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats/clockRate
226
+ clockRate: number; //时钟频率
227
+ //https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats/mimeType
228
+ mimeType: string; //mimetype
229
+ //https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats/sdpFmtpLine
230
+ sdpFmtpLine?: string;
231
+ };
232
+ //传输相关
233
+ rtp: {
234
+ sampleRates: string; //采样率
235
+ bitRate: number; //bit速率
236
+ packageLostTotal: number; //丢包总数
237
+ avaragePackageLostRate: number; //平均丢包率
238
+ packageLostRate: number; //瞬时丢包率
239
+ };
240
+ };
241
+ //视频统计信息
242
+ video?: {
243
+ //编码相关
244
+ codec: {
245
+ type: string; //编码类型 video/H264 video/H265 (webcodec)
246
+ sampleRates: number; //采样率
247
+ width: number; //视频宽度
248
+ height: number; //视频高度
249
+ };
250
+ //传输相关
251
+ rtp: {
252
+ sampleRates: number; //视频采样率
253
+ bitRate: number; //bit 率
254
+ packageLostTotal: number; //总丢包数
255
+ avaragePackageLostRate: number; //平均丢包率
256
+ packageLostRate: number; //瞬时丢包率
257
+ };
258
+ };
259
+
260
+ // 播放相关
261
+ meta: {
262
+ lastSeconds: number; //持续时间 秒数
263
+ transType: "webrtc" | "bvrtc"; //传输方式
264
+ };
265
+ }>
143
266
  }
144
267
 
145
268
  // clearAllDialog 异步 释放全部打开的dialog 不管是音视频还是对讲
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.8.76", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.78", PROJECT_NAMESPACE: "bvplayer" };
115
115
  }
116
116
  });
117
117
 
@@ -5317,26 +5317,40 @@ var Notifier = class {
5317
5317
  this._map.set(name, []);
5318
5318
  }
5319
5319
  };
5320
+ function GetIDataHandleUtils(handle2) {
5321
+ return handle2;
5322
+ }
5320
5323
  var IDataHandle = class {
5321
- constructor(data, handle2) {
5324
+ constructor(data) {
5322
5325
  this.szHandle = [];
5323
5326
  this._data = data;
5327
+ }
5328
+ doInit() {
5329
+ var _a;
5330
+ this.destory = (_a = this.init) == null ? void 0 : _a.call(this);
5331
+ }
5332
+ setParams({
5333
+ handle: handle2,
5334
+ init: init2
5335
+ }) {
5324
5336
  this.handle = handle2;
5337
+ this.init = init2;
5325
5338
  }
5326
5339
  Get() {
5327
5340
  return this._data;
5328
5341
  }
5329
5342
  Set(data) {
5330
- if (this._data != data) {
5331
- this._data = data;
5332
- this.handle(this._data);
5333
- this.szHandle.forEach((handler) => handler(this._data));
5343
+ if (this._data != data && this.handle) {
5344
+ this.handle(data);
5334
5345
  }
5335
5346
  }
5336
5347
  addEventListener(handle2) {
5337
5348
  if (this.szHandle.findIndex((item) => item == handle2)) {
5338
5349
  this.szHandle.push(handle2);
5339
5350
  }
5351
+ return () => {
5352
+ this.removeEventListener(handle2);
5353
+ };
5340
5354
  }
5341
5355
  removeEventListener(handle2) {
5342
5356
  const targetIndex = this.szHandle.findIndex((item) => item == handle2);
@@ -7174,10 +7188,13 @@ var screenshotByCanvas = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (
7174
7188
  return;
7175
7189
  try {
7176
7190
  const blob = yield canvasToBlob(canvas);
7177
- file_default.downLoadBlob(blob, fileName, "png");
7191
+ return { blob, download() {
7192
+ file_default.downLoadBlob(blob, fileName, "png");
7193
+ } };
7178
7194
  } catch (e) {
7179
7195
  logger_default.libError(e.message);
7180
7196
  }
7197
+ return;
7181
7198
  });
7182
7199
  var screenshot = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (videoEl, fileName = `screenshot_${Date.now()}`) {
7183
7200
  if (!videoEl)
@@ -7186,7 +7203,7 @@ var screenshot = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (videoEl,
7186
7203
  canvas.width = videoEl.videoWidth;
7187
7204
  canvas.height = videoEl.videoHeight;
7188
7205
  canvas.getContext("2d").drawImage(videoEl, 0, 0, canvas.width, canvas.height);
7189
- yield screenshotByCanvas(canvas, fileName);
7206
+ return yield screenshotByCanvas(canvas, fileName);
7190
7207
  });
7191
7208
  var record = (element, stream, fileName = `record_${Date.now()}`) => {
7192
7209
  try {
@@ -7518,9 +7535,9 @@ var VideoPlugin = class extends Plugin {
7518
7535
  const fileName = this._genFileName("snapshot");
7519
7536
  const targetEle = this.canvasEnabled ? this._canvasEl : this._videoEl;
7520
7537
  if (targetEle.localName == "video") {
7521
- media_default.screenshot(targetEle, fileName);
7538
+ return media_default.screenshot(targetEle, fileName);
7522
7539
  } else {
7523
- media_default.screenshotByCanvas(targetEle, fileName);
7540
+ return media_default.screenshotByCanvas(targetEle, fileName);
7524
7541
  }
7525
7542
  }
7526
7543
  _genFileName(atcion) {
@@ -8214,6 +8231,15 @@ var SliderPlugin = class extends Plugin {
8214
8231
  get percent() {
8215
8232
  return this._percent;
8216
8233
  }
8234
+ setVolume(percent) {
8235
+ if (this.percent != percent) {
8236
+ this.percent = percent;
8237
+ this.dispatch("change", {
8238
+ target: this,
8239
+ percent: util_default.restrict(this.percent, 0, 1)
8240
+ });
8241
+ }
8242
+ }
8217
8243
  beforeDestroy() {
8218
8244
  }
8219
8245
  init(_container) {
@@ -8267,6 +8293,50 @@ init_logger();
8267
8293
  init_define_processenv();
8268
8294
  init_jsx_shim();
8269
8295
  init_jsx();
8296
+ function CreateIntercomUtils(intercomIns, type) {
8297
+ const handle2 = {
8298
+ isBusy: false,
8299
+ talking: false,
8300
+ open(toast) {
8301
+ return __async(this, null, function* () {
8302
+ if (!this.isBusy) {
8303
+ this.isBusy = true;
8304
+ if (!this.talking) {
8305
+ try {
8306
+ if (!navigator || !navigator.mediaDevices) {
8307
+ throw t("mei-you-mai-ke-feng-huo-zhe-mei-you-quan-xian");
8308
+ }
8309
+ yield intercomIns.open(void 0, type);
8310
+ this.talking = true;
8311
+ } catch (e) {
8312
+ if (toast) {
8313
+ toast.error(e);
8314
+ }
8315
+ this.isBusy = false;
8316
+ throw "";
8317
+ }
8318
+ }
8319
+ this.isBusy = false;
8320
+ } else {
8321
+ throw "error busy";
8322
+ }
8323
+ });
8324
+ },
8325
+ close() {
8326
+ return __async(this, null, function* () {
8327
+ if (this.talking && !this.isBusy) {
8328
+ this.isBusy = true;
8329
+ yield intercomIns.close();
8330
+ yield new Promise((r) => {
8331
+ setTimeout(r, 1e3);
8332
+ });
8333
+ this.isBusy = false;
8334
+ }
8335
+ });
8336
+ }
8337
+ };
8338
+ return handle2;
8339
+ }
8270
8340
  var _onIcon, _offIcon, _doingIcon, _isBusy, _talk, _intercom, _type, _onTalkStart, onTalkStart_fn, _onTalkEnd, onTalkEnd_fn;
8271
8341
  var MikeButton = class extends HTMLElement {
8272
8342
  constructor() {
@@ -8280,6 +8350,7 @@ var MikeButton = class extends HTMLElement {
8280
8350
  __privateAdd(this, _isBusy, false);
8281
8351
  //是否正在喊话
8282
8352
  __privateAdd(this, _talk, false);
8353
+ this.events = new Events();
8283
8354
  // 麦克风实例
8284
8355
  __privateAdd(this, _intercom, void 0);
8285
8356
  // 协议类型
@@ -8300,8 +8371,7 @@ var MikeButton = class extends HTMLElement {
8300
8371
  return;
8301
8372
  if (!__privateGet(this, _isBusy)) {
8302
8373
  __privateSet(this, _isBusy, true);
8303
- let pm;
8304
- pm = state ? __privateMethod(this, _onTalkStart, onTalkStart_fn).call(this) : __privateMethod(this, _onTalkEnd, onTalkEnd_fn).call(this);
8374
+ const pm = state ? __privateMethod(this, _onTalkStart, onTalkStart_fn).call(this) : __privateMethod(this, _onTalkEnd, onTalkEnd_fn).call(this);
8305
8375
  pm.then(() => {
8306
8376
  __privateSet(this, _talk, state);
8307
8377
  }).catch((e) => {
@@ -8351,6 +8421,7 @@ onTalkStart_fn = function() {
8351
8421
  }
8352
8422
  yield (_a = __privateGet(this, _intercom)) == null ? void 0 : _a.open(void 0, __privateGet(this, _type));
8353
8423
  __privateGet(this, _doingIcon).replaceWith(__privateGet(this, _onIcon));
8424
+ this.events.dispatch("intercomStart");
8354
8425
  });
8355
8426
  };
8356
8427
  _onTalkEnd = new WeakSet();
@@ -8363,6 +8434,7 @@ onTalkEnd_fn = function() {
8363
8434
  setTimeout(r, 1e3);
8364
8435
  });
8365
8436
  __privateGet(this, _doingIcon).replaceWith(__privateGet(this, _offIcon));
8437
+ this.events.dispatch("intercomStop");
8366
8438
  });
8367
8439
  };
8368
8440
  customElements.define("mike-button", MikeButton);
@@ -8491,8 +8563,8 @@ var ControllerPluginBase = class extends Plugin {
8491
8563
  return PtzButton;
8492
8564
  },
8493
8565
  mike: () => {
8494
- const MikeButton2 = new button_default(/* @__PURE__ */ jsx_default.h("mike-button", { inject: options == null ? void 0 : options.inject }), "mike");
8495
- return MikeButton2;
8566
+ const MikeButton3 = new button_default(/* @__PURE__ */ jsx_default.h("mike-button", { inject: options == null ? void 0 : options.inject }), "mike");
8567
+ return MikeButton3;
8496
8568
  }
8497
8569
  };
8498
8570
  this._controlKeys.forEach((name) => {
@@ -12787,7 +12859,6 @@ var PlayerPlugin = class extends Plugin {
12787
12859
  return "direct" /* DIRECT */;
12788
12860
  }
12789
12861
  init() {
12790
- var _a;
12791
12862
  logger_default.debug("\u6E32\u67D3PlayerPlugin", this.el);
12792
12863
  this.prepare();
12793
12864
  const videoEl = this._video.init();
@@ -12815,9 +12886,6 @@ var PlayerPlugin = class extends Plugin {
12815
12886
  target: this,
12816
12887
  mode: this._mode
12817
12888
  });
12818
- this.mikeBtn = (_a = this.el) == null ? void 0 : _a.getElementsByTagName(
12819
- "mike-button"
12820
- )[0];
12821
12889
  return this.el;
12822
12890
  }
12823
12891
  get mode() {
@@ -12921,9 +12989,113 @@ var PlayerPlugin = class extends Plugin {
12921
12989
  }
12922
12990
  this.setVideoFit(this._playerConfig.videoFit);
12923
12991
  }
12992
+ startIntercom() {
12993
+ return __async(this, null, function* () {
12994
+ var _a, _b;
12995
+ if (this.mikeBtn) {
12996
+ if (!this.mikeBtn.talking) {
12997
+ this.mikeBtn.talking = true;
12998
+ }
12999
+ } else {
13000
+ if (!((_a = this.intercomUtils) == null ? void 0 : _a.talking)) {
13001
+ try {
13002
+ yield (_b = this.intercomUtils) == null ? void 0 : _b.open(this._toast);
13003
+ this.dispatch("intercomStart");
13004
+ } catch (e) {
13005
+ }
13006
+ }
13007
+ }
13008
+ });
13009
+ }
13010
+ stopIntercom() {
13011
+ var _a, _b;
13012
+ if (this.mikeBtn) {
13013
+ if (this.mikeBtn.talking) {
13014
+ this.mikeBtn.talking = false;
13015
+ }
13016
+ } else {
13017
+ if ((_a = this.intercomUtils) == null ? void 0 : _a.talking) {
13018
+ (_b = this.intercomUtils) == null ? void 0 : _b.close();
13019
+ this.dispatch("intercomStop");
13020
+ }
13021
+ }
13022
+ }
13023
+ screenShot() {
13024
+ return __async(this, null, function* () {
13025
+ const screenshotResult = yield this._video.screenshot();
13026
+ let bDownload = true;
13027
+ this.dispatch("screenshot", screenshotResult && screenshotResult.blob ? {
13028
+ img: screenshotResult.blob,
13029
+ cancelAutoDownload() {
13030
+ bDownload = false;
13031
+ }
13032
+ } : void 0);
13033
+ if (bDownload && (screenshotResult == null ? void 0 : screenshotResult.download)) {
13034
+ screenshotResult == null ? void 0 : screenshotResult.download();
13035
+ }
13036
+ });
13037
+ }
13038
+ setVolume(percent) {
13039
+ var _a, _b;
13040
+ if (isNaN(percent)) {
13041
+ return;
13042
+ }
13043
+ if (percent > 1) {
13044
+ percent = 1;
13045
+ } else if (percent < 0) {
13046
+ percent = 0;
13047
+ }
13048
+ if (this.video.volume != percent) {
13049
+ this.video.volume = percent;
13050
+ if (((_a = this._panel) == null ? void 0 : _a.controller) && this._panel.controller.VolumeSlider) {
13051
+ (_b = this._panel) == null ? void 0 : _b.controller.activeVolume();
13052
+ this._panel.controller.VolumeSlider.percent = this.video.volume;
13053
+ this.DisplayVolumn(percent);
13054
+ }
13055
+ this.dispatch("volumeChange", {
13056
+ percent
13057
+ });
13058
+ }
13059
+ }
13060
+ DisplayVolumn(volume) {
13061
+ var _a;
13062
+ const panel = this._panel;
13063
+ const button = (_a = this.panel) == null ? void 0 : _a.controller.VolumeButton;
13064
+ if (panel && button) {
13065
+ const volumeSlider = panel.controller.VolumeSlider;
13066
+ if (volumeSlider) {
13067
+ volumeSlider.percent = volume;
13068
+ }
13069
+ volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
13070
+ }
13071
+ }
13072
+ recordStart() {
13073
+ var _a, _b;
13074
+ if (!this._recordState.BRecording()) {
13075
+ if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
13076
+ (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
13077
+ } else {
13078
+ this._video.recordStart();
13079
+ this._recordState.dispatch("RecordStart");
13080
+ this.dispatch("recordStart");
13081
+ }
13082
+ }
13083
+ }
13084
+ recordStop() {
13085
+ var _a, _b;
13086
+ if (this._recordState.BRecording()) {
13087
+ if ((_a = this._panel) == null ? void 0 : _a.controller.RecordButton) {
13088
+ (_b = this._panel) == null ? void 0 : _b.controller.RecordButton.dispatch("click");
13089
+ } else {
13090
+ this.dispatch("recordStop");
13091
+ this._video.recordStop();
13092
+ this._recordState.dispatch("RecordEnd");
13093
+ }
13094
+ }
13095
+ }
12924
13096
  // 初始化播放器、按钮相关事件
12925
13097
  initEvents() {
12926
- var _a, _b, _c;
13098
+ var _a, _b, _c, _d, _e, _f;
12927
13099
  this.video.addEventListener("canplay", () => {
12928
13100
  logger_default.info("Video canplay");
12929
13101
  this._spinner.spin = false;
@@ -12935,10 +13107,17 @@ var PlayerPlugin = class extends Plugin {
12935
13107
  return;
12936
13108
  this._spinner.spin = true;
12937
13109
  });
13110
+ this.ptz.addEventListener("hide", () => {
13111
+ this.ptz.visible = false;
13112
+ });
13113
+ (_b = this._infoModal) == null ? void 0 : _b.addEventListener("hide", () => {
13114
+ this._infoModal.visible = false;
13115
+ window.clearInterval(this._timer);
13116
+ });
12938
13117
  const panel = this._panel;
12939
13118
  if (!panel)
12940
13119
  return;
12941
- (_b = this.el) == null ? void 0 : _b.addEventListener("mousemove", () => {
13120
+ (_c = this.el) == null ? void 0 : _c.addEventListener("mousemove", () => {
12942
13121
  panel.showThenHide();
12943
13122
  });
12944
13123
  const updatePlayButton = (isInit = false) => {
@@ -12966,10 +13145,9 @@ var PlayerPlugin = class extends Plugin {
12966
13145
  button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Play, null);
12967
13146
  }
12968
13147
  });
12969
- panel.controller.addEventListener("screenshot", () => {
12970
- this.dispatch("screenshot");
12971
- this._video.screenshot();
12972
- });
13148
+ panel.controller.addEventListener("screenshot", () => __async(this, null, function* () {
13149
+ yield this.screenShot();
13150
+ }));
12973
13151
  panel.controller.addEventListener("recordStart", () => {
12974
13152
  this.dispatch("recordStart");
12975
13153
  this._video.recordStart();
@@ -12991,18 +13169,11 @@ var PlayerPlugin = class extends Plugin {
12991
13169
  panel.controller.addEventListener("ptzControl", () => {
12992
13170
  this.togglePtz();
12993
13171
  });
12994
- this.ptz.addEventListener("hide", () => {
12995
- this.ptz.visible = false;
12996
- });
12997
13172
  panel.controller.addEventListener("fullscreen", () => {
12998
13173
  const currenFullScreen = !(this.el ? fullscreen_default.isFull(this.el) : false);
12999
13174
  this.dispatch("fullscreen", currenFullScreen);
13000
13175
  this.fullscreen();
13001
13176
  });
13002
- (_c = this._infoModal) == null ? void 0 : _c.addEventListener("hide", () => {
13003
- this._infoModal.visible = false;
13004
- window.clearInterval(this._timer);
13005
- });
13006
13177
  panel.controller.addEventListener("information", () => __async(this, null, function* () {
13007
13178
  this.refreshInfoModal();
13008
13179
  }));
@@ -13012,7 +13183,7 @@ var PlayerPlugin = class extends Plugin {
13012
13183
  if (!isInit) {
13013
13184
  this._video.muted = !muted;
13014
13185
  muted = (_b2 = this._video.getVideoEl()) == null ? void 0 : _b2.muted;
13015
- this.video.volume = muted ? 0 : 1;
13186
+ this.setVolume(muted ? 0 : 1);
13016
13187
  }
13017
13188
  const button = panel.controller.VolumeButton;
13018
13189
  if (button) {
@@ -13024,27 +13195,26 @@ var PlayerPlugin = class extends Plugin {
13024
13195
  }
13025
13196
  };
13026
13197
  updateVolumeButton(true);
13027
- function DisplayVolumn(volume) {
13028
- const button = panel == null ? void 0 : panel.controller.VolumeButton;
13029
- if (panel && button) {
13030
- const volumeSlider2 = panel.controller.VolumeSlider;
13031
- if (volumeSlider2) {
13032
- volumeSlider2.percent = volume;
13033
- }
13034
- volume == 0 ? button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, { off: true }) : button.Children = /* @__PURE__ */ jsx_default.h(icons_default.Volume, null);
13035
- }
13036
- }
13037
13198
  panel.controller.addEventListener("volume", () => updateVolumeButton());
13038
13199
  const volumeSlider = panel.controller.VolumeSlider;
13039
13200
  if (volumeSlider) {
13040
13201
  volumeSlider.percent = this.video.volume;
13041
13202
  volumeSlider.addEventListener("change", (e) => {
13042
13203
  panel.controller.activeVolume();
13043
- this.video.volume = Number(e == null ? void 0 : e.percent);
13204
+ this.setVolume(Number(e == null ? void 0 : e.percent));
13044
13205
  volumeSlider.percent = this.video.volume;
13045
- DisplayVolumn(Number(e == null ? void 0 : e.percent));
13206
+ this.DisplayVolumn(Number(e == null ? void 0 : e.percent));
13046
13207
  });
13047
13208
  }
13209
+ this.mikeBtn = (_d = this.el) == null ? void 0 : _d.getElementsByTagName(
13210
+ "mike-button"
13211
+ )[0];
13212
+ (_e = this.mikeBtn) == null ? void 0 : _e.events.addEventListener("intercomStart", () => {
13213
+ this.dispatch("intercomStart");
13214
+ });
13215
+ (_f = this.mikeBtn) == null ? void 0 : _f.events.addEventListener("intercomStop", () => {
13216
+ this.dispatch("intercomStop");
13217
+ });
13048
13218
  }
13049
13219
  // 渲染准备视频对象等
13050
13220
  prepare() {
@@ -13176,6 +13346,20 @@ var PlayerPlugin = class extends Plugin {
13176
13346
  ), /* @__PURE__ */ jsx_default.h("div", { className: "player_info-modal_section_main", withNamespace: true }, VideoSection)));
13177
13347
  });
13178
13348
  }
13349
+ set statsInfosV1(val) {
13350
+ this._getStatsInfosV1 = val;
13351
+ }
13352
+ get statsInfosV1() {
13353
+ return () => {
13354
+ var _a;
13355
+ if (this._webrtcConnect) {
13356
+ const videoEle = this._video.getVideoEl();
13357
+ return this._webrtcConnect.getStatsInfosV1(videoEle);
13358
+ } else {
13359
+ return (_a = this._getStatsInfosV1) == null ? void 0 : _a.call(this);
13360
+ }
13361
+ };
13362
+ }
13179
13363
  refreshInfoModal() {
13180
13364
  return __async(this, null, function* () {
13181
13365
  window.clearInterval(this._timer);
@@ -15812,6 +15996,302 @@ function GetBvrtcIStatsInfosV1(mediaPlayer) {
15812
15996
  });
15813
15997
  }
15814
15998
 
15999
+ // src/components/subComponent/playState.ts
16000
+ init_define_processenv();
16001
+ init_jsx_shim();
16002
+ function CreateHandleDataUtils(data, init2) {
16003
+ const handle2 = new IDataHandle(data);
16004
+ const handleUtils = GetIDataHandleUtils(handle2);
16005
+ init2(handleUtils, handle2);
16006
+ const handleProxy = {
16007
+ Get() {
16008
+ return handle2.Get();
16009
+ },
16010
+ Set(data2) {
16011
+ return handle2.Set(data2);
16012
+ },
16013
+ addEventListener(callBack) {
16014
+ handle2.addEventListener(callBack);
16015
+ },
16016
+ removeEventListener(callBack) {
16017
+ handle2.removeEventListener(callBack);
16018
+ }
16019
+ };
16020
+ return [handleProxy, handle2];
16021
+ }
16022
+ function GetHandleDataAction(handle2, data) {
16023
+ const addEventListener = (callback) => {
16024
+ handle2.addEventListener(callback);
16025
+ return () => {
16026
+ handle2.removeEventListener(callback);
16027
+ };
16028
+ };
16029
+ const removeEventListener = (callback) => {
16030
+ handle2.removeEventListener(callback);
16031
+ };
16032
+ return [
16033
+ {
16034
+ exec() {
16035
+ handle2.Set(data);
16036
+ },
16037
+ addEventListener,
16038
+ removeEventListener
16039
+ },
16040
+ handle2
16041
+ ];
16042
+ }
16043
+ function storeOriIVisibleBase(ele, onShow2, onHide2) {
16044
+ var _a, _b;
16045
+ const oriOnHide = (_a = ele.onHide) == null ? void 0 : _a.bind(ele);
16046
+ const oriOnShow = (_b = ele.onShow) == null ? void 0 : _b.bind(ele);
16047
+ ele.onHide = () => {
16048
+ onHide2 == null ? void 0 : onHide2();
16049
+ oriOnHide == null ? void 0 : oriOnHide();
16050
+ };
16051
+ ele.onShow = () => {
16052
+ onShow2 == null ? void 0 : onShow2();
16053
+ oriOnShow == null ? void 0 : oriOnShow();
16054
+ };
16055
+ return () => {
16056
+ ele.onHide = oriOnHide;
16057
+ ele.onShow = oriOnShow;
16058
+ };
16059
+ }
16060
+ function CreatePlayerState(player) {
16061
+ const state = {
16062
+ fullscreen: CreateHandleDataUtils(false, (handleUtils) => {
16063
+ handleUtils.setParams({
16064
+ handle() {
16065
+ player.fullscreen();
16066
+ },
16067
+ init() {
16068
+ player.addEventListener("fullscreen", (bFullScreen) => {
16069
+ handleUtils.dispatch(!!bFullScreen);
16070
+ });
16071
+ }
16072
+ });
16073
+ }),
16074
+ volume: CreateHandleDataUtils(player.video.volume, (handleUtils) => {
16075
+ handleUtils.setParams({
16076
+ handle(volume) {
16077
+ player.setVolume(volume);
16078
+ },
16079
+ init() {
16080
+ return player.addEventListener("volumeChange", (percent) => {
16081
+ handleUtils.dispatch(percent == null ? void 0 : percent.percent);
16082
+ });
16083
+ }
16084
+ });
16085
+ }),
16086
+ information: CreateHandleDataUtils(false, (handleUtils) => {
16087
+ handleUtils.setParams({
16088
+ handle(bVisiable) {
16089
+ if (bVisiable != player.infoModal.visible) {
16090
+ if (bVisiable) {
16091
+ player.refreshInfoModal();
16092
+ } else {
16093
+ player.infoModal.visible = false;
16094
+ }
16095
+ }
16096
+ },
16097
+ init() {
16098
+ return storeOriIVisibleBase(
16099
+ player.infoModal,
16100
+ () => {
16101
+ handleUtils.dispatch(true);
16102
+ },
16103
+ () => {
16104
+ handleUtils.dispatch(false);
16105
+ }
16106
+ );
16107
+ }
16108
+ });
16109
+ }),
16110
+ record: CreateHandleDataUtils(
16111
+ { type: "recordStop" },
16112
+ (handleUtils) => {
16113
+ handleUtils.setParams({
16114
+ handle({ type }) {
16115
+ if (type == "recordStart") {
16116
+ player.recordStart();
16117
+ } else {
16118
+ player.recordStop();
16119
+ }
16120
+ },
16121
+ init() {
16122
+ return [
16123
+ player.addEventListener("recordStart", () => {
16124
+ handleUtils.dispatch({ type: "recordStart" });
16125
+ }),
16126
+ player.addEventListener("recordStop", () => {
16127
+ handleUtils.dispatch({ type: "recordStop" });
16128
+ })
16129
+ ];
16130
+ }
16131
+ });
16132
+ }
16133
+ ),
16134
+ rotate: CreateHandleDataUtils(
16135
+ { type: "Rotate0" },
16136
+ (handleUtils) => {
16137
+ handleUtils.setParams({
16138
+ handle(data) {
16139
+ if (data.type == "Rotate0") {
16140
+ player.video.rotate(0);
16141
+ } else if (data.type == "Rotate90") {
16142
+ player.video.rotate(90);
16143
+ } else if (data.type == "Rotate180") {
16144
+ player.video.rotate(180);
16145
+ } else if (data.type == "Rotate270") {
16146
+ player.video.rotate(270);
16147
+ } else {
16148
+ return;
16149
+ }
16150
+ handleUtils.dispatch(data);
16151
+ },
16152
+ init() {
16153
+ return player.addEventListener("rotate", (params) => {
16154
+ console.log(params == null ? void 0 : params.rotateDeg);
16155
+ switch (params == null ? void 0 : params.rotateDeg) {
16156
+ case 0:
16157
+ handleUtils.dispatch({ type: "Rotate0" });
16158
+ break;
16159
+ case 90:
16160
+ handleUtils.dispatch({ type: "Rotate90" });
16161
+ break;
16162
+ case 180:
16163
+ handleUtils.dispatch({ type: "Rotate180" });
16164
+ break;
16165
+ case 270:
16166
+ handleUtils.dispatch({ type: "Rotate270" });
16167
+ break;
16168
+ }
16169
+ });
16170
+ }
16171
+ });
16172
+ }
16173
+ ),
16174
+ ptzControl: CreateHandleDataUtils({}, (handleUtils) => {
16175
+ handleUtils.setParams({
16176
+ handle(data) {
16177
+ if (player.ptz.visible != data.show) {
16178
+ player.togglePtz();
16179
+ }
16180
+ },
16181
+ init() {
16182
+ const ptz = player.ptz;
16183
+ return storeOriIVisibleBase(
16184
+ ptz,
16185
+ () => handleUtils.dispatch({ show: true }),
16186
+ () => handleUtils.dispatch({ show: false })
16187
+ );
16188
+ }
16189
+ });
16190
+ }),
16191
+ mike: CreateHandleDataUtils({}, (handleUtils) => {
16192
+ handleUtils.setParams({
16193
+ handle(data) {
16194
+ if (data.talking) {
16195
+ player.startIntercom();
16196
+ } else {
16197
+ player.stopIntercom();
16198
+ }
16199
+ },
16200
+ init() {
16201
+ player.addEventListener("intercomStart", () => {
16202
+ handleUtils.dispatch({ talking: true });
16203
+ });
16204
+ player.addEventListener("intercomStop", () => {
16205
+ handleUtils.dispatch({ talking: false });
16206
+ });
16207
+ }
16208
+ });
16209
+ }),
16210
+ screenshot: GetHandleDataAction(
16211
+ CreateHandleDataUtils(
16212
+ {},
16213
+ (handleUtils) => {
16214
+ handleUtils.setParams({
16215
+ handle() {
16216
+ player.screenShot();
16217
+ },
16218
+ init() {
16219
+ return player.addEventListener("screenshot", (data) => {
16220
+ handleUtils.dispatch({
16221
+ img: data == null ? void 0 : data.img,
16222
+ cancelAutoDownload: data == null ? void 0 : data.cancelAutoDownload
16223
+ });
16224
+ data == null ? void 0 : data.cancelAutoDownload();
16225
+ });
16226
+ }
16227
+ });
16228
+ }
16229
+ )[1],
16230
+ {}
16231
+ ),
16232
+ informationGet: () => {
16233
+ var _a;
16234
+ return (_a = player.statsInfosV1) == null ? void 0 : _a.call(player);
16235
+ }
16236
+ };
16237
+ player.addEventListener("init", () => {
16238
+ Object.keys(state).forEach((key) => {
16239
+ var _a, _b;
16240
+ const stateCurrents = state[key];
16241
+ if (stateCurrents instanceof Array) {
16242
+ const stateCurrent = stateCurrents[1];
16243
+ if (stateCurrent) {
16244
+ (_b = (_a = GetIDataHandleUtils(stateCurrent)).doInit) == null ? void 0 : _b.call(_a);
16245
+ }
16246
+ }
16247
+ });
16248
+ });
16249
+ player.addEventListener("destroy", () => {
16250
+ Object.keys(state).forEach((key) => {
16251
+ const stateCurrents = state[key];
16252
+ if (stateCurrents instanceof Array) {
16253
+ const stateCurrent = stateCurrents[1];
16254
+ if (stateCurrent) {
16255
+ const destorys = GetIDataHandleUtils(
16256
+ stateCurrent
16257
+ ).destory;
16258
+ if (destorys instanceof Array) {
16259
+ destorys.forEach((item) => item());
16260
+ } else if (destorys) {
16261
+ destorys();
16262
+ }
16263
+ }
16264
+ }
16265
+ });
16266
+ });
16267
+ function Test() {
16268
+ window.temp1 = instanceState;
16269
+ setTimeout(() => __async(this, null, function* () {
16270
+ instanceState.ptzControl.addEventListener((data) => {
16271
+ console.log(data);
16272
+ });
16273
+ instanceState.ptzControl.Set({ show: true });
16274
+ instanceState.information.Set(true);
16275
+ instanceState.volume.addEventListener(() => {
16276
+ console.log("fuck");
16277
+ });
16278
+ setInterval(() => __async(this, null, function* () {
16279
+ console.log(yield instanceState.informationGet());
16280
+ }), 2e3);
16281
+ }), 2e3);
16282
+ }
16283
+ const instanceState = {};
16284
+ Object.keys(state).forEach((key) => {
16285
+ const temp = state[key];
16286
+ if (temp instanceof Array) {
16287
+ instanceState[key] = temp[0];
16288
+ } else {
16289
+ instanceState[key] = temp;
16290
+ }
16291
+ });
16292
+ return instanceState;
16293
+ }
16294
+
15815
16295
  // src/components/puPlayer.tsx
15816
16296
  var createProductRemoteSdp = (puOption, tempToken, callBack, signal) => (localDescription) => __async(void 0, null, function* () {
15817
16297
  if (localDescription.type !== "offer")
@@ -16091,14 +16571,10 @@ var PuPlayer = (props) => {
16091
16571
  width: videoWidth
16092
16572
  });
16093
16573
  });
16094
- player.addEventListener("fullscreen", (bFullScreen) => {
16095
- fullscreenStatus.dispatch(!!bFullScreen);
16096
- });
16097
- const fullscreenStatus = new IDataHandle(false, () => {
16098
- player.fullscreen();
16099
- });
16100
16574
  player.mute(currentMuted);
16101
16575
  tempPuOption && token && player.ptz.setPuParam(tempPuOption, token);
16576
+ const playState = CreatePlayerState(player);
16577
+ const fullscreenStatus = playState.fullscreen;
16102
16578
  const playerEl = player.init();
16103
16579
  (_a = player.panel) == null ? void 0 : _a.controller.addEventListener("volume", () => {
16104
16580
  currentMuted = !currentMuted;
@@ -16173,6 +16649,8 @@ var PuPlayer = (props) => {
16173
16649
  if (player.mikeBtn) {
16174
16650
  player.mikeBtn.intercom = intercom == null ? void 0 : intercom.instance;
16175
16651
  player.mikeBtn.type = this.protocol;
16652
+ } else {
16653
+ player.intercomUtils = CreateIntercomUtils(intercom == null ? void 0 : intercom.instance, this.protocol);
16176
16654
  }
16177
16655
  } catch (e) {
16178
16656
  if (protocol == "webrtc") {
@@ -16259,6 +16737,9 @@ var PuPlayer = (props) => {
16259
16737
  } catch (e2) {
16260
16738
  throw t("da-kai-shi-bai");
16261
16739
  }
16740
+ player.statsInfosV1 = () => {
16741
+ return GetBvrtcIStatsInfosV1(hplayer);
16742
+ };
16262
16743
  const removeRefresh = player.addEventListener(
16263
16744
  "refreshInfoModal",
16264
16745
  (e2) => __async(this, null, function* () {
@@ -16355,6 +16836,10 @@ var PuPlayer = (props) => {
16355
16836
  volumeSlider.percent = hplayer.getVolume();
16356
16837
  DisplayVolumn2(Number(e2 == null ? void 0 : e2.percent));
16357
16838
  });
16839
+ } else {
16840
+ player.addEventListener("volumeChange", (params) => {
16841
+ hplayer.setVolume(params == null ? void 0 : params.percent);
16842
+ });
16358
16843
  }
16359
16844
  if (player.mikeBtn) {
16360
16845
  player.mikeBtn.intercom = intercom == null ? void 0 : intercom.instance;
@@ -16468,9 +16953,7 @@ var PuPlayer = (props) => {
16468
16953
  }),
16469
16954
  protocol: type,
16470
16955
  videoFit,
16471
- playerStatus: {
16472
- fullscreen: fullscreenStatus
16473
- }
16956
+ playerStatus: playState
16474
16957
  };
16475
16958
  const result = {
16476
16959
  instance: instance2,
@@ -16722,6 +17205,9 @@ var PlaybackBar = class extends Plugin {
16722
17205
  if (this.controls.currentTime == this.playbackInfo.current) {
16723
17206
  return;
16724
17207
  }
17208
+ if (this.playbackInfo.current > this.playbackInfo.total) {
17209
+ this.playbackInfo.current = this.playbackInfo.total;
17210
+ }
16725
17211
  this.controls.currentTime = this.playbackInfo.current;
16726
17212
  const iTotal = this.playbackInfo.total;
16727
17213
  const iCurrent = this.playbackInfo.current > iTotal ? iTotal : this.playbackInfo.current;
@@ -17192,7 +17678,7 @@ var PlayBack = (props) => {
17192
17678
  i18n_default(locale);
17193
17679
  let hplayer = void 0;
17194
17680
  const handle2 = {};
17195
- let type = (puOption == null ? void 0 : puOption.puId) && type1 == "ws-bvrtc" ? "web" : type1;
17681
+ let type = (puOption == null ? void 0 : puOption.puId) && type1 == "ws-bvrtc" ? type1 : type1;
17196
17682
  const instance2 = {
17197
17683
  videoFit: "contain",
17198
17684
  open() {
@@ -17305,6 +17791,7 @@ var PlayBack = (props) => {
17305
17791
  }
17306
17792
  };
17307
17793
  handle2.close = () => {
17794
+ videoEle.src = "";
17308
17795
  markerHandle.destroy();
17309
17796
  player.close();
17310
17797
  barHandle.destroy();
@@ -17385,7 +17872,7 @@ var PlayBack = (props) => {
17385
17872
  jumpHandle = (data) => __async(this, null, function* () {
17386
17873
  if (data && playbackInfo.data) {
17387
17874
  yield hplayer == null ? void 0 : hplayer.playbackStop();
17388
- const seekInfo = yield playbackController.seek({ range: [data == null ? void 0 : data.targetSeconds, playbackInfo.data.range[1]] });
17875
+ yield playbackController.seek({ range: [Number(data == null ? void 0 : data.targetSeconds.toFixed(4)), playbackInfo.data.range[1]] });
17389
17876
  yield hplayer == null ? void 0 : hplayer.playbackStart();
17390
17877
  barHandle.pausePlayStateChange("play");
17391
17878
  }
@@ -17477,7 +17964,7 @@ var PlayBack = (props) => {
17477
17964
  },
17478
17965
  setProtocol: function(protocol) {
17479
17966
  this.close();
17480
- this.protocol = (puOption == null ? void 0 : puOption.puId) ? "web" : protocol;
17967
+ this.protocol = (puOption == null ? void 0 : puOption.puId) ? protocol : protocol;
17481
17968
  this.open();
17482
17969
  },
17483
17970
  protocol: "web"
@@ -1,5 +1,12 @@
1
1
  import { IIntercomInstance } from "../../components/intercom";
2
2
  import { IToast } from "src/plugins/toast";
3
+ import { Events } from "../../core/events";
4
+ export declare function CreateIntercomUtils(intercomIns: IIntercomInstance, type: "auto" | "webrtc" | "ws-bvrtc"): {
5
+ isBusy: boolean;
6
+ talking: boolean;
7
+ open(toast: IToast): Promise<void>;
8
+ close(): Promise<void>;
9
+ };
3
10
  export declare class MikeButton extends HTMLElement {
4
11
  #private;
5
12
  inject?: {
@@ -7,6 +14,10 @@ export declare class MikeButton extends HTMLElement {
7
14
  };
8
15
  constructor();
9
16
  get talking(): boolean;
17
+ events: Events<{
18
+ intercomStart: undefined;
19
+ intercomStop: undefined;
20
+ }>;
10
21
  set talking(state: boolean);
11
22
  set intercom(ins: IIntercomInstance | undefined);
12
23
  set type(type: "auto" | "webrtc" | "ws-bvrtc" | undefined);
@@ -0,0 +1,37 @@
1
+ import PlayerPlugin from "../../plugins/player";
2
+ import { IDataHandle } from "src/core/events";
3
+ type EnumRotate = "Rotate0" | "Rotate90" | "Rotate180" | "Rotate270";
4
+ export type IPlayerState = ReturnType<typeof CreatePlayerState>;
5
+ export declare function CreatePlayerState(player: PlayerPlugin): {
6
+ fullscreen: IDataHandle<boolean>;
7
+ volume: IDataHandle<number>;
8
+ information: IDataHandle<boolean>;
9
+ record: IDataHandle<{
10
+ type: "recordStart" | "recordStop";
11
+ }>;
12
+ rotate: IDataHandle<{
13
+ type: EnumRotate;
14
+ }>;
15
+ ptzControl: IDataHandle<{
16
+ show?: boolean | undefined;
17
+ }>;
18
+ mike: IDataHandle<{
19
+ talking?: boolean | undefined;
20
+ }>;
21
+ screenshot: IDataHandle<{
22
+ img?: Blob | undefined;
23
+ cancelAutoDownload?: (() => void) | undefined;
24
+ }> | {
25
+ exec(): void;
26
+ addEventListener: (handle: (data: {
27
+ img?: Blob | undefined;
28
+ cancelAutoDownload?: (() => void) | undefined;
29
+ }) => void) => () => void;
30
+ removeEventListener: (handle: (data: {
31
+ img?: Blob | undefined;
32
+ cancelAutoDownload?: (() => void) | undefined;
33
+ }) => void) => void;
34
+ };
35
+ informationGet: () => Promise<import("../../plugins/player/reducers/types").IStatsInfosV1> | undefined;
36
+ };
37
+ export {};
@@ -17,16 +17,33 @@ export interface IEvent {
17
17
  }
18
18
  export interface IEventMap {
19
19
  }
20
+ export interface IDataHandleUtils<T> {
21
+ dispatch(data: T): void;
22
+ setParams(params: {
23
+ handle: (data: T) => void;
24
+ init?: () => void | (() => void) | Array<() => void>;
25
+ }): void;
26
+ doInit(): void;
27
+ destory?: void | (() => void) | Array<() => void>;
28
+ }
29
+ export declare function GetIDataHandleUtils<T>(handle: IDataHandle<T>): IDataHandleUtils<T>;
20
30
  export declare class IDataHandle<T> {
21
31
  private _data;
22
- private handle;
23
- constructor(data: T, handle: (data: T) => void);
32
+ private handle?;
33
+ protected destory?: void | (() => void);
34
+ protected init?: () => void;
35
+ protected doInit(): void;
36
+ constructor(data: T);
37
+ protected setParams({ handle, init, }: {
38
+ handle: (data: T) => void;
39
+ init?: () => void | (() => void);
40
+ }): void;
24
41
  Get(): T;
25
42
  Set(data: T): void;
26
43
  private szHandle;
27
- addEventListener(handle: (data: T) => void): void;
44
+ addEventListener(handle: (data: T) => void): () => void;
28
45
  removeEventListener(handle: (data: T) => void): void;
29
- dispatch(data: T): void;
46
+ protected dispatch(data: T): void;
30
47
  }
31
48
  export declare class Events<M extends IEventMap> {
32
49
  protected _notifier: INotifier<any, any>;
@@ -23,8 +23,16 @@ export interface IPlayerPluginEventMap extends IPluginEventMap {
23
23
  contextmenu: Event;
24
24
  recordStart: undefined;
25
25
  recordStop: undefined;
26
- screenshot: undefined;
26
+ screenshot: undefined | {
27
+ img: Blob;
28
+ cancelAutoDownload: () => void;
29
+ };
27
30
  fullscreen: boolean;
28
31
  rotate: IRotateEvent;
32
+ volumeChange: {
33
+ percent: number;
34
+ };
35
+ intercomStart: undefined;
36
+ intercomStop: undefined;
29
37
  }
30
38
  export {};
@@ -5,10 +5,11 @@ import { IControlPluginMap } from "../controller";
5
5
  import MaskPlugin from "../mask";
6
6
  import SpinnerPlugin from "../spinner";
7
7
  import VideoPlugin from "../video";
8
+ import ModalPlugin from "../modal";
8
9
  import PlayerPanel from "./panel";
9
10
  import { IPlayerPluginEventMap } from "./event";
10
11
  import PtzPlugin from "../ptz";
11
- import { MikeButton } from "src/components/subComponent/mikeButton";
12
+ import { CreateIntercomUtils, MikeButton } from "src/components/subComponent/mikeButton";
12
13
  import { IPuOption } from "src/main";
13
14
  export declare enum PLAYER_MODES {
14
15
  DIRECT = "direct",
@@ -76,7 +77,7 @@ declare class PlayerPlugin extends Plugin<HTMLDivElement, IPlayerPluginEventMap>
76
77
  get video(): VideoPlugin;
77
78
  get spinner(): SpinnerPlugin;
78
79
  get mask(): MaskPlugin;
79
- private get infoModal();
80
+ get infoModal(): ModalPlugin;
80
81
  get panel(): PlayerPanel | undefined;
81
82
  play(muted?: boolean): Promise<void>;
82
83
  pause(): void;
@@ -86,12 +87,23 @@ declare class PlayerPlugin extends Plugin<HTMLDivElement, IPlayerPluginEventMap>
86
87
  close(): Promise<void>;
87
88
  protected beforeDestroy(): void;
88
89
  private loadPlayerConfig;
90
+ intercomUtils?: ReturnType<typeof CreateIntercomUtils>;
91
+ startIntercom(): Promise<void>;
92
+ stopIntercom(): void;
93
+ screenShot(): Promise<void>;
94
+ setVolume(percent: number): void;
95
+ private DisplayVolumn;
96
+ recordStart(): void;
97
+ recordStop(): void;
89
98
  private initEvents;
90
99
  private prepare;
91
100
  private prepareDirect;
92
101
  private closeWebrtc;
93
102
  showMediaStaticInfo({ audio, video, meta }: IStatsInfosV1): Promise<void>;
94
- private refreshInfoModal;
103
+ private _getStatsInfosV1?;
104
+ set statsInfosV1(val: (() => Promise<IStatsInfosV1>) | undefined);
105
+ get statsInfosV1(): (() => Promise<IStatsInfosV1>) | undefined;
106
+ refreshInfoModal(): Promise<void>;
95
107
  togglePtz(): Promise<void>;
96
108
  enableCanvas(enable: boolean, captureStream?: () => MediaStream): void;
97
109
  replaceCanvas(canvas: HTMLCanvasElement): void;
@@ -15,6 +15,7 @@ declare class SliderPlugin extends Plugin<HTMLDivElement, ISliderPluginEventMap>
15
15
  constructor(className?: string);
16
16
  set percent(v: number);
17
17
  get percent(): number;
18
+ setVolume(percent: number): void;
18
19
  protected beforeDestroy(): void;
19
20
  init(_container?: RenderTarget): RenderTarget;
20
21
  }
@@ -46,7 +46,10 @@ declare class VideoPlugin extends Plugin<HTMLDivElement, IVideoPluginEventMap> {
46
46
  setCaptureProvider(capture?: () => MediaStream): void;
47
47
  play(): Promise<void>;
48
48
  pause(): void;
49
- screenshot(): void;
49
+ screenshot(): Promise<{
50
+ blob: Blob | null;
51
+ download(): void;
52
+ } | undefined>;
50
53
  private _genFileName;
51
54
  recordStart(): void;
52
55
  recordStop(): void;
@@ -33,8 +33,14 @@ declare global {
33
33
  declare function webcodecVisiableChangeResumePlay(videoEle: HTMLVideoElement): void;
34
34
  declare const media: {
35
35
  canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob | null>;
36
- screenshotByCanvas: (canvas?: HTMLCanvasElement | null, fileName?: string) => Promise<void>;
37
- screenshot: (videoEl?: HTMLVideoElement | null, fileName?: string) => Promise<void>;
36
+ screenshotByCanvas: (canvas?: HTMLCanvasElement | null, fileName?: string) => Promise<{
37
+ blob: Blob | null;
38
+ download(): void;
39
+ } | undefined>;
40
+ screenshot: (videoEl?: HTMLVideoElement | null, fileName?: string) => Promise<{
41
+ blob: Blob | null;
42
+ download(): void;
43
+ } | undefined>;
38
44
  record: (element: IStreamProvider, stream?: MediaStream | null, fileName?: string) => [MediaRecorder?, MediaStream?];
39
45
  getMediaDir: (option: IMediaOption) => number;
40
46
  video2Canvas: (video: HTMLVideoElement, opts: IVideo2CanvasOptions) => ICanvasControl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.76",
3
+ "version": "0.8.78",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",