@besovideo/webrtc-player 0.8.72 → 0.8.74
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 +15 -0
- package/dist/main.es.js +196 -51
- package/dist/types/api/marker.d.ts +4 -0
- package/dist/types/components/global.config.d.ts +7 -0
- package/dist/types/components/playBack.d.ts +2 -2
- package/dist/types/components/puPlayer.d.ts +5 -1
- package/dist/types/core/events.d.ts +11 -0
- package/dist/types/main.d.ts +2 -1
- package/dist/types/plugins/markerHandle.d.ts +3 -3
- package/dist/types/plugins/palybackBar.d.ts +6 -4
- package/dist/types/plugins/player/event.d.ts +1 -1
- package/dist/types/utils/fullscreen.d.ts +2 -0
- package/package.json +1 -1
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.
|
|
114
|
+
define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.74", 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(
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
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.
|
|
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.
|
|
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
|
|
13764
|
-
|
|
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
|
-
|
|
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.
|
|
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,6 +16914,9 @@ var MarkerHandle = class extends Plugin {
|
|
|
16808
16914
|
return this.playArea;
|
|
16809
16915
|
}
|
|
16810
16916
|
init(_container, layoutInfo) {
|
|
16917
|
+
if (this.createParams.puid) {
|
|
16918
|
+
return _container;
|
|
16919
|
+
}
|
|
16811
16920
|
if (layoutInfo) {
|
|
16812
16921
|
this.layoutInfo = layoutInfo;
|
|
16813
16922
|
}
|
|
@@ -16840,7 +16949,7 @@ var MarkerHandle = class extends Plugin {
|
|
|
16840
16949
|
}
|
|
16841
16950
|
jumpTimeLine() {
|
|
16842
16951
|
if (this.currentHandleTimeline) {
|
|
16843
|
-
this.dispatch("jump", {
|
|
16952
|
+
this.dispatch("jump", { "targetSeconds": Number(this.currentHandleTimeline.time) / 1e3 });
|
|
16844
16953
|
}
|
|
16845
16954
|
}
|
|
16846
16955
|
onClickOpts(spanEle, info) {
|
|
@@ -17027,6 +17136,36 @@ var useContextMenu2 = (player) => {
|
|
|
17027
17136
|
contextMenu.destory();
|
|
17028
17137
|
};
|
|
17029
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
|
+
}
|
|
17030
17169
|
var PlayBack = (props) => {
|
|
17031
17170
|
const {
|
|
17032
17171
|
container,
|
|
@@ -17056,6 +17195,7 @@ var PlayBack = (props) => {
|
|
|
17056
17195
|
const markerHandle = new MarkerHandle({
|
|
17057
17196
|
token,
|
|
17058
17197
|
fileId: fileID,
|
|
17198
|
+
puid: puOption == null ? void 0 : puOption.puId,
|
|
17059
17199
|
currentTimeGatter() {
|
|
17060
17200
|
return barHandle.playbackInfo.current;
|
|
17061
17201
|
}
|
|
@@ -17084,6 +17224,18 @@ var PlayBack = (props) => {
|
|
|
17084
17224
|
barHandle.addEventListener("fullscreen", () => {
|
|
17085
17225
|
fullscreen_default.toggle(markerHandle.GetPlayArea());
|
|
17086
17226
|
});
|
|
17227
|
+
markerHandle.addEventListener("jump", (params) => {
|
|
17228
|
+
barHandle.jumpToTargetSeconds(params);
|
|
17229
|
+
});
|
|
17230
|
+
const jumpEventHandler = JumpEventsHandleCreater();
|
|
17231
|
+
function OnCurrentTimeChange(params) {
|
|
17232
|
+
barHandle.updata({
|
|
17233
|
+
total: params.duration,
|
|
17234
|
+
current: params.current
|
|
17235
|
+
});
|
|
17236
|
+
markerHandle.onCurrentTimeChange(params.current);
|
|
17237
|
+
jumpEventHandler.handle(params.current);
|
|
17238
|
+
}
|
|
17087
17239
|
const contextIns = useContextMenu2({ instance: instance2, element: playbackRender, zIndexMenu });
|
|
17088
17240
|
core_default.dom.append(playbackRender, barRendertarget);
|
|
17089
17241
|
core_default.dom.append(barHandle.getContainer(), playerRendertarget);
|
|
@@ -17097,6 +17249,11 @@ var PlayBack = (props) => {
|
|
|
17097
17249
|
aEle.download = fileName ? fileName : "\u8BF7\u586B\u5199Filename";
|
|
17098
17250
|
aEle.click();
|
|
17099
17251
|
});
|
|
17252
|
+
let jumpHandle;
|
|
17253
|
+
barHandle.addEventListener("jump", (jumpEvent) => {
|
|
17254
|
+
jumpEventHandler.add(jumpEvent);
|
|
17255
|
+
jumpHandle(jumpEvent);
|
|
17256
|
+
});
|
|
17100
17257
|
if (this.protocol == "web") {
|
|
17101
17258
|
const videoEle = player.video.getVideoEl();
|
|
17102
17259
|
videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
|
|
@@ -17108,11 +17265,10 @@ var PlayBack = (props) => {
|
|
|
17108
17265
|
});
|
|
17109
17266
|
videoEle.ontimeupdate = () => {
|
|
17110
17267
|
if (!isNaN(videoEle.duration)) {
|
|
17111
|
-
|
|
17112
|
-
|
|
17268
|
+
OnCurrentTimeChange({
|
|
17269
|
+
duration: videoEle.duration,
|
|
17113
17270
|
current: videoEle.currentTime
|
|
17114
17271
|
});
|
|
17115
|
-
markerHandle.onCurrentTimeChange(videoEle.currentTime);
|
|
17116
17272
|
}
|
|
17117
17273
|
};
|
|
17118
17274
|
videoEle.onloadedmetadata = () => {
|
|
@@ -17133,20 +17289,16 @@ var PlayBack = (props) => {
|
|
|
17133
17289
|
}
|
|
17134
17290
|
}
|
|
17135
17291
|
});
|
|
17136
|
-
|
|
17137
|
-
if (typeof (params == null ? void 0 : params.
|
|
17138
|
-
videoEle.currentTime = params == null ? void 0 : params.
|
|
17139
|
-
}
|
|
17140
|
-
});
|
|
17141
|
-
markerHandle.addEventListener("jump", (params) => {
|
|
17142
|
-
if (typeof (params == null ? void 0 : params.timeTarget) == "number") {
|
|
17143
|
-
videoEle.currentTime = (params == null ? void 0 : params.timeTarget) / 1e3;
|
|
17292
|
+
jumpHandle = (params) => {
|
|
17293
|
+
if (typeof (params == null ? void 0 : params.targetSeconds) == "number") {
|
|
17294
|
+
videoEle.currentTime = params == null ? void 0 : params.targetSeconds;
|
|
17144
17295
|
}
|
|
17145
|
-
}
|
|
17296
|
+
};
|
|
17146
17297
|
handle2.close = () => {
|
|
17147
17298
|
markerHandle.destroy();
|
|
17148
17299
|
player.close();
|
|
17149
17300
|
barHandle.destroy();
|
|
17301
|
+
jumpEventHandler.destory();
|
|
17150
17302
|
contextIns == null ? void 0 : contextIns();
|
|
17151
17303
|
handle2.close = void 0;
|
|
17152
17304
|
handle2.pause = void 0;
|
|
@@ -17220,22 +17372,14 @@ var PlayBack = (props) => {
|
|
|
17220
17372
|
}
|
|
17221
17373
|
hplayer.onvideo = () => {
|
|
17222
17374
|
};
|
|
17223
|
-
|
|
17375
|
+
jumpHandle = (data) => __async(this, null, function* () {
|
|
17224
17376
|
if (data && playbackInfo.data) {
|
|
17225
17377
|
yield hplayer == null ? void 0 : hplayer.playbackStop();
|
|
17226
|
-
const seekInfo = yield playbackController.seek({ range: [data == null ? void 0 : data.
|
|
17378
|
+
const seekInfo = yield playbackController.seek({ range: [data == null ? void 0 : data.targetSeconds, playbackInfo.data.range[1]] });
|
|
17227
17379
|
yield hplayer == null ? void 0 : hplayer.playbackStart();
|
|
17228
17380
|
barHandle.pausePlayStateChange("play");
|
|
17229
17381
|
}
|
|
17230
|
-
})
|
|
17231
|
-
markerHandle.addEventListener("jump", (data) => __async(this, null, function* () {
|
|
17232
|
-
if (data && playbackInfo.data) {
|
|
17233
|
-
yield hplayer == null ? void 0 : hplayer.playbackStop();
|
|
17234
|
-
const seekInfo = yield playbackController.seek({ range: [(data == null ? void 0 : data.timeTarget) / 1e3, playbackInfo.data.range[1]] });
|
|
17235
|
-
yield hplayer == null ? void 0 : hplayer.playbackStart();
|
|
17236
|
-
barHandle.pausePlayStateChange("play");
|
|
17237
|
-
}
|
|
17238
|
-
}));
|
|
17382
|
+
});
|
|
17239
17383
|
barHandle.addEventListener("pauseOrPlay", (data) => {
|
|
17240
17384
|
var _a3, _b2;
|
|
17241
17385
|
if ((data == null ? void 0 : data.type) == "pause") {
|
|
@@ -17255,11 +17399,10 @@ var PlayBack = (props) => {
|
|
|
17255
17399
|
const data = yield hplayer == null ? void 0 : hplayer.getPlayerStatistic();
|
|
17256
17400
|
const ptsVideo = Number(data.data.mediaStatisticInfo.videoStatistic.lastvideopts) / 1e6;
|
|
17257
17401
|
if (data.code == 0 && data.data && playbackInfo.data) {
|
|
17258
|
-
|
|
17259
|
-
|
|
17402
|
+
OnCurrentTimeChange({
|
|
17403
|
+
duration: playbackInfo.data.range[1],
|
|
17260
17404
|
current: ptsVideo < 0 ? 0 : ptsVideo
|
|
17261
17405
|
});
|
|
17262
|
-
markerHandle.onCurrentTimeChange(ptsVideo);
|
|
17263
17406
|
}
|
|
17264
17407
|
} catch (e) {
|
|
17265
17408
|
}
|
|
@@ -17272,6 +17415,7 @@ var PlayBack = (props) => {
|
|
|
17272
17415
|
hplayer == null ? void 0 : hplayer.playbackStop();
|
|
17273
17416
|
barHandle.destroy();
|
|
17274
17417
|
contextIns == null ? void 0 : contextIns();
|
|
17418
|
+
jumpEventHandler.destory();
|
|
17275
17419
|
handle2.close = void 0;
|
|
17276
17420
|
handle2.pause = void 0;
|
|
17277
17421
|
handle2.resume = void 0;
|
|
@@ -17354,5 +17498,6 @@ export {
|
|
|
17354
17498
|
playBack_default as PlayBack,
|
|
17355
17499
|
puPlayer_default as PuPlayer,
|
|
17356
17500
|
RemoteSdpFetcher,
|
|
17357
|
-
clearAllDialog
|
|
17501
|
+
clearAllDialog,
|
|
17502
|
+
globalConfigHandler
|
|
17358
17503
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SFC, Props, IComponentInstance } from "../core/types";
|
|
2
2
|
import { IVideoFits } from "../plugins/player";
|
|
3
|
-
import initI18n from "
|
|
3
|
+
import initI18n from "../locales/i18n";
|
|
4
4
|
type Container = HTMLElement | Element | Node | null;
|
|
5
5
|
interface IPlaybackProps extends Props {
|
|
6
6
|
fileID: string;
|
|
@@ -21,7 +21,7 @@ interface IPlaybackProps extends Props {
|
|
|
21
21
|
};
|
|
22
22
|
container?: Container;
|
|
23
23
|
locale?: Parameters<typeof initI18n>["0"];
|
|
24
|
-
type
|
|
24
|
+
type?: IPlaybackPlayType;
|
|
25
25
|
zIndexMenu?: number;
|
|
26
26
|
}
|
|
27
27
|
type IPlaybackPlayType = "ws-bvrtc" | "web";
|
|
@@ -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 "
|
|
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();
|
package/dist/types/main.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -13,6 +12,7 @@ interface ICreateParams {
|
|
|
13
12
|
fileId: string;
|
|
14
13
|
token: string;
|
|
15
14
|
currentTimeGatter(): number;
|
|
15
|
+
puid?: string;
|
|
16
16
|
}
|
|
17
17
|
declare class MarkerHandle extends Plugin<HTMLDivElement, MarkerHandleEventMap> {
|
|
18
18
|
protected beforeDestroy(): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { RenderTarget } from "
|
|
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;
|
|
@@ -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;
|