@besovideo/webrtc-player 0.8.79 → 0.8.80
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
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.80", PROJECT_NAMESPACE: "bvplayer" };
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -4944,6 +4944,8 @@ var CustomError = class extends Error {
|
|
|
4944
4944
|
};
|
|
4945
4945
|
// 错误码
|
|
4946
4946
|
CustomError.ErrorStatus = {
|
|
4947
|
+
//token 失效
|
|
4948
|
+
TOKEN_FAIL: 9,
|
|
4947
4949
|
// 打开dialog失败
|
|
4948
4950
|
OPEN_DIALOG_FAILED: 1001,
|
|
4949
4951
|
// WEBRTC打开的流为h265
|
|
@@ -4973,6 +4975,18 @@ var globalConfigHandler = {
|
|
|
4973
4975
|
};
|
|
4974
4976
|
|
|
4975
4977
|
// src/api/dialog.ts
|
|
4978
|
+
var TokenFailError = class extends CustomError {
|
|
4979
|
+
constructor(message) {
|
|
4980
|
+
super(CustomError.ErrorStatus.TOKEN_FAIL, message);
|
|
4981
|
+
}
|
|
4982
|
+
static isTokenFailError(e) {
|
|
4983
|
+
return e instanceof TokenFailError;
|
|
4984
|
+
}
|
|
4985
|
+
toString() {
|
|
4986
|
+
console.error(super.toString());
|
|
4987
|
+
return "token fail";
|
|
4988
|
+
}
|
|
4989
|
+
};
|
|
4976
4990
|
var OpenDialogError = class extends CustomError {
|
|
4977
4991
|
constructor(message) {
|
|
4978
4992
|
super(CustomError.ErrorStatus.OPEN_DIALOG_FAILED, message);
|
|
@@ -5006,6 +5020,9 @@ var getDeviceWebrtc = (param, token, signal) => __async(void 0, null, function*
|
|
|
5006
5020
|
signal
|
|
5007
5021
|
);
|
|
5008
5022
|
logger_default.api("\u8BBE\u5907\u97F3\u89C6\u9891\u6D41 webrtc\u65B9\u5F0F\u6253\u5F00dialog: ", { params, resData });
|
|
5023
|
+
if ((resData == null ? void 0 : resData.code) == 9) {
|
|
5024
|
+
throw new TokenFailError("token fail");
|
|
5025
|
+
}
|
|
5009
5026
|
if (!resData || resData.code !== 0 || !((_a = resData.data) == null ? void 0 : _a.dialogid))
|
|
5010
5027
|
throw new OpenDialogError(`open dialog error: ${resData.msg}`);
|
|
5011
5028
|
const { data: dialog } = resData;
|
|
@@ -5036,6 +5053,9 @@ var getDeviceBvrtc = (param, token, signal) => __async(void 0, null, function* (
|
|
|
5036
5053
|
signal
|
|
5037
5054
|
);
|
|
5038
5055
|
logger_default.api("\u8BBE\u5907\u97F3\u89C6\u9891\u6D41 bvrtc\u65B9\u5F0F\u6253\u5F00dialog: ", { params, resData });
|
|
5056
|
+
if (resData == null ? void 0 : resData.code) {
|
|
5057
|
+
throw new TokenFailError("token fail");
|
|
5058
|
+
}
|
|
5039
5059
|
if (!resData || resData.code !== 0 || !((_a = resData.data) == null ? void 0 : _a.dialogid))
|
|
5040
5060
|
throw new OpenDialogError(`\u6253\u5F00\u4F20\u8F93\u901A\u9053\u5931\u8D25: ${resData.msg}`);
|
|
5041
5061
|
const { data: dialog } = resData;
|
|
@@ -9065,6 +9085,12 @@ var connect = (param, onGotStream) => __async(void 0, null, function* () {
|
|
|
9065
9085
|
try {
|
|
9066
9086
|
remoteSdp = yield productRemoteSdp(new RTCSessionDescription(offer));
|
|
9067
9087
|
} catch (e) {
|
|
9088
|
+
if (e instanceof CustomError) {
|
|
9089
|
+
const err = e;
|
|
9090
|
+
if (err.status == CustomError.ErrorStatus.TOKEN_FAIL) {
|
|
9091
|
+
throw e;
|
|
9092
|
+
}
|
|
9093
|
+
}
|
|
9068
9094
|
throw t("da-kai-shi-bai");
|
|
9069
9095
|
}
|
|
9070
9096
|
logger_default.info("webrtc remoteSDP: ", remoteSdp);
|
|
@@ -14874,7 +14900,8 @@ var en_default = {
|
|
|
14874
14900
|
"shan-chu": "Delete",
|
|
14875
14901
|
"tiao-zhuan": "Jump",
|
|
14876
14902
|
"fa-song": "Send",
|
|
14877
|
-
"xian-shi": "Show"
|
|
14903
|
+
"xian-shi": "Show",
|
|
14904
|
+
"token-fail": "Token Fail"
|
|
14878
14905
|
};
|
|
14879
14906
|
|
|
14880
14907
|
// src/locales/zh.json
|
|
@@ -14923,7 +14950,8 @@ var zh_default = {
|
|
|
14923
14950
|
"shan-chu": "\u5220\u9664",
|
|
14924
14951
|
"tiao-zhuan": "\u8DF3\u8F6C",
|
|
14925
14952
|
"xian-shi": "\u663E\u793A",
|
|
14926
|
-
"fa-song": "\u53D1\u9001"
|
|
14953
|
+
"fa-song": "\u53D1\u9001",
|
|
14954
|
+
"token-fail": "\u8BA4\u8BC1\u5931\u6548"
|
|
14927
14955
|
};
|
|
14928
14956
|
|
|
14929
14957
|
// src/locales/i18n.ts
|
|
@@ -16456,6 +16484,7 @@ var PuPlayer = (props) => {
|
|
|
16456
16484
|
onConnectedFailed,
|
|
16457
16485
|
onClose,
|
|
16458
16486
|
onDisConnected,
|
|
16487
|
+
onTokenFail,
|
|
16459
16488
|
fullScreenOnDblclick = true,
|
|
16460
16489
|
enableController = false,
|
|
16461
16490
|
disabledControls = [],
|
|
@@ -16601,6 +16630,12 @@ var PuPlayer = (props) => {
|
|
|
16601
16630
|
}
|
|
16602
16631
|
}
|
|
16603
16632
|
});
|
|
16633
|
+
function tokenFailDetect(err, callBack) {
|
|
16634
|
+
if (TokenFailError.isTokenFailError(err)) {
|
|
16635
|
+
callBack == null ? void 0 : callBack();
|
|
16636
|
+
throw err;
|
|
16637
|
+
}
|
|
16638
|
+
}
|
|
16604
16639
|
const instance2 = {
|
|
16605
16640
|
getVideoElement: () => {
|
|
16606
16641
|
const el = player.video.getVideoEl();
|
|
@@ -16652,6 +16687,11 @@ var PuPlayer = (props) => {
|
|
|
16652
16687
|
player.intercomUtils = CreateIntercomUtils(intercom == null ? void 0 : intercom.instance, this.protocol);
|
|
16653
16688
|
}
|
|
16654
16689
|
} catch (e) {
|
|
16690
|
+
tokenFailDetect(e, () => {
|
|
16691
|
+
player.mask.visible = true;
|
|
16692
|
+
player.mask.text = t("token-fail");
|
|
16693
|
+
onTokenFail == null ? void 0 : onTokenFail();
|
|
16694
|
+
});
|
|
16655
16695
|
if (protocol == "webrtc") {
|
|
16656
16696
|
player.mask.visible = true;
|
|
16657
16697
|
player.mask.text = e.toString();
|
|
@@ -16736,6 +16776,9 @@ var PuPlayer = (props) => {
|
|
|
16736
16776
|
logger_default.info("ws-bvrtc remoteSDP: ", dialog.sdp);
|
|
16737
16777
|
hplayer.setRemoteSDP(dialog.dialogId, dialog.sdp);
|
|
16738
16778
|
} catch (e2) {
|
|
16779
|
+
if (TokenFailError.isTokenFailError(e2)) {
|
|
16780
|
+
throw e2;
|
|
16781
|
+
}
|
|
16739
16782
|
throw t("da-kai-shi-bai");
|
|
16740
16783
|
}
|
|
16741
16784
|
player.statsInfosV1 = () => {
|
|
@@ -16848,6 +16891,11 @@ var PuPlayer = (props) => {
|
|
|
16848
16891
|
player.mikeBtn.type = this.protocol;
|
|
16849
16892
|
}
|
|
16850
16893
|
} catch (e2) {
|
|
16894
|
+
tokenFailDetect(e2, () => {
|
|
16895
|
+
player.mask.visible = true;
|
|
16896
|
+
player.mask.text = t("token-fail");
|
|
16897
|
+
onTokenFail == null ? void 0 : onTokenFail();
|
|
16898
|
+
});
|
|
16851
16899
|
player.mask.visible = true;
|
|
16852
16900
|
player.mask.text = e2.toString();
|
|
16853
16901
|
hplayer == null ? void 0 : hplayer.close();
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { CustomError } from "src/core/error";
|
|
2
|
+
export declare class TokenFailError extends CustomError {
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
static isTokenFailError(e: any): boolean;
|
|
5
|
+
toString(): string;
|
|
6
|
+
}
|
|
2
7
|
export declare class OpenDialogError extends CustomError {
|
|
3
8
|
constructor(message?: string);
|
|
4
9
|
toString(): string;
|