@realsee/live 0.6.10 → 0.6.12
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 +29 -69
- 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: {
|
|
@@ -1167,14 +1154,13 @@ class yr extends ue {
|
|
|
1167
1154
|
*/
|
|
1168
1155
|
o(this, "exit", async () => {
|
|
1169
1156
|
var e;
|
|
1170
|
-
|
|
1171
|
-
return !0;
|
|
1157
|
+
this._clearLiveData();
|
|
1172
1158
|
try {
|
|
1173
1159
|
await ((e = this.$RTC) == null ? void 0 : e.quit());
|
|
1174
1160
|
} catch (i) {
|
|
1175
1161
|
O.warn(i);
|
|
1176
1162
|
}
|
|
1177
|
-
return await this._controller.close();
|
|
1163
|
+
return this.state !== x.OPEN ? !0 : await this._controller.close();
|
|
1178
1164
|
});
|
|
1179
1165
|
/**
|
|
1180
1166
|
* 关闭带看房间
|
|
@@ -1182,11 +1168,9 @@ class yr extends ue {
|
|
|
1182
1168
|
* @param reason
|
|
1183
1169
|
* @returns
|
|
1184
1170
|
*/
|
|
1185
|
-
o(this, "close", async () =>
|
|
1186
|
-
q.RoomChange,
|
|
1187
|
-
|
|
1188
|
-
{}
|
|
1189
|
-
));
|
|
1171
|
+
o(this, "close", async () => {
|
|
1172
|
+
await this._controller.readyClose(), await this.updateStatus(q.RoomChange, H.RoomClose, {});
|
|
1173
|
+
});
|
|
1190
1174
|
/**
|
|
1191
1175
|
* 销毁带看
|
|
1192
1176
|
* @returns
|
|
@@ -1197,11 +1181,7 @@ class yr extends ue {
|
|
|
1197
1181
|
* @param userInfo
|
|
1198
1182
|
* @returns
|
|
1199
1183
|
*/
|
|
1200
|
-
o(this, "setSelfInfo", async (e) => await this.updateStatus(
|
|
1201
|
-
q.UserChange,
|
|
1202
|
-
H.UserInfo,
|
|
1203
|
-
e
|
|
1204
|
-
));
|
|
1184
|
+
o(this, "setSelfInfo", async (e) => await this.updateStatus(q.UserChange, H.UserInfo, e));
|
|
1205
1185
|
// 仅用于用户自己的麦克风控制
|
|
1206
1186
|
o(this, "toggleMicro", async (e) => {
|
|
1207
1187
|
var n, c, u;
|
|
@@ -1265,10 +1245,7 @@ class yr extends ue {
|
|
|
1265
1245
|
e
|
|
1266
1246
|
);
|
|
1267
1247
|
});
|
|
1268
|
-
this._addLiveControllerEventListeners(), this._options = Object.assign(
|
|
1269
|
-
{ initialMicroStatus: Z.OPEN },
|
|
1270
|
-
e
|
|
1271
|
-
), this._options.jsBridge = (() => {
|
|
1248
|
+
this._addLiveControllerEventListeners(), this._options = Object.assign({ initialMicroStatus: Z.OPEN }, e), this._options.jsBridge = (() => {
|
|
1272
1249
|
if (e.jsBridge)
|
|
1273
1250
|
return e.jsBridge;
|
|
1274
1251
|
if (e.useBuiltInJsBridge)
|
|
@@ -1277,18 +1254,14 @@ class yr extends ue {
|
|
|
1277
1254
|
if (e.rtc)
|
|
1278
1255
|
return e.rtc;
|
|
1279
1256
|
if (e.rtcType)
|
|
1280
|
-
switch (e.getVoiceSign || O.error(
|
|
1281
|
-
"GetVoiceSign method must be passed when using built-in RTC instances"
|
|
1282
|
-
), e.rtcType) {
|
|
1257
|
+
switch (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), e.rtcType) {
|
|
1283
1258
|
case Q.RealseeVRWebViewRTC: {
|
|
1284
1259
|
if (this._options.jsBridge)
|
|
1285
1260
|
return new nt({
|
|
1286
1261
|
jsBridge: this._options.jsBridge,
|
|
1287
1262
|
getVoiceSign: this._options.getVoiceSign
|
|
1288
1263
|
});
|
|
1289
|
-
O.error(
|
|
1290
|
-
"JsBridge instance must be passed when using built-in VRWebViewRTC instances"
|
|
1291
|
-
);
|
|
1264
|
+
O.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");
|
|
1292
1265
|
return;
|
|
1293
1266
|
}
|
|
1294
1267
|
case Q.RealseeBrowserChimeRTC:
|
|
@@ -1297,9 +1270,7 @@ class yr extends ue {
|
|
|
1297
1270
|
logLevel: e.__debug__ ? st.DEBUG : st.INFO
|
|
1298
1271
|
});
|
|
1299
1272
|
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({
|
|
1273
|
+
return this._options.autoPlayConfirm || O.error("autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"), new rt({
|
|
1303
1274
|
getVoiceSign: this._options.getVoiceSign,
|
|
1304
1275
|
autoPlayConfirm: this._options.autoPlayConfirm
|
|
1305
1276
|
});
|
|
@@ -1309,9 +1280,7 @@ class yr extends ue {
|
|
|
1309
1280
|
}
|
|
1310
1281
|
}
|
|
1311
1282
|
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)
|
|
1283
|
+
if (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), this._options.jsBridge)
|
|
1315
1284
|
return lr && (ar || cr) || ur ? new nt({
|
|
1316
1285
|
jsBridge: this._options.jsBridge,
|
|
1317
1286
|
getVoiceSign: this._options.getVoiceSign
|
|
@@ -1321,9 +1290,7 @@ class yr extends ue {
|
|
|
1321
1290
|
getVoiceSign: this._options.getVoiceSign,
|
|
1322
1291
|
autoPlayConfirm: this._options.autoPlayConfirm
|
|
1323
1292
|
});
|
|
1324
|
-
O.error(
|
|
1325
|
-
"jsBridge instance must be passed when using built-in RTC instances"
|
|
1326
|
-
);
|
|
1293
|
+
O.error("jsBridge instance must be passed when using built-in RTC instances");
|
|
1327
1294
|
return;
|
|
1328
1295
|
}
|
|
1329
1296
|
})(), 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 +1365,7 @@ class yr extends ue {
|
|
|
1398
1365
|
async updateStatus(e, i, n, c) {
|
|
1399
1366
|
if (this.state !== x.OPEN)
|
|
1400
1367
|
return !1;
|
|
1401
|
-
const u = Object.assign(
|
|
1402
|
-
{ event_type: e, action: i },
|
|
1403
|
-
{ data: n }
|
|
1404
|
-
), d = je(K.BuiltinMsg, u, c);
|
|
1368
|
+
const u = Object.assign({ event_type: e, action: i }, { data: n }), d = je(K.BuiltinMsg, u, c);
|
|
1405
1369
|
try {
|
|
1406
1370
|
return this._controller.sendMessage(d), !0;
|
|
1407
1371
|
} catch (g) {
|
|
@@ -1417,11 +1381,7 @@ class yr extends ue {
|
|
|
1417
1381
|
*/
|
|
1418
1382
|
broadcast(e, i, n) {
|
|
1419
1383
|
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(() => {
|
|
1384
|
+
const d = je(K.CustomEvent, e, i), g = d.front_request_id, v = n ? setTimeout(() => {
|
|
1425
1385
|
u(new Error("RESPONSE TIMEOUT")), this.off("broadcast", E);
|
|
1426
1386
|
}, n) : void 0, E = (y, I) => {
|
|
1427
1387
|
I === g && (v && clearTimeout(v), this.off("broadcast", E), c(y));
|