@realsee/live 0.6.10 → 0.6.11
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/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +27 -66
- package/dist/index.es.js.map +1 -1
- package/dist/live/controller.d.ts +4 -0
- package/dist/live/live.d.ts +1 -1
- package/dist/utils/RobustWebSocket.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -619,7 +619,7 @@ class mr extends ue {
|
|
|
619
619
|
timeout: 1e4,
|
|
620
620
|
shouldReconnect: (e, i) => {
|
|
621
621
|
if (!(e.code === 1008 || e.code === 1011))
|
|
622
|
-
return [
|
|
622
|
+
return [0, 1e3, 2e3][i.attempts % 3];
|
|
623
623
|
},
|
|
624
624
|
should1000Reconnect: !1,
|
|
625
625
|
ignoreConnectivityEvents: !1,
|
|
@@ -949,6 +949,12 @@ class vr extends ue {
|
|
|
949
949
|
return this._ws.send(JSON.stringify(e));
|
|
950
950
|
throw new Error("live has not yet been initialized!");
|
|
951
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* 准备关闭带看
|
|
954
|
+
*/
|
|
955
|
+
readyClose() {
|
|
956
|
+
this._ws && (this._ws._explicitlyClosed = !0);
|
|
957
|
+
}
|
|
952
958
|
}
|
|
953
959
|
const pr = (r) => Promise.reject("unimplemented method GetVoiceSign"), je = (r, s = {}, e = []) => ({
|
|
954
960
|
command: r,
|
|
@@ -1039,19 +1045,12 @@ class yr extends ue {
|
|
|
1039
1045
|
switch (g) {
|
|
1040
1046
|
case K.SelfUserInfo: {
|
|
1041
1047
|
const _ = v;
|
|
1042
|
-
ot(this.selfInfo, _, { deep: !0 }) || (this._buildInData.selfInfo = _, this.emit(
|
|
1043
|
-
"selfInfoUpdate",
|
|
1044
|
-
this._buildInData.selfInfo,
|
|
1045
|
-
E
|
|
1046
|
-
));
|
|
1048
|
+
ot(this.selfInfo, _, { deep: !0 }) || (this._buildInData.selfInfo = _, this.emit("selfInfoUpdate", this._buildInData.selfInfo, E));
|
|
1047
1049
|
break;
|
|
1048
1050
|
}
|
|
1049
1051
|
case K.RoomInfo: {
|
|
1050
1052
|
const _ = v;
|
|
1051
|
-
this._buildInData.roomInfo = Object.assign({}, _), this.emit(
|
|
1052
|
-
"readyKeyframeSync",
|
|
1053
|
-
_.last_frame || {}
|
|
1054
|
-
);
|
|
1053
|
+
this._buildInData.roomInfo = Object.assign({}, _), this.emit("readyKeyframeSync", _.last_frame || {});
|
|
1055
1054
|
break;
|
|
1056
1055
|
}
|
|
1057
1056
|
case K.RTCInfo: {
|
|
@@ -1081,23 +1080,13 @@ class yr extends ue {
|
|
|
1081
1080
|
break;
|
|
1082
1081
|
}
|
|
1083
1082
|
case K.KeyframeSync: {
|
|
1084
|
-
const _ = v, V = Object.keys(
|
|
1085
|
-
_
|
|
1086
|
-
).reduce(
|
|
1083
|
+
const _ = v, V = Object.keys(_).reduce(
|
|
1087
1084
|
(C, k) => {
|
|
1088
|
-
if (ot(
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
{
|
|
1092
|
-
deep: !0
|
|
1093
|
-
}
|
|
1094
|
-
))
|
|
1085
|
+
if (ot(_[k], this._buildInData.keyframes[k], {
|
|
1086
|
+
deep: !0
|
|
1087
|
+
}))
|
|
1095
1088
|
return C;
|
|
1096
|
-
const U = [
|
|
1097
|
-
_[k],
|
|
1098
|
-
this._buildInData.keyframes[k],
|
|
1099
|
-
E
|
|
1100
|
-
], P = k;
|
|
1089
|
+
const U = [_[k], this._buildInData.keyframes[k], E], P = k;
|
|
1101
1090
|
return this.keyframes.emit(
|
|
1102
1091
|
P,
|
|
1103
1092
|
...U
|
|
@@ -1110,9 +1099,7 @@ class yr extends ue {
|
|
|
1110
1099
|
}
|
|
1111
1100
|
case K.BuiltinMsg: {
|
|
1112
1101
|
const _ = v;
|
|
1113
|
-
this.emit("builtinEvent", _), _.event_type === q.UserChange && this.emit("userChange", _), _.event_type === q.RoomChange && this.emit("roomChange", _), _.event_type === q.UserChange && _.action === H.UserMicroStatus && await this.toggleMicro(
|
|
1114
|
-
_.data.status === Z.OPEN
|
|
1115
|
-
), _.event_type === q.RoomChange && _.action === H.RoomClose && await this.exit();
|
|
1102
|
+
this.emit("builtinEvent", _), _.event_type === q.UserChange && this.emit("userChange", _), _.event_type === q.RoomChange && this.emit("roomChange", _), _.event_type === q.UserChange && _.action === H.UserMicroStatus && await this.toggleMicro(_.data.status === Z.OPEN), _.event_type === q.RoomChange && _.action === H.RoomClose && await this.exit();
|
|
1116
1103
|
break;
|
|
1117
1104
|
}
|
|
1118
1105
|
case K.UserKickOut: {
|
|
@@ -1182,11 +1169,9 @@ class yr extends ue {
|
|
|
1182
1169
|
* @param reason
|
|
1183
1170
|
* @returns
|
|
1184
1171
|
*/
|
|
1185
|
-
o(this, "close", async () =>
|
|
1186
|
-
q.RoomChange,
|
|
1187
|
-
|
|
1188
|
-
{}
|
|
1189
|
-
));
|
|
1172
|
+
o(this, "close", async () => {
|
|
1173
|
+
await this._controller.readyClose(), await this.updateStatus(q.RoomChange, H.RoomClose, {});
|
|
1174
|
+
});
|
|
1190
1175
|
/**
|
|
1191
1176
|
* 销毁带看
|
|
1192
1177
|
* @returns
|
|
@@ -1197,11 +1182,7 @@ class yr extends ue {
|
|
|
1197
1182
|
* @param userInfo
|
|
1198
1183
|
* @returns
|
|
1199
1184
|
*/
|
|
1200
|
-
o(this, "setSelfInfo", async (e) => await this.updateStatus(
|
|
1201
|
-
q.UserChange,
|
|
1202
|
-
H.UserInfo,
|
|
1203
|
-
e
|
|
1204
|
-
));
|
|
1185
|
+
o(this, "setSelfInfo", async (e) => await this.updateStatus(q.UserChange, H.UserInfo, e));
|
|
1205
1186
|
// 仅用于用户自己的麦克风控制
|
|
1206
1187
|
o(this, "toggleMicro", async (e) => {
|
|
1207
1188
|
var n, c, u;
|
|
@@ -1265,10 +1246,7 @@ class yr extends ue {
|
|
|
1265
1246
|
e
|
|
1266
1247
|
);
|
|
1267
1248
|
});
|
|
1268
|
-
this._addLiveControllerEventListeners(), this._options = Object.assign(
|
|
1269
|
-
{ initialMicroStatus: Z.OPEN },
|
|
1270
|
-
e
|
|
1271
|
-
), this._options.jsBridge = (() => {
|
|
1249
|
+
this._addLiveControllerEventListeners(), this._options = Object.assign({ initialMicroStatus: Z.OPEN }, e), this._options.jsBridge = (() => {
|
|
1272
1250
|
if (e.jsBridge)
|
|
1273
1251
|
return e.jsBridge;
|
|
1274
1252
|
if (e.useBuiltInJsBridge)
|
|
@@ -1277,18 +1255,14 @@ class yr extends ue {
|
|
|
1277
1255
|
if (e.rtc)
|
|
1278
1256
|
return e.rtc;
|
|
1279
1257
|
if (e.rtcType)
|
|
1280
|
-
switch (e.getVoiceSign || O.error(
|
|
1281
|
-
"GetVoiceSign method must be passed when using built-in RTC instances"
|
|
1282
|
-
), e.rtcType) {
|
|
1258
|
+
switch (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), e.rtcType) {
|
|
1283
1259
|
case Q.RealseeVRWebViewRTC: {
|
|
1284
1260
|
if (this._options.jsBridge)
|
|
1285
1261
|
return new nt({
|
|
1286
1262
|
jsBridge: this._options.jsBridge,
|
|
1287
1263
|
getVoiceSign: this._options.getVoiceSign
|
|
1288
1264
|
});
|
|
1289
|
-
O.error(
|
|
1290
|
-
"JsBridge instance must be passed when using built-in VRWebViewRTC instances"
|
|
1291
|
-
);
|
|
1265
|
+
O.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");
|
|
1292
1266
|
return;
|
|
1293
1267
|
}
|
|
1294
1268
|
case Q.RealseeBrowserChimeRTC:
|
|
@@ -1297,9 +1271,7 @@ class yr extends ue {
|
|
|
1297
1271
|
logLevel: e.__debug__ ? st.DEBUG : st.INFO
|
|
1298
1272
|
});
|
|
1299
1273
|
case Q.RealseeBrowserRTC:
|
|
1300
|
-
return this._options.autoPlayConfirm || O.error(
|
|
1301
|
-
"autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"
|
|
1302
|
-
), new rt({
|
|
1274
|
+
return this._options.autoPlayConfirm || O.error("autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"), new rt({
|
|
1303
1275
|
getVoiceSign: this._options.getVoiceSign,
|
|
1304
1276
|
autoPlayConfirm: this._options.autoPlayConfirm
|
|
1305
1277
|
});
|
|
@@ -1309,9 +1281,7 @@ class yr extends ue {
|
|
|
1309
1281
|
}
|
|
1310
1282
|
}
|
|
1311
1283
|
if (e.useBuiltInRTC) {
|
|
1312
|
-
if (e.getVoiceSign || O.error(
|
|
1313
|
-
"GetVoiceSign method must be passed when using built-in RTC instances"
|
|
1314
|
-
), this._options.jsBridge)
|
|
1284
|
+
if (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), this._options.jsBridge)
|
|
1315
1285
|
return lr && (ar || cr) || ur ? new nt({
|
|
1316
1286
|
jsBridge: this._options.jsBridge,
|
|
1317
1287
|
getVoiceSign: this._options.getVoiceSign
|
|
@@ -1321,9 +1291,7 @@ class yr extends ue {
|
|
|
1321
1291
|
getVoiceSign: this._options.getVoiceSign,
|
|
1322
1292
|
autoPlayConfirm: this._options.autoPlayConfirm
|
|
1323
1293
|
});
|
|
1324
|
-
O.error(
|
|
1325
|
-
"jsBridge instance must be passed when using built-in RTC instances"
|
|
1326
|
-
);
|
|
1294
|
+
O.error("jsBridge instance must be passed when using built-in RTC instances");
|
|
1327
1295
|
return;
|
|
1328
1296
|
}
|
|
1329
1297
|
})(), this._options.rtc || O.warn("unused rtc"), this._options.url && this._options.getTicket && this.connect(), this._options.__debug__ && Object.assign(window, { $liveController: this._controller, $live: this });
|
|
@@ -1398,10 +1366,7 @@ class yr extends ue {
|
|
|
1398
1366
|
async updateStatus(e, i, n, c) {
|
|
1399
1367
|
if (this.state !== x.OPEN)
|
|
1400
1368
|
return !1;
|
|
1401
|
-
const u = Object.assign(
|
|
1402
|
-
{ event_type: e, action: i },
|
|
1403
|
-
{ data: n }
|
|
1404
|
-
), d = je(K.BuiltinMsg, u, c);
|
|
1369
|
+
const u = Object.assign({ event_type: e, action: i }, { data: n }), d = je(K.BuiltinMsg, u, c);
|
|
1405
1370
|
try {
|
|
1406
1371
|
return this._controller.sendMessage(d), !0;
|
|
1407
1372
|
} catch (g) {
|
|
@@ -1417,11 +1382,7 @@ class yr extends ue {
|
|
|
1417
1382
|
*/
|
|
1418
1383
|
broadcast(e, i, n) {
|
|
1419
1384
|
return this.state !== x.OPEN ? !1 : new Promise((c, u) => {
|
|
1420
|
-
const d = je(
|
|
1421
|
-
K.CustomEvent,
|
|
1422
|
-
e,
|
|
1423
|
-
i
|
|
1424
|
-
), g = d.front_request_id, v = n ? setTimeout(() => {
|
|
1385
|
+
const d = je(K.CustomEvent, e, i), g = d.front_request_id, v = n ? setTimeout(() => {
|
|
1425
1386
|
u(new Error("RESPONSE TIMEOUT")), this.off("broadcast", E);
|
|
1426
1387
|
}, n) : void 0, E = (y, I) => {
|
|
1427
1388
|
I === g && (v && clearTimeout(v), this.off("broadcast", E), c(y));
|