@besovideo/webrtc-player 0.8.73 → 0.8.75

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
@@ -127,6 +127,21 @@ instance.getPlayerElement();
127
127
  // 获取内部引用的video元素
128
128
  instance.getVideoElement();
129
129
 
130
+ //播放器状态
131
+ instance.playerStatus : {
132
+ // 全屏状态管理
133
+ fullscreen: {
134
+ // 获取全屏状态
135
+ Get(): boolean,
136
+ // 设置全屏状态
137
+ Set(boolean): void;
138
+ // 添加事件监听
139
+ addEventListener(handle: ((bFullscreen: boolean) => void)):void;
140
+ // 移除事件监听
141
+ removeEventListener(handle: ((bFullscreen: boolean) => void)):void;
142
+ }
143
+ }
144
+
130
145
  // clearAllDialog 异步 释放全部打开的dialog 不管是音视频还是对讲
131
146
  clearAllDialog();
132
147
  ```
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.73", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.75", PROJECT_NAMESPACE: "bvplayer" };
115
115
  }
116
116
  });
117
117
 
@@ -4956,6 +4956,22 @@ CustomError.ErrorStatus = {
4956
4956
  RECORD_INFO_FAILURE: 5001
4957
4957
  };
4958
4958
 
4959
+ // src/components/global.config.ts
4960
+ init_define_processenv();
4961
+ init_jsx_shim();
4962
+ var glbConfig = {};
4963
+ var globalConfigHandler = {
4964
+ getDefaultProps: function() {
4965
+ return glbConfig;
4966
+ },
4967
+ setDefaultProps: function(props) {
4968
+ Object.keys(props).forEach((itemKey) => {
4969
+ const key = itemKey;
4970
+ glbConfig[key] = props[key];
4971
+ });
4972
+ }
4973
+ };
4974
+
4959
4975
  // src/api/dialog.ts
4960
4976
  var OpenDialogError = class extends CustomError {
4961
4977
  constructor(message) {
@@ -4970,7 +4986,7 @@ function AppendHost(data, bRemove) {
4970
4986
  const hostAppend = {
4971
4987
  host: apiUrls.bvscpV1().includes("://") ? new URL(apiUrls.bvscpV1()).host : new URL(apiUrls.bvscpV1(), location.origin).host
4972
4988
  };
4973
- return __spreadValues(__spreadValues({}, data), bRemove ? {} : hostAppend);
4989
+ return __spreadValues(__spreadValues({}, data), bRemove || globalConfigHandler.getDefaultProps().bNotSendHost ? {} : hostAppend);
4974
4990
  }
4975
4991
  var DialogIdsKey = core_default.field.createPrefixStorageField("DialogIds");
4976
4992
  var getDeviceWebrtc = (param, token, signal) => __async(void 0, null, function* () {
@@ -5038,10 +5054,13 @@ var getPlaybackBvrtc = (param, token, signal) => __async(void 0, null, function*
5038
5054
  const headers = {
5039
5055
  Authorization: token || ""
5040
5056
  };
5041
- const params = AppendHost(__spreadValues({
5042
- index: param.index,
5043
- sdp: param.sdp
5044
- }, param.id ? { id: param.id } : {}));
5057
+ const params = AppendHost(
5058
+ __spreadValues({
5059
+ index: param.index,
5060
+ sdp: param.sdp
5061
+ }, param.id ? { id: param.id } : {}),
5062
+ globalConfigHandler.getDefaultProps().bNotSendHost
5063
+ );
5045
5064
  const resData = yield http_default.post(
5046
5065
  `${apiUrls.bvscpV1()}/dialog/playback`,
5047
5066
  params,
@@ -5298,6 +5317,40 @@ var Notifier = class {
5298
5317
  this._map.set(name, []);
5299
5318
  }
5300
5319
  };
5320
+ var IDataHandle = class {
5321
+ constructor(data, handle2) {
5322
+ this.szHandle = [];
5323
+ this._data = data;
5324
+ this.handle = handle2;
5325
+ }
5326
+ Get() {
5327
+ return this._data;
5328
+ }
5329
+ Set(data) {
5330
+ if (this._data != data) {
5331
+ this._data = data;
5332
+ this.handle(this._data);
5333
+ this.szHandle.forEach((handler) => handler(this._data));
5334
+ }
5335
+ }
5336
+ addEventListener(handle2) {
5337
+ if (this.szHandle.findIndex((item) => item == handle2)) {
5338
+ this.szHandle.push(handle2);
5339
+ }
5340
+ }
5341
+ removeEventListener(handle2) {
5342
+ const targetIndex = this.szHandle.findIndex((item) => item == handle2);
5343
+ if (targetIndex >= 0) {
5344
+ this.szHandle.splice(targetIndex, 1);
5345
+ }
5346
+ }
5347
+ dispatch(data) {
5348
+ if (this._data != data) {
5349
+ this._data = data;
5350
+ this.szHandle.forEach((handler) => handler(this._data));
5351
+ }
5352
+ }
5353
+ };
5301
5354
  var Events = class {
5302
5355
  constructor() {
5303
5356
  this._notifier = new Notifier();
@@ -9044,7 +9097,8 @@ function watch(el, callback) {
9044
9097
  }
9045
9098
  var fullscreen = {
9046
9099
  toggle,
9047
- watch
9100
+ watch,
9101
+ isFull
9048
9102
  };
9049
9103
  var fullscreen_default = fullscreen;
9050
9104
 
@@ -12933,7 +12987,8 @@ var PlayerPlugin = class extends Plugin {
12933
12987
  this.ptz.visible = false;
12934
12988
  });
12935
12989
  panel.controller.addEventListener("fullscreen", () => {
12936
- this.dispatch("fullscreen");
12990
+ const currenFullScreen = !(this.el ? fullscreen_default.isFull(this.el) : false);
12991
+ this.dispatch("fullscreen", currenFullScreen);
12937
12992
  this.fullscreen();
12938
12993
  });
12939
12994
  (_c = this._infoModal) == null ? void 0 : _c.addEventListener("hide", () => {
@@ -13187,7 +13242,16 @@ var PlayerPlugin = class extends Plugin {
13187
13242
  logger_default.libError("playerPlugin fullscreen playerEL\u4E3A\u7A7A\u503C");
13188
13243
  return;
13189
13244
  }
13190
- fullscreen_default.toggle(this.el);
13245
+ const currenFullScreen = !(this.el ? fullscreen_default.isFull(this.el) : false);
13246
+ if (currenFullScreen) {
13247
+ const watchHandle = fullscreen_default.watch(this.el, (isFull2) => {
13248
+ this.dispatch("fullscreen", isFull2);
13249
+ if (!isFull2) {
13250
+ watchHandle.cancel();
13251
+ }
13252
+ });
13253
+ }
13254
+ fullscreen_default.toggle(this.el, { navigationUI: "hide" });
13191
13255
  }
13192
13256
  };
13193
13257
  var player_default = PlayerPlugin;
@@ -13760,8 +13824,10 @@ var BVMedia = class {
13760
13824
  if (typeof this._ptsVideoLast == "undefined") {
13761
13825
  this._ptsVideoLast = 0;
13762
13826
  }
13763
- this.webcodecPlayer.decodeVideo(packet.data, packet.pts, packet.flags !== 0 ? true : false);
13764
- this._ptsVideoLast += 4e4;
13827
+ if (this.webcodecPlayer) {
13828
+ this.webcodecPlayer.decodeVideo(packet.data, packet.pts, packet.flags !== 0 ? true : false);
13829
+ this._ptsVideoLast += 4e4;
13830
+ }
13765
13831
  }
13766
13832
  _OnVideoData(frame) {
13767
13833
  if (this.videoPlayer) {
@@ -16017,6 +16083,12 @@ var PuPlayer = (props) => {
16017
16083
  width: videoWidth
16018
16084
  });
16019
16085
  });
16086
+ player.addEventListener("fullscreen", (bFullScreen) => {
16087
+ fullscreenStatus.dispatch(!!bFullScreen);
16088
+ });
16089
+ const fullscreenStatus = new IDataHandle(false, () => {
16090
+ player.fullscreen();
16091
+ });
16020
16092
  player.mute(currentMuted);
16021
16093
  tempPuOption && token && player.ptz.setPuParam(tempPuOption, token);
16022
16094
  const playerEl = player.init();
@@ -16025,7 +16097,7 @@ var PuPlayer = (props) => {
16025
16097
  });
16026
16098
  if (fullScreenOnDblclick) {
16027
16099
  (_b = player.video.getEl()) == null ? void 0 : _b.addEventListener("dblclick", () => {
16028
- player.fullscreen();
16100
+ fullscreenStatus.Set(!fullscreenStatus.Get());
16029
16101
  });
16030
16102
  }
16031
16103
  const handleClose = () => __async(void 0, null, function* () {
@@ -16179,6 +16251,15 @@ var PuPlayer = (props) => {
16179
16251
  } catch (e2) {
16180
16252
  throw t("da-kai-shi-bai");
16181
16253
  }
16254
+ const removeRefresh = player.addEventListener(
16255
+ "refreshInfoModal",
16256
+ (e2) => __async(this, null, function* () {
16257
+ if (!e2 || !hplayer)
16258
+ return;
16259
+ const staticInfo = yield GetBvrtcIStatsInfosV1(hplayer);
16260
+ e2.target.showMediaStaticInfo(staticInfo);
16261
+ })
16262
+ );
16182
16263
  hplayer.onevent = function(bCloseEvent, iResult) {
16183
16264
  logger_default.info(
16184
16265
  "bvmedia event: bClose ",
@@ -16229,15 +16310,6 @@ var PuPlayer = (props) => {
16229
16310
  dialog_default.closeDialogs([dialogId || ""], tempToken || "");
16230
16311
  if (!(player == null ? void 0 : player.panel))
16231
16312
  return;
16232
- const removeRefresh = player.addEventListener(
16233
- "refreshInfoModal",
16234
- (e2) => __async(this, null, function* () {
16235
- if (!e2 || !hplayer)
16236
- return;
16237
- const staticInfo = yield GetBvrtcIStatsInfosV1(hplayer);
16238
- e2.target.showMediaStaticInfo(staticInfo);
16239
- })
16240
- );
16241
16313
  const updateVolumeButton = (isInit = false) => {
16242
16314
  var _a3;
16243
16315
  const button = (_a3 = player.panel) == null ? void 0 : _a3.controller.VolumeButton;
@@ -16387,7 +16459,10 @@ var PuPlayer = (props) => {
16387
16459
  ctxMenuMgr == null ? void 0 : ctxMenuMgr();
16388
16460
  }),
16389
16461
  protocol: type,
16390
- videoFit
16462
+ videoFit,
16463
+ playerStatus: {
16464
+ fullscreen: fullscreenStatus
16465
+ }
16391
16466
  };
16392
16467
  const result = {
16393
16468
  instance: instance2,
@@ -16480,6 +16555,14 @@ init_define_processenv();
16480
16555
  init_jsx_shim();
16481
16556
  init_jsx();
16482
16557
  var PLUGIN_NAME_PLAYBAR = "playbar";
16558
+ function CreateLoadingSvg() {
16559
+ const svgLoading = document.createElement("div");
16560
+ svgLoading.style.position = "absolute";
16561
+ svgLoading.style.top = "calc(50% - 48px)";
16562
+ svgLoading.style.left = "calc(50% - 48px)";
16563
+ svgLoading.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><g fill="none" stroke="black" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity="0.3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>`;
16564
+ return svgLoading;
16565
+ }
16483
16566
  var PlaybackBar = class extends Plugin {
16484
16567
  constructor() {
16485
16568
  super(PLUGIN_NAME_PLAYBAR, "div", core_default.style.cls("blaybackbar"));
@@ -16490,6 +16573,7 @@ var PlaybackBar = class extends Plugin {
16490
16573
  this.isShowControls = true;
16491
16574
  this.svgPause = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24" }, /* @__PURE__ */ jsx_default.h("path", { fill: "currentColor", d: "M6 5h2v14H6zm10 0h2v14h-2z" })));
16492
16575
  this.svgPlay = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 32 32" }, /* @__PURE__ */ jsx_default.h("path", { fill: "white", d: "M6.684 25.682L24.316 15.5L6.684 5.318z" })));
16576
+ this.svgLoading = CreateLoadingSvg();
16493
16577
  this.volumeCurrent = 100;
16494
16578
  this.svgSoundZero = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", onclick: () => {
16495
16579
  this.onSooundClick();
@@ -16578,9 +16662,31 @@ var PlaybackBar = class extends Plugin {
16578
16662
  const srcEle = evet.target;
16579
16663
  if (srcEle) {
16580
16664
  const jumpTarget = evet.offsetX / srcEle.clientWidth * this.playbackInfo.total;
16581
- this.dispatch("jump", { timeTarget: jumpTarget });
16665
+ this.jumpToTargetSeconds({
16666
+ targetSeconds: jumpTarget
16667
+ });
16668
+ }
16669
+ }
16670
+ showLoading(isShow) {
16671
+ var _a;
16672
+ if (isShow) {
16673
+ core_default.dom.append(this._container, this.svgLoading);
16674
+ } else {
16675
+ if ((_a = this.svgLoading) == null ? void 0 : _a.parentNode) {
16676
+ core_default.dom.removeSelf(this.svgLoading);
16677
+ }
16582
16678
  }
16583
16679
  }
16680
+ jumpToTargetSeconds(params) {
16681
+ this.showLoading(true);
16682
+ const onJumped = params.onJumped;
16683
+ const proxyOnJumped = () => {
16684
+ onJumped == null ? void 0 : onJumped();
16685
+ this.showLoading(false);
16686
+ };
16687
+ params.onJumped = proxyOnJumped;
16688
+ this.dispatch("jump", params);
16689
+ }
16584
16690
  onSooundClick() {
16585
16691
  var _a;
16586
16692
  this.volumeCurrent = this.volumeCurrent > 0 ? 0 : 100;
@@ -16808,7 +16914,7 @@ var MarkerHandle = class extends Plugin {
16808
16914
  return this.playArea;
16809
16915
  }
16810
16916
  init(_container, layoutInfo) {
16811
- if (this.createParams.puid) {
16917
+ if (this.createParams.displayMode == "playback") {
16812
16918
  return _container;
16813
16919
  }
16814
16920
  if (layoutInfo) {
@@ -16843,7 +16949,7 @@ var MarkerHandle = class extends Plugin {
16843
16949
  }
16844
16950
  jumpTimeLine() {
16845
16951
  if (this.currentHandleTimeline) {
16846
- this.dispatch("jump", { timeTarget: Number(this.currentHandleTimeline.time) });
16952
+ this.dispatch("jump", { "targetSeconds": Number(this.currentHandleTimeline.time) / 1e3 });
16847
16953
  }
16848
16954
  }
16849
16955
  onClickOpts(spanEle, info) {
@@ -17030,6 +17136,36 @@ var useContextMenu2 = (player) => {
17030
17136
  contextMenu.destory();
17031
17137
  };
17032
17138
  };
17139
+ function JumpEventsHandleCreater() {
17140
+ const jumpEvents = [];
17141
+ function HandleJumpEvents(current) {
17142
+ jumpEvents.forEach((jumpEvent, index) => {
17143
+ var _a, _b;
17144
+ if (current != jumpEvent.jumpEvent.targetSeconds) {
17145
+ if (!jumpEvent.status && current < jumpEvent.jumpEvent.targetSeconds) {
17146
+ jumpEvent.status = "beforeArrive";
17147
+ return;
17148
+ }
17149
+ if (jumpEvent.status && current < jumpEvent.jumpEvent.targetSeconds) {
17150
+ return;
17151
+ }
17152
+ }
17153
+ (_b = (_a = jumpEvent.jumpEvent).onJumped) == null ? void 0 : _b.call(_a);
17154
+ jumpEvents.splice(index, 1);
17155
+ });
17156
+ }
17157
+ return {
17158
+ add(jumpEvent) {
17159
+ jumpEvents.push({ jumpEvent });
17160
+ },
17161
+ handle(current) {
17162
+ HandleJumpEvents(current);
17163
+ },
17164
+ destory() {
17165
+ jumpEvents.splice(0, jumpEvents.length);
17166
+ }
17167
+ };
17168
+ }
17033
17169
  var PlayBack = (props) => {
17034
17170
  const {
17035
17171
  container,
@@ -17042,7 +17178,8 @@ var PlayBack = (props) => {
17042
17178
  token,
17043
17179
  locale = "zh",
17044
17180
  type: type1 = "web",
17045
- zIndexMenu
17181
+ zIndexMenu,
17182
+ displayMode
17046
17183
  } = __spreadValues(__spreadValues({}, defaultProps3), props);
17047
17184
  i18n_default(locale);
17048
17185
  let hplayer = void 0;
@@ -17062,7 +17199,8 @@ var PlayBack = (props) => {
17062
17199
  puid: puOption == null ? void 0 : puOption.puId,
17063
17200
  currentTimeGatter() {
17064
17201
  return barHandle.playbackInfo.current;
17065
- }
17202
+ },
17203
+ displayMode: (puOption == null ? void 0 : puOption.puId) ? "playback" : displayMode
17066
17204
  });
17067
17205
  const playbackRender = markerHandle.init(container);
17068
17206
  const player = new player_default({
@@ -17088,6 +17226,18 @@ var PlayBack = (props) => {
17088
17226
  barHandle.addEventListener("fullscreen", () => {
17089
17227
  fullscreen_default.toggle(markerHandle.GetPlayArea());
17090
17228
  });
17229
+ markerHandle.addEventListener("jump", (params) => {
17230
+ barHandle.jumpToTargetSeconds(params);
17231
+ });
17232
+ const jumpEventHandler = JumpEventsHandleCreater();
17233
+ function OnCurrentTimeChange(params) {
17234
+ barHandle.updata({
17235
+ total: params.duration,
17236
+ current: params.current
17237
+ });
17238
+ markerHandle.onCurrentTimeChange(params.current);
17239
+ jumpEventHandler.handle(params.current);
17240
+ }
17091
17241
  const contextIns = useContextMenu2({ instance: instance2, element: playbackRender, zIndexMenu });
17092
17242
  core_default.dom.append(playbackRender, barRendertarget);
17093
17243
  core_default.dom.append(barHandle.getContainer(), playerRendertarget);
@@ -17101,6 +17251,11 @@ var PlayBack = (props) => {
17101
17251
  aEle.download = fileName ? fileName : "\u8BF7\u586B\u5199Filename";
17102
17252
  aEle.click();
17103
17253
  });
17254
+ let jumpHandle;
17255
+ barHandle.addEventListener("jump", (jumpEvent) => {
17256
+ jumpEventHandler.add(jumpEvent);
17257
+ jumpHandle(jumpEvent);
17258
+ });
17104
17259
  if (this.protocol == "web") {
17105
17260
  const videoEle = player.video.getVideoEl();
17106
17261
  videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
@@ -17112,11 +17267,10 @@ var PlayBack = (props) => {
17112
17267
  });
17113
17268
  videoEle.ontimeupdate = () => {
17114
17269
  if (!isNaN(videoEle.duration)) {
17115
- barHandle.updata({
17116
- total: videoEle.duration,
17270
+ OnCurrentTimeChange({
17271
+ duration: videoEle.duration,
17117
17272
  current: videoEle.currentTime
17118
17273
  });
17119
- markerHandle.onCurrentTimeChange(videoEle.currentTime);
17120
17274
  }
17121
17275
  };
17122
17276
  videoEle.onloadedmetadata = () => {
@@ -17137,20 +17291,16 @@ var PlayBack = (props) => {
17137
17291
  }
17138
17292
  }
17139
17293
  });
17140
- barHandle.addEventListener("jump", (params) => {
17141
- if (typeof (params == null ? void 0 : params.timeTarget) == "number") {
17142
- videoEle.currentTime = params == null ? void 0 : params.timeTarget;
17143
- }
17144
- });
17145
- markerHandle.addEventListener("jump", (params) => {
17146
- if (typeof (params == null ? void 0 : params.timeTarget) == "number") {
17147
- videoEle.currentTime = (params == null ? void 0 : params.timeTarget) / 1e3;
17294
+ jumpHandle = (params) => {
17295
+ if (typeof (params == null ? void 0 : params.targetSeconds) == "number") {
17296
+ videoEle.currentTime = params == null ? void 0 : params.targetSeconds;
17148
17297
  }
17149
- });
17298
+ };
17150
17299
  handle2.close = () => {
17151
17300
  markerHandle.destroy();
17152
17301
  player.close();
17153
17302
  barHandle.destroy();
17303
+ jumpEventHandler.destory();
17154
17304
  contextIns == null ? void 0 : contextIns();
17155
17305
  handle2.close = void 0;
17156
17306
  handle2.pause = void 0;
@@ -17224,22 +17374,14 @@ var PlayBack = (props) => {
17224
17374
  }
17225
17375
  hplayer.onvideo = () => {
17226
17376
  };
17227
- barHandle.addEventListener("jump", (data) => __async(this, null, function* () {
17377
+ jumpHandle = (data) => __async(this, null, function* () {
17228
17378
  if (data && playbackInfo.data) {
17229
17379
  yield hplayer == null ? void 0 : hplayer.playbackStop();
17230
- const seekInfo = yield playbackController.seek({ range: [data == null ? void 0 : data.timeTarget, playbackInfo.data.range[1]] });
17380
+ const seekInfo = yield playbackController.seek({ range: [data == null ? void 0 : data.targetSeconds, playbackInfo.data.range[1]] });
17231
17381
  yield hplayer == null ? void 0 : hplayer.playbackStart();
17232
17382
  barHandle.pausePlayStateChange("play");
17233
17383
  }
17234
- }));
17235
- markerHandle.addEventListener("jump", (data) => __async(this, null, function* () {
17236
- if (data && playbackInfo.data) {
17237
- yield hplayer == null ? void 0 : hplayer.playbackStop();
17238
- const seekInfo = yield playbackController.seek({ range: [(data == null ? void 0 : data.timeTarget) / 1e3, playbackInfo.data.range[1]] });
17239
- yield hplayer == null ? void 0 : hplayer.playbackStart();
17240
- barHandle.pausePlayStateChange("play");
17241
- }
17242
- }));
17384
+ });
17243
17385
  barHandle.addEventListener("pauseOrPlay", (data) => {
17244
17386
  var _a3, _b2;
17245
17387
  if ((data == null ? void 0 : data.type) == "pause") {
@@ -17259,11 +17401,10 @@ var PlayBack = (props) => {
17259
17401
  const data = yield hplayer == null ? void 0 : hplayer.getPlayerStatistic();
17260
17402
  const ptsVideo = Number(data.data.mediaStatisticInfo.videoStatistic.lastvideopts) / 1e6;
17261
17403
  if (data.code == 0 && data.data && playbackInfo.data) {
17262
- barHandle.updata({
17263
- total: playbackInfo.data.range[1],
17404
+ OnCurrentTimeChange({
17405
+ duration: playbackInfo.data.range[1],
17264
17406
  current: ptsVideo < 0 ? 0 : ptsVideo
17265
17407
  });
17266
- markerHandle.onCurrentTimeChange(ptsVideo);
17267
17408
  }
17268
17409
  } catch (e) {
17269
17410
  }
@@ -17276,6 +17417,7 @@ var PlayBack = (props) => {
17276
17417
  hplayer == null ? void 0 : hplayer.playbackStop();
17277
17418
  barHandle.destroy();
17278
17419
  contextIns == null ? void 0 : contextIns();
17420
+ jumpEventHandler.destory();
17279
17421
  handle2.close = void 0;
17280
17422
  handle2.pause = void 0;
17281
17423
  handle2.resume = void 0;
@@ -17358,5 +17500,6 @@ export {
17358
17500
  playBack_default as PlayBack,
17359
17501
  puPlayer_default as PuPlayer,
17360
17502
  RemoteSdpFetcher,
17361
- clearAllDialog
17503
+ clearAllDialog,
17504
+ globalConfigHandler
17362
17505
  };
@@ -1,4 +1,8 @@
1
1
  import { CustomError } from "src/core/error";
2
+ export interface IJumpEventParams {
3
+ targetSeconds: number;
4
+ onJumped?(): void;
5
+ }
2
6
  export declare class MarkerTimelineError extends CustomError {
3
7
  constructor(message?: string);
4
8
  }
@@ -0,0 +1,7 @@
1
+ export interface IGlobalConfig {
2
+ bNotSendHost?: boolean;
3
+ }
4
+ export declare const globalConfigHandler: {
5
+ getDefaultProps: () => Partial<IGlobalConfig>;
6
+ setDefaultProps: (props: Partial<IGlobalConfig>) => void;
7
+ };
@@ -1,6 +1,6 @@
1
1
  import { SFC, Props, IComponentInstance } from "../core/types";
2
2
  import { IVideoFits } from "../plugins/player";
3
- import initI18n from "src/locales/i18n";
3
+ import initI18n from "../locales/i18n";
4
4
  type Container = HTMLElement | Element | Node | null;
5
5
  interface IPlaybackProps extends Props {
6
6
  fileID: string;
@@ -23,6 +23,7 @@ interface IPlaybackProps extends Props {
23
23
  locale?: Parameters<typeof initI18n>["0"];
24
24
  type?: IPlaybackPlayType;
25
25
  zIndexMenu?: number;
26
+ displayMode?: 'playback';
26
27
  }
27
28
  type IPlaybackPlayType = "ws-bvrtc" | "web";
28
29
  interface IPlaybackInstance extends IComponentInstance {
@@ -1,8 +1,9 @@
1
1
  import { IComponentInstance, Props, SFC } from "../core/types";
2
2
  import { IVideoFits } from "../plugins/player";
3
3
  import { IPuOption } from "./types";
4
- import { IControlPluginMap } from "src/plugins/controller";
4
+ import { IControlPluginMap } from "../plugins/controller";
5
5
  import { MikeButton } from "./subComponent/mikeButton";
6
+ import { IDataHandle } from "../core/events";
6
7
  type Container = HTMLElement | Element | Node | null;
7
8
  type helperFunc = {
8
9
  getDefaultProps: () => Partial<IPuPlayerProps>;
@@ -62,6 +63,9 @@ export interface IPuPlayerInstance extends IComponentInstance {
62
63
  protocol: "webrtc" | "ws-bvrtc" | "auto";
63
64
  videoFit: keyof IVideoFits;
64
65
  mike?: MikeButton;
66
+ playerStatus: {
67
+ fullscreen: IDataHandle<boolean>;
68
+ };
65
69
  }
66
70
  declare const PuPlayer: SFC<IPuPlayerProps, IPuPlayerInstance> & helperFunc;
67
71
  export default PuPlayer;
@@ -17,6 +17,17 @@ export interface IEvent {
17
17
  }
18
18
  export interface IEventMap {
19
19
  }
20
+ export declare class IDataHandle<T> {
21
+ private _data;
22
+ private handle;
23
+ constructor(data: T, handle: (data: T) => void);
24
+ Get(): T;
25
+ Set(data: T): void;
26
+ private szHandle;
27
+ addEventListener(handle: (data: T) => void): void;
28
+ removeEventListener(handle: (data: T) => void): void;
29
+ dispatch(data: T): void;
30
+ }
20
31
  export declare class Events<M extends IEventMap> {
21
32
  protected _notifier: INotifier<any, any>;
22
33
  constructor();
@@ -6,4 +6,5 @@ import { RemoteSdpFetcher } from './instances/bvWebrtc';
6
6
  import { IPuOption, IConfOption } from "./components/types";
7
7
  declare const clearAllDialog: (token: string) => Promise<void>;
8
8
  import "./styles/main.scss";
9
- export { PlayBack, PuPlayer, Intercom, Conference, IPuPlayerProps, IPuPlayerInstance, IIntercomProps, IIntercomInstance, IConferenceProps, IConferenceInstance, IPuOption, IConfOption, RemoteSdpFetcher, clearAllDialog, };
9
+ import { globalConfigHandler } from "./components/global.config";
10
+ export { globalConfigHandler, PlayBack, PuPlayer, Intercom, Conference, IPuPlayerProps, IPuPlayerInstance, IIntercomProps, IIntercomInstance, IConferenceProps, IConferenceInstance, IPuOption, IConfOption, RemoteSdpFetcher, clearAllDialog, };
@@ -1,9 +1,8 @@
1
1
  import { RenderTarget } from "src/core/types";
2
2
  import { IPluginEventMap, Plugin } from "./types";
3
+ import { IJumpEventParams } from "../api/marker";
3
4
  interface MarkerHandleEventMap extends IPluginEventMap {
4
- jump: {
5
- timeTarget: number;
6
- };
5
+ jump: IJumpEventParams;
7
6
  }
8
7
  interface IMarkerLayoutInfo {
9
8
  right: string;
@@ -14,6 +13,7 @@ interface ICreateParams {
14
13
  token: string;
15
14
  currentTimeGatter(): number;
16
15
  puid?: string;
16
+ displayMode?: 'playback';
17
17
  }
18
18
  declare class MarkerHandle extends Plugin<HTMLDivElement, MarkerHandleEventMap> {
19
19
  protected beforeDestroy(): void;
@@ -1,9 +1,8 @@
1
- import { RenderTarget } from "src/core/types";
1
+ import { RenderTarget } from "../core/types";
2
2
  import { IPluginEventMap, Plugin } from "./types";
3
+ import { IJumpEventParams } from "../api/marker";
3
4
  interface IPlaybackBarEventMap extends IPluginEventMap {
4
- jump: {
5
- timeTarget: number;
6
- };
5
+ jump: IJumpEventParams;
7
6
  pauseOrPlay: {
8
7
  type: "play" | 'pause';
9
8
  };
@@ -35,6 +34,9 @@ declare class PlaybackBar extends Plugin<HTMLDivElement, IPlaybackBarEventMap> {
35
34
  private onClickJump;
36
35
  private svgPause;
37
36
  private svgPlay;
37
+ private svgLoading;
38
+ private showLoading;
39
+ jumpToTargetSeconds(params: IJumpEventParams): void;
38
40
  private onSooundClick;
39
41
  private onVolumeChange;
40
42
  private volumeCurrent;
@@ -24,7 +24,7 @@ export interface IPlayerPluginEventMap extends IPluginEventMap {
24
24
  recordStart: undefined;
25
25
  recordStop: undefined;
26
26
  screenshot: undefined;
27
- fullscreen: undefined;
27
+ fullscreen: boolean;
28
28
  rotate: IRotateEvent;
29
29
  }
30
30
  export {};
@@ -1,3 +1,4 @@
1
+ declare function isFull(el: HTMLElement | EventTarget): boolean;
1
2
  declare function toggle(el?: HTMLElement, options?: FullscreenOptions): Promise<void>;
2
3
  declare function watch(el: HTMLElement, callback: (isFull: boolean) => void): {
3
4
  cancel: () => void;
@@ -5,5 +6,6 @@ declare function watch(el: HTMLElement, callback: (isFull: boolean) => void): {
5
6
  declare const fullscreen: {
6
7
  toggle: typeof toggle;
7
8
  watch: typeof watch;
9
+ isFull: typeof isFull;
8
10
  };
9
11
  export default fullscreen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.73",
3
+ "version": "0.8.75",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",