@besovideo/webrtc-player 0.8.71 → 0.8.73
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/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.73", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -5038,12 +5038,10 @@ var getPlaybackBvrtc = (param, token, signal) => __async(void 0, null, function*
|
|
|
5038
5038
|
const headers = {
|
|
5039
5039
|
Authorization: token || ""
|
|
5040
5040
|
};
|
|
5041
|
-
const params = AppendHost(
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
}, param.id ? { id: param.id } : {})
|
|
5046
|
-
);
|
|
5041
|
+
const params = AppendHost(__spreadValues({
|
|
5042
|
+
index: param.index,
|
|
5043
|
+
sdp: param.sdp
|
|
5044
|
+
}, param.id ? { id: param.id } : {}));
|
|
5047
5045
|
const resData = yield http_default.post(
|
|
5048
5046
|
`${apiUrls.bvscpV1()}/dialog/playback`,
|
|
5049
5047
|
params,
|
|
@@ -5068,6 +5066,9 @@ var getPlaybackBvrtc = (param, token, signal) => __async(void 0, null, function*
|
|
|
5068
5066
|
];
|
|
5069
5067
|
});
|
|
5070
5068
|
var getPlaybackFilePath = (param, token, signal) => {
|
|
5069
|
+
if (param.puid) {
|
|
5070
|
+
return `${apiUrls.bvscpV1()}/pu/download/${param.puid}/${param.fileId}?token=${token}`;
|
|
5071
|
+
}
|
|
5071
5072
|
return `${apiUrls.bvnruV1()}/download/${param.fileId}?token=${token}`;
|
|
5072
5073
|
};
|
|
5073
5074
|
var genPlaybackController = (dialogId, token) => {
|
|
@@ -14380,6 +14381,11 @@ function ContextMenu(menu, options) {
|
|
|
14380
14381
|
container.innerHTML = "";
|
|
14381
14382
|
container.appendChild(renderLevel(menu));
|
|
14382
14383
|
};
|
|
14384
|
+
this.destory = function() {
|
|
14385
|
+
window.removeEventListener("click", documentClick);
|
|
14386
|
+
var container = document.getElementById("cm_" + num);
|
|
14387
|
+
document.body.removeChild(container);
|
|
14388
|
+
};
|
|
14383
14389
|
function renderLevel(level) {
|
|
14384
14390
|
var ul_outer = document.createElement("ul");
|
|
14385
14391
|
level.forEach(function(item) {
|
|
@@ -14446,7 +14452,7 @@ function ContextMenu(menu, options) {
|
|
|
14446
14452
|
});
|
|
14447
14453
|
return ul_outer;
|
|
14448
14454
|
}
|
|
14449
|
-
this.display = function(e, target) {
|
|
14455
|
+
this.display = function(e, target, zIndexMenu) {
|
|
14450
14456
|
if (typeof target !== "undefined") {
|
|
14451
14457
|
self2.contextTarget = target;
|
|
14452
14458
|
} else {
|
|
@@ -14500,6 +14506,9 @@ function ContextMenu(menu, options) {
|
|
|
14500
14506
|
if (ContextUtil.getProperty(options, "close_on_click", true)) {
|
|
14501
14507
|
window.addEventListener("click", documentClick);
|
|
14502
14508
|
}
|
|
14509
|
+
if (typeof zIndexMenu == "number") {
|
|
14510
|
+
menu2.style.zIndex = zIndexMenu;
|
|
14511
|
+
}
|
|
14503
14512
|
e.preventDefault();
|
|
14504
14513
|
};
|
|
14505
14514
|
this.hide = function() {
|
|
@@ -16799,6 +16808,9 @@ var MarkerHandle = class extends Plugin {
|
|
|
16799
16808
|
return this.playArea;
|
|
16800
16809
|
}
|
|
16801
16810
|
init(_container, layoutInfo) {
|
|
16811
|
+
if (this.createParams.puid) {
|
|
16812
|
+
return _container;
|
|
16813
|
+
}
|
|
16802
16814
|
if (layoutInfo) {
|
|
16803
16815
|
this.layoutInfo = layoutInfo;
|
|
16804
16816
|
}
|
|
@@ -16938,33 +16950,6 @@ var MarkerHandle = class extends Plugin {
|
|
|
16938
16950
|
//core.dom.append(this.markerDisplayPanel, ...timelines)
|
|
16939
16951
|
};
|
|
16940
16952
|
|
|
16941
|
-
// src/api/record.ts
|
|
16942
|
-
init_define_processenv();
|
|
16943
|
-
init_jsx_shim();
|
|
16944
|
-
init_logger();
|
|
16945
|
-
var RecordlineError = class extends CustomError {
|
|
16946
|
-
constructor(message) {
|
|
16947
|
-
super(CustomError.ErrorStatus.RECORD_INFO_FAILURE, message);
|
|
16948
|
-
}
|
|
16949
|
-
};
|
|
16950
|
-
var GetRecordInfo = (fileId, token) => __async(void 0, null, function* () {
|
|
16951
|
-
const headers = {
|
|
16952
|
-
Authorization: token || ""
|
|
16953
|
-
};
|
|
16954
|
-
const resData = yield http_default.get(
|
|
16955
|
-
`${apiUrls.bvscpV1()}/recordfile/${fileId}`,
|
|
16956
|
-
void 0,
|
|
16957
|
-
{ headers }
|
|
16958
|
-
);
|
|
16959
|
-
logger_default.api("\u83B7\u53D6\u5F55\u50CF\u6587\u4EF6\u4FE1\u606F: ", { resData });
|
|
16960
|
-
if (!resData || resData.code !== 0)
|
|
16961
|
-
throw new RecordlineError(`Timeline Get: ${resData == null ? void 0 : resData.msg}`);
|
|
16962
|
-
return resData.data;
|
|
16963
|
-
});
|
|
16964
|
-
var recordApi = {
|
|
16965
|
-
GetRecordInfo
|
|
16966
|
-
};
|
|
16967
|
-
|
|
16968
16953
|
// src/components/playBack.tsx
|
|
16969
16954
|
var ContextMenuItems2 = /* @__PURE__ */ ((ContextMenuItems3) => {
|
|
16970
16955
|
ContextMenuItems3[ContextMenuItems3["videoFit"] = 0] = "videoFit";
|
|
@@ -17037,10 +17022,13 @@ var useContextMenu2 = (player) => {
|
|
|
17037
17022
|
});
|
|
17038
17023
|
});
|
|
17039
17024
|
contextMenu.reload();
|
|
17040
|
-
contextMenu.display(event);
|
|
17025
|
+
contextMenu.display(event, void 0, player.zIndexMenu);
|
|
17041
17026
|
};
|
|
17042
17027
|
el.addEventListener("contextmenu", onContextMenu);
|
|
17043
|
-
return () =>
|
|
17028
|
+
return () => {
|
|
17029
|
+
el.removeEventListener("contextmenu", onContextMenu);
|
|
17030
|
+
contextMenu.destory();
|
|
17031
|
+
};
|
|
17044
17032
|
};
|
|
17045
17033
|
var PlayBack = (props) => {
|
|
17046
17034
|
const {
|
|
@@ -17053,11 +17041,13 @@ var PlayBack = (props) => {
|
|
|
17053
17041
|
fileName,
|
|
17054
17042
|
token,
|
|
17055
17043
|
locale = "zh",
|
|
17056
|
-
type = "web"
|
|
17044
|
+
type: type1 = "web",
|
|
17045
|
+
zIndexMenu
|
|
17057
17046
|
} = __spreadValues(__spreadValues({}, defaultProps3), props);
|
|
17058
17047
|
i18n_default(locale);
|
|
17059
17048
|
let hplayer = void 0;
|
|
17060
17049
|
const handle2 = {};
|
|
17050
|
+
let type = (puOption == null ? void 0 : puOption.puId) && type1 == "ws-bvrtc" ? "web" : type1;
|
|
17061
17051
|
const instance2 = {
|
|
17062
17052
|
videoFit: "contain",
|
|
17063
17053
|
open() {
|
|
@@ -17069,18 +17059,18 @@ var PlayBack = (props) => {
|
|
|
17069
17059
|
const markerHandle = new MarkerHandle({
|
|
17070
17060
|
token,
|
|
17071
17061
|
fileId: fileID,
|
|
17062
|
+
puid: puOption == null ? void 0 : puOption.puId,
|
|
17072
17063
|
currentTimeGatter() {
|
|
17073
17064
|
return barHandle.playbackInfo.current;
|
|
17074
17065
|
}
|
|
17075
17066
|
});
|
|
17076
17067
|
const playbackRender = markerHandle.init(container);
|
|
17077
|
-
const recordfileInfo = yield recordApi.GetRecordInfo(fileID, token);
|
|
17078
17068
|
const player = new player_default({
|
|
17079
17069
|
video: {
|
|
17080
17070
|
type: "WS-BVRTC"
|
|
17081
17071
|
},
|
|
17082
17072
|
puOptions: {
|
|
17083
|
-
id: `${
|
|
17073
|
+
id: `${fileID}`,
|
|
17084
17074
|
index: 0
|
|
17085
17075
|
},
|
|
17086
17076
|
playerConfig: {
|
|
@@ -17098,22 +17088,22 @@ var PlayBack = (props) => {
|
|
|
17098
17088
|
barHandle.addEventListener("fullscreen", () => {
|
|
17099
17089
|
fullscreen_default.toggle(markerHandle.GetPlayArea());
|
|
17100
17090
|
});
|
|
17101
|
-
useContextMenu2({ instance: instance2, element: playbackRender });
|
|
17091
|
+
const contextIns = useContextMenu2({ instance: instance2, element: playbackRender, zIndexMenu });
|
|
17102
17092
|
core_default.dom.append(playbackRender, barRendertarget);
|
|
17103
17093
|
core_default.dom.append(barHandle.getContainer(), playerRendertarget);
|
|
17104
17094
|
handle2.setVideoFit = (fit) => {
|
|
17105
17095
|
player.setVideoFit(fit);
|
|
17106
17096
|
};
|
|
17107
17097
|
barHandle.addEventListener("download", () => {
|
|
17108
|
-
const filePath = dialog_default.getPlaybackFilePath({ fileId: fileID }, token);
|
|
17098
|
+
const filePath = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
|
|
17109
17099
|
const aEle = document.createElement("a");
|
|
17110
17100
|
aEle.href = filePath;
|
|
17111
|
-
aEle.download = fileName ? fileName :
|
|
17101
|
+
aEle.download = fileName ? fileName : "\u8BF7\u586B\u5199Filename";
|
|
17112
17102
|
aEle.click();
|
|
17113
17103
|
});
|
|
17114
17104
|
if (this.protocol == "web") {
|
|
17115
17105
|
const videoEle = player.video.getVideoEl();
|
|
17116
|
-
videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID }, token);
|
|
17106
|
+
videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
|
|
17117
17107
|
videoEle.controls = false;
|
|
17118
17108
|
barHandle.addEventListener("changeVolume", (data) => {
|
|
17119
17109
|
if (data) {
|
|
@@ -17161,6 +17151,7 @@ var PlayBack = (props) => {
|
|
|
17161
17151
|
markerHandle.destroy();
|
|
17162
17152
|
player.close();
|
|
17163
17153
|
barHandle.destroy();
|
|
17154
|
+
contextIns == null ? void 0 : contextIns();
|
|
17164
17155
|
handle2.close = void 0;
|
|
17165
17156
|
handle2.pause = void 0;
|
|
17166
17157
|
handle2.resume = void 0;
|
|
@@ -17199,7 +17190,8 @@ var PlayBack = (props) => {
|
|
|
17199
17190
|
}
|
|
17200
17191
|
logger_default.info("ws-bvrtc localSDP: ", (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.sdp);
|
|
17201
17192
|
const [dialog, playbackController] = yield dialog_default.getPlaybackBvrtc({
|
|
17202
|
-
sdp: (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.sdp
|
|
17193
|
+
sdp: (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.sdp,
|
|
17194
|
+
id: (puOption == null ? void 0 : puOption.puId) || (puOption == null ? void 0 : puOption.nruId)
|
|
17203
17195
|
}, token);
|
|
17204
17196
|
hplayer.onevent = (bCloseEvent, iResult) => {
|
|
17205
17197
|
if (bCloseEvent && handle2.close) {
|
|
@@ -17283,6 +17275,7 @@ var PlayBack = (props) => {
|
|
|
17283
17275
|
playbackController.close();
|
|
17284
17276
|
hplayer == null ? void 0 : hplayer.playbackStop();
|
|
17285
17277
|
barHandle.destroy();
|
|
17278
|
+
contextIns == null ? void 0 : contextIns();
|
|
17286
17279
|
handle2.close = void 0;
|
|
17287
17280
|
handle2.pause = void 0;
|
|
17288
17281
|
handle2.resume = void 0;
|
|
@@ -17334,7 +17327,7 @@ var PlayBack = (props) => {
|
|
|
17334
17327
|
},
|
|
17335
17328
|
setProtocol: function(protocol) {
|
|
17336
17329
|
this.close();
|
|
17337
|
-
this.protocol = protocol;
|
|
17330
|
+
this.protocol = (puOption == null ? void 0 : puOption.puId) ? "web" : protocol;
|
|
17338
17331
|
this.open();
|
|
17339
17332
|
},
|
|
17340
17333
|
protocol: "web"
|
|
@@ -51,6 +51,7 @@ declare const dialogApi: {
|
|
|
51
51
|
closeAllStorageDialog: (token: string) => Promise<void>;
|
|
52
52
|
getPlaybackBvrtc: (param: Partial<IGetDeviceWebRtcParam>, token?: string, signal?: AbortSignal) => Promise<[IDialog, TPlaybackController]>;
|
|
53
53
|
getPlaybackFilePath: (param: {
|
|
54
|
+
puid?: string;
|
|
54
55
|
fileId: string;
|
|
55
56
|
}, token?: string, signal?: AbortSignal) => string;
|
|
56
57
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SFC, Props, IComponentInstance } from "
|
|
1
|
+
import { SFC, Props, IComponentInstance } from "../core/types";
|
|
2
2
|
import { IVideoFits } from "../plugins/player";
|
|
3
3
|
import initI18n from "src/locales/i18n";
|
|
4
4
|
type Container = HTMLElement | Element | Node | null;
|
|
@@ -6,8 +6,9 @@ interface IPlaybackProps extends Props {
|
|
|
6
6
|
fileID: string;
|
|
7
7
|
fileName?: string;
|
|
8
8
|
token: string;
|
|
9
|
-
puOption
|
|
10
|
-
|
|
9
|
+
puOption?: {
|
|
10
|
+
puId?: string;
|
|
11
|
+
nruId?: string;
|
|
11
12
|
};
|
|
12
13
|
apiPrefix?: string;
|
|
13
14
|
bvrtcConfig?: {
|
|
@@ -20,7 +21,8 @@ interface IPlaybackProps extends Props {
|
|
|
20
21
|
};
|
|
21
22
|
container?: Container;
|
|
22
23
|
locale?: Parameters<typeof initI18n>["0"];
|
|
23
|
-
type
|
|
24
|
+
type?: IPlaybackPlayType;
|
|
25
|
+
zIndexMenu?: number;
|
|
24
26
|
}
|
|
25
27
|
type IPlaybackPlayType = "ws-bvrtc" | "web";
|
|
26
28
|
interface IPlaybackInstance extends IComponentInstance {
|
|
@@ -7,7 +7,8 @@ export class ContextMenu {
|
|
|
7
7
|
changeOption: (option: any, value: any) => void;
|
|
8
8
|
getOptions: () => any;
|
|
9
9
|
reload: () => void;
|
|
10
|
-
|
|
10
|
+
destory: () => void;
|
|
11
|
+
display: (e: any, target: any, zIndexMenu: any) => void;
|
|
11
12
|
hide: () => void;
|
|
12
13
|
}
|
|
13
14
|
export namespace ContextMenu {
|