@besovideo/webrtc-player 0.8.71 → 0.8.72
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.72", 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() {
|
|
@@ -16938,33 +16947,6 @@ var MarkerHandle = class extends Plugin {
|
|
|
16938
16947
|
//core.dom.append(this.markerDisplayPanel, ...timelines)
|
|
16939
16948
|
};
|
|
16940
16949
|
|
|
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
16950
|
// src/components/playBack.tsx
|
|
16969
16951
|
var ContextMenuItems2 = /* @__PURE__ */ ((ContextMenuItems3) => {
|
|
16970
16952
|
ContextMenuItems3[ContextMenuItems3["videoFit"] = 0] = "videoFit";
|
|
@@ -17037,10 +17019,13 @@ var useContextMenu2 = (player) => {
|
|
|
17037
17019
|
});
|
|
17038
17020
|
});
|
|
17039
17021
|
contextMenu.reload();
|
|
17040
|
-
contextMenu.display(event);
|
|
17022
|
+
contextMenu.display(event, void 0, player.zIndexMenu);
|
|
17041
17023
|
};
|
|
17042
17024
|
el.addEventListener("contextmenu", onContextMenu);
|
|
17043
|
-
return () =>
|
|
17025
|
+
return () => {
|
|
17026
|
+
el.removeEventListener("contextmenu", onContextMenu);
|
|
17027
|
+
contextMenu.destory();
|
|
17028
|
+
};
|
|
17044
17029
|
};
|
|
17045
17030
|
var PlayBack = (props) => {
|
|
17046
17031
|
const {
|
|
@@ -17053,11 +17038,13 @@ var PlayBack = (props) => {
|
|
|
17053
17038
|
fileName,
|
|
17054
17039
|
token,
|
|
17055
17040
|
locale = "zh",
|
|
17056
|
-
type = "web"
|
|
17041
|
+
type: type1 = "web",
|
|
17042
|
+
zIndexMenu
|
|
17057
17043
|
} = __spreadValues(__spreadValues({}, defaultProps3), props);
|
|
17058
17044
|
i18n_default(locale);
|
|
17059
17045
|
let hplayer = void 0;
|
|
17060
17046
|
const handle2 = {};
|
|
17047
|
+
let type = (puOption == null ? void 0 : puOption.puId) && type1 == "ws-bvrtc" ? "web" : type1;
|
|
17061
17048
|
const instance2 = {
|
|
17062
17049
|
videoFit: "contain",
|
|
17063
17050
|
open() {
|
|
@@ -17074,13 +17061,12 @@ var PlayBack = (props) => {
|
|
|
17074
17061
|
}
|
|
17075
17062
|
});
|
|
17076
17063
|
const playbackRender = markerHandle.init(container);
|
|
17077
|
-
const recordfileInfo = yield recordApi.GetRecordInfo(fileID, token);
|
|
17078
17064
|
const player = new player_default({
|
|
17079
17065
|
video: {
|
|
17080
17066
|
type: "WS-BVRTC"
|
|
17081
17067
|
},
|
|
17082
17068
|
puOptions: {
|
|
17083
|
-
id: `${
|
|
17069
|
+
id: `${fileID}`,
|
|
17084
17070
|
index: 0
|
|
17085
17071
|
},
|
|
17086
17072
|
playerConfig: {
|
|
@@ -17098,22 +17084,22 @@ var PlayBack = (props) => {
|
|
|
17098
17084
|
barHandle.addEventListener("fullscreen", () => {
|
|
17099
17085
|
fullscreen_default.toggle(markerHandle.GetPlayArea());
|
|
17100
17086
|
});
|
|
17101
|
-
useContextMenu2({ instance: instance2, element: playbackRender });
|
|
17087
|
+
const contextIns = useContextMenu2({ instance: instance2, element: playbackRender, zIndexMenu });
|
|
17102
17088
|
core_default.dom.append(playbackRender, barRendertarget);
|
|
17103
17089
|
core_default.dom.append(barHandle.getContainer(), playerRendertarget);
|
|
17104
17090
|
handle2.setVideoFit = (fit) => {
|
|
17105
17091
|
player.setVideoFit(fit);
|
|
17106
17092
|
};
|
|
17107
17093
|
barHandle.addEventListener("download", () => {
|
|
17108
|
-
const filePath = dialog_default.getPlaybackFilePath({ fileId: fileID }, token);
|
|
17094
|
+
const filePath = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
|
|
17109
17095
|
const aEle = document.createElement("a");
|
|
17110
17096
|
aEle.href = filePath;
|
|
17111
|
-
aEle.download = fileName ? fileName :
|
|
17097
|
+
aEle.download = fileName ? fileName : "\u8BF7\u586B\u5199Filename";
|
|
17112
17098
|
aEle.click();
|
|
17113
17099
|
});
|
|
17114
17100
|
if (this.protocol == "web") {
|
|
17115
17101
|
const videoEle = player.video.getVideoEl();
|
|
17116
|
-
videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID }, token);
|
|
17102
|
+
videoEle.src = dialog_default.getPlaybackFilePath({ fileId: fileID, puid: puOption == null ? void 0 : puOption.puId }, token);
|
|
17117
17103
|
videoEle.controls = false;
|
|
17118
17104
|
barHandle.addEventListener("changeVolume", (data) => {
|
|
17119
17105
|
if (data) {
|
|
@@ -17161,6 +17147,7 @@ var PlayBack = (props) => {
|
|
|
17161
17147
|
markerHandle.destroy();
|
|
17162
17148
|
player.close();
|
|
17163
17149
|
barHandle.destroy();
|
|
17150
|
+
contextIns == null ? void 0 : contextIns();
|
|
17164
17151
|
handle2.close = void 0;
|
|
17165
17152
|
handle2.pause = void 0;
|
|
17166
17153
|
handle2.resume = void 0;
|
|
@@ -17199,7 +17186,8 @@ var PlayBack = (props) => {
|
|
|
17199
17186
|
}
|
|
17200
17187
|
logger_default.info("ws-bvrtc localSDP: ", (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.sdp);
|
|
17201
17188
|
const [dialog, playbackController] = yield dialog_default.getPlaybackBvrtc({
|
|
17202
|
-
sdp: (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.sdp
|
|
17189
|
+
sdp: (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.sdp,
|
|
17190
|
+
id: (puOption == null ? void 0 : puOption.puId) || (puOption == null ? void 0 : puOption.nruId)
|
|
17203
17191
|
}, token);
|
|
17204
17192
|
hplayer.onevent = (bCloseEvent, iResult) => {
|
|
17205
17193
|
if (bCloseEvent && handle2.close) {
|
|
@@ -17283,6 +17271,7 @@ var PlayBack = (props) => {
|
|
|
17283
17271
|
playbackController.close();
|
|
17284
17272
|
hplayer == null ? void 0 : hplayer.playbackStop();
|
|
17285
17273
|
barHandle.destroy();
|
|
17274
|
+
contextIns == null ? void 0 : contextIns();
|
|
17286
17275
|
handle2.close = void 0;
|
|
17287
17276
|
handle2.pause = void 0;
|
|
17288
17277
|
handle2.resume = void 0;
|
|
@@ -17334,7 +17323,7 @@ var PlayBack = (props) => {
|
|
|
17334
17323
|
},
|
|
17335
17324
|
setProtocol: function(protocol) {
|
|
17336
17325
|
this.close();
|
|
17337
|
-
this.protocol = protocol;
|
|
17326
|
+
this.protocol = (puOption == null ? void 0 : puOption.puId) ? "web" : protocol;
|
|
17338
17327
|
this.open();
|
|
17339
17328
|
},
|
|
17340
17329
|
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?: {
|
|
@@ -21,6 +22,7 @@ interface IPlaybackProps extends Props {
|
|
|
21
22
|
container?: Container;
|
|
22
23
|
locale?: Parameters<typeof initI18n>["0"];
|
|
23
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 {
|