@realsee/live 0.6.11 → 0.6.12-alpha.1
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 +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +210 -189
- package/dist/index.es.js.map +1 -1
- package/dist/live/controller.d.ts +1 -0
- package/dist/live/createLiveReact.d.ts +1 -1
- package/dist/live/live.d.ts +18 -1
- package/dist/typings/live/EventType.d.ts +11 -0
- package/dist/utils/RobustWebSocket.d.ts +3 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/VRWebViewRTC.html +13 -13
- package/docs/functions/createLiveReact.html +8 -8
- package/docs/types/EventType.html +1 -1
- package/docs/types/KeyframeTypes.html +1 -1
- package/docs/types/LiveEventType.html +43 -13
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Vt = Object.defineProperty;
|
|
2
|
-
var $t = (r,
|
|
3
|
-
var
|
|
2
|
+
var $t = (r, o, e) => o in r ? Vt(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e;
|
|
3
|
+
var s = (r, o, e) => ($t(r, typeof o != "symbol" ? o + "" : o, e), e);
|
|
4
4
|
import xt from "@realsee/jsbridge-x";
|
|
5
5
|
import Ne from "trtc-js-sdk";
|
|
6
6
|
import { ConsoleLogger as Ut, LogLevel as Ft, DefaultDeviceController as Bt, MeetingSessionConfiguration as Wt, DefaultMeetingSession as Kt, DefaultModality as tt, MeetingSessionStatusCode as qt } from "amazon-chime-sdk-js";
|
|
@@ -17,9 +17,9 @@ class ue {
|
|
|
17
17
|
* 判断是否注册了事件
|
|
18
18
|
* @param name 事件类型
|
|
19
19
|
*/
|
|
20
|
-
hasListener(
|
|
20
|
+
hasListener(o) {
|
|
21
21
|
const e = pe(this);
|
|
22
|
-
return e && e[
|
|
22
|
+
return e && e[o] && e[o].length > 0;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* 注册事件
|
|
@@ -30,9 +30,9 @@ class ue {
|
|
|
30
30
|
* @template K 预设的监听事件名称
|
|
31
31
|
* @template C 回调函数函数上下文
|
|
32
32
|
*/
|
|
33
|
-
on(
|
|
33
|
+
on(o, e, i) {
|
|
34
34
|
const n = pe(this);
|
|
35
|
-
return n[
|
|
35
|
+
return n[o] || (n[o] = []), n[o].push([e, i || !1]), () => this.off(o, e);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* 注册事件(是否只执行一次)
|
|
@@ -42,8 +42,8 @@ class ue {
|
|
|
42
42
|
* @template K 预设的监听事件名称
|
|
43
43
|
* @template C 回调函数函数上下文
|
|
44
44
|
*/
|
|
45
|
-
once(
|
|
46
|
-
return this.on(
|
|
45
|
+
once(o, e) {
|
|
46
|
+
return this.on(o, e, !0);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* 解除事件
|
|
@@ -54,20 +54,20 @@ class ue {
|
|
|
54
54
|
* @param callback 事件回调函数
|
|
55
55
|
* @template K 预设的监听事件名称
|
|
56
56
|
*/
|
|
57
|
-
off(
|
|
58
|
-
if (
|
|
57
|
+
off(o, e) {
|
|
58
|
+
if (o === void 0) {
|
|
59
59
|
Yt(this);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const i = pe(this);
|
|
63
|
-
if (i[
|
|
64
|
-
i[
|
|
63
|
+
if (i[o] || (i[o] = []), e === void 0) {
|
|
64
|
+
i[o].length = 0;
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
let n = 0;
|
|
68
|
-
for (; n < i[
|
|
68
|
+
for (; n < i[o].length && i[o][n][0] !== e; n++)
|
|
69
69
|
;
|
|
70
|
-
n < i[
|
|
70
|
+
n < i[o].length && i[o].splice(n, 1);
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* 触发事件
|
|
@@ -76,12 +76,12 @@ class ue {
|
|
|
76
76
|
* @returns canceled 是否被触发取消
|
|
77
77
|
* @template K 预设的监听事件名称
|
|
78
78
|
*/
|
|
79
|
-
emit(
|
|
79
|
+
emit(o, ...e) {
|
|
80
80
|
let i = !1;
|
|
81
|
-
const c = pe(this)[
|
|
81
|
+
const c = pe(this)[o] || [];
|
|
82
82
|
for (let u of c.slice()) {
|
|
83
83
|
const [d, g = !1] = u, v = d(...e);
|
|
84
|
-
g && this.off(
|
|
84
|
+
g && this.off(o, d), v === !1 && (i = !0);
|
|
85
85
|
}
|
|
86
86
|
return i;
|
|
87
87
|
}
|
|
@@ -90,18 +90,18 @@ class Me extends ue {
|
|
|
90
90
|
}
|
|
91
91
|
var Q = /* @__PURE__ */ ((r) => (r.RealseeBrowserRTC = "RealseeBrowserRTC", r.RealseeVRWebViewRTC = "RealseeVRWebViewRTC", r.RealseeBrowserChimeRTC = "RealseeBrowserChimeRTC", r))(Q || {}), ut = /* @__PURE__ */ ((r) => (r.RealseeXTRTC = "trtc", r.RealseeXChimeRTC = "chime", r))(ut || {});
|
|
92
92
|
const Ht = () => {
|
|
93
|
-
const r = new Date(),
|
|
94
|
-
return `[${
|
|
95
|
-
}, be = (r,
|
|
96
|
-
switch (
|
|
93
|
+
const r = new Date(), o = r.getFullYear(), e = (r.getMonth() + 1).toString().padStart(2, "0"), i = r.getDate().toString().padStart(2, "0"), n = r.getHours().toString().padStart(2, "0"), c = r.getMinutes().toString().padStart(2, "0"), u = r.getSeconds().toString().padStart(2, "0"), d = r.getMilliseconds();
|
|
94
|
+
return `[${o}-${e}-${i} ${n}:${c}:${u}.${d}]`;
|
|
95
|
+
}, be = (r, o = []) => {
|
|
96
|
+
switch (o.unshift(`Realsee Live ${Ht()} <${r}> `), r) {
|
|
97
97
|
case "INFO":
|
|
98
|
-
return console.info(...
|
|
98
|
+
return console.info(...o);
|
|
99
99
|
case "ERROR":
|
|
100
|
-
return console.error(...
|
|
100
|
+
return console.error(...o);
|
|
101
101
|
case "WARN":
|
|
102
|
-
return console.warn(...
|
|
102
|
+
return console.warn(...o);
|
|
103
103
|
default:
|
|
104
|
-
return console.log(...
|
|
104
|
+
return console.log(...o);
|
|
105
105
|
}
|
|
106
106
|
}, Jt = (...r) => be("LOG", r), zt = (...r) => be("INFO", r), Xt = (...r) => be("ERROR", r), Zt = (...r) => be("WARN", r), Qt = {
|
|
107
107
|
log: Jt,
|
|
@@ -118,21 +118,21 @@ function Ee() {
|
|
|
118
118
|
class rt extends Me {
|
|
119
119
|
constructor(e) {
|
|
120
120
|
super();
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
s(this, "type", Q.RealseeBrowserRTC);
|
|
122
|
+
s(this, "joined", !1);
|
|
123
|
+
s(this, "micro", !1);
|
|
124
|
+
s(this, "voiceId", "");
|
|
125
|
+
s(this, "_getVoiceSign", () => {
|
|
126
126
|
throw new Error("方法 getVoiceSign 未实现");
|
|
127
127
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
s(this, "_autoPlayConfirm");
|
|
129
|
+
s(this, "checkRequirement", () => Ne.checkSystemRequirements());
|
|
130
|
+
s(this, "$dom", document.createElement("div"));
|
|
131
|
+
s(this, "_trtc", {
|
|
132
132
|
client: null,
|
|
133
133
|
stream: null
|
|
134
134
|
});
|
|
135
|
-
|
|
135
|
+
s(this, "join", async (e) => {
|
|
136
136
|
var c;
|
|
137
137
|
this.emit("joinWillStart");
|
|
138
138
|
const i = await this._getVoiceSign({
|
|
@@ -161,12 +161,12 @@ class rt extends Me {
|
|
|
161
161
|
(d = this._trtc.client) == null || d.publish(this._trtc.stream).then(() => u(!0)).catch(() => u(!1));
|
|
162
162
|
}), this.joined = n, this.joined && this.emit("joined"), n) : !1;
|
|
163
163
|
});
|
|
164
|
-
|
|
164
|
+
s(this, "_handleStreamAdded", (e) => {
|
|
165
165
|
var n;
|
|
166
166
|
const i = e.stream;
|
|
167
167
|
console.log("远端流增加: " + i.getId()), (n = this._trtc.client) == null || n.subscribe(i);
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
s(this, "_handleStreamSubscribed", (e) => {
|
|
170
170
|
const i = e.stream;
|
|
171
171
|
console.log("远端流订阅成功:" + i.getId());
|
|
172
172
|
const c = `rs-rtc-remote_stream-${i.getId()}`, u = document.createElement("div");
|
|
@@ -227,35 +227,35 @@ class rt extends Me {
|
|
|
227
227
|
class it extends Me {
|
|
228
228
|
constructor(e) {
|
|
229
229
|
super();
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
230
|
+
s(this, "type", Q.RealseeBrowserChimeRTC);
|
|
231
|
+
s(this, "joined", !1);
|
|
232
|
+
s(this, "micro", !1);
|
|
233
|
+
s(this, "voiceId", "");
|
|
234
|
+
s(this, "userId", "");
|
|
235
|
+
s(this, "logger");
|
|
236
|
+
s(this, "deviceController");
|
|
237
|
+
s(this, "meetingSession");
|
|
238
|
+
s(this, "audioInput");
|
|
239
|
+
s(this, "audioOutput");
|
|
240
|
+
s(this, "deviceChangeObserver", {});
|
|
241
|
+
s(this, "audioVideoObserver", {});
|
|
242
|
+
s(this, "audioMixObserver");
|
|
243
|
+
s(this, "_getVoiceSign", () => {
|
|
244
244
|
throw new Error("方法 getVoiceSign 未实现");
|
|
245
245
|
});
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
s(this, "_autoPlayConfirm");
|
|
247
|
+
s(this, "$dom", document.createElement("div"));
|
|
248
|
+
s(this, "$audio", document.createElement("audio"));
|
|
249
249
|
/**
|
|
250
250
|
* 对audio标签初始化
|
|
251
251
|
*/
|
|
252
|
-
|
|
252
|
+
s(this, "_initDom", () => {
|
|
253
253
|
this.$audio.id = `rs-rtc-${Ee()}`, this.$dom.id = `rs-rtc-${Ee()}`, this.$dom.appendChild(this.$audio), document.body.appendChild(this.$dom);
|
|
254
254
|
});
|
|
255
255
|
/**
|
|
256
256
|
* 初始化事件监听器
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
s(this, "initObservers", () => {
|
|
259
259
|
this.deviceChangeObserver = {
|
|
260
260
|
audioInputsChanged: (e) => {
|
|
261
261
|
this.logger.info(`audioInputsChanged ${typeof e}`), e == null || e.forEach((i) => {
|
|
@@ -303,7 +303,7 @@ class it extends Me {
|
|
|
303
303
|
/**
|
|
304
304
|
* 注册rtc事件
|
|
305
305
|
*/
|
|
306
|
-
|
|
306
|
+
s(this, "_registerRtcEvent", () => {
|
|
307
307
|
var i, n, c, u, d, g;
|
|
308
308
|
const e = ((c = (n = (i = this.meetingSession) == null ? void 0 : i.configuration) == null ? void 0 : n.credentials) == null ? void 0 : c.attendeeId) || "";
|
|
309
309
|
if (e) {
|
|
@@ -447,11 +447,11 @@ var lt = /* @__PURE__ */ ((r) => (r[r.Success = 0] = "Success", r[r.Failure = 1]
|
|
|
447
447
|
class nt extends Me {
|
|
448
448
|
constructor({ jsBridge: e, getVoiceSign: i }) {
|
|
449
449
|
super();
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
450
|
+
s(this, "type", Q.RealseeVRWebViewRTC);
|
|
451
|
+
s(this, "joined", !1);
|
|
452
|
+
s(this, "micro", !1);
|
|
453
|
+
s(this, "voiceId", "");
|
|
454
|
+
s(this, "options");
|
|
455
455
|
this.options = { jsBridge: e, getVoiceSign: i }, this.jsBridge.webViewType !== "WxMiniProgramWebView" && this.jsBridge.callAndListen("live/userVolumes", (n) => {
|
|
456
456
|
this.emit("userVolumes", n);
|
|
457
457
|
}), this.jsBridge.callAndListen("live/weakNetwork", (n) => {
|
|
@@ -471,7 +471,7 @@ class nt extends Me {
|
|
|
471
471
|
const [u, d] = await this.jsBridge.callAndBackfeed(
|
|
472
472
|
`live/join?sdkAppID=${i}&userID=${n}&roomID=${Number(e.voiceId)}&userSig=${c}`
|
|
473
473
|
);
|
|
474
|
-
return u === !0 ? (this.emit("joined"), this.joined = !0) : u ? u.code === lt.Success ? (this.emit("joined"), this.joined = !0) : (this.emit("error", u), this.joined = !1) : (this.emit("error", d || new Error("加入房间失败:未知异常。")), this.joined = !1), this.joined;
|
|
474
|
+
return O.info(`加入语音房间回调结果: ${JSON.stringify(u)}`), d && O.error("加入语音房间回调报错:", d), u === !0 ? (this.emit("joined"), this.joined = !0) : u ? u.code === lt.Success ? (this.emit("joined"), this.joined = !0) : (this.emit("error", u), this.joined = !1) : (this.emit("error", d || new Error("加入房间失败:未知异常。")), this.joined = !1), this.joined;
|
|
475
475
|
} catch (i) {
|
|
476
476
|
return this.emit("error", new Error("加入房间失败:" + i.message)), this.joined = !1, this.joined;
|
|
477
477
|
}
|
|
@@ -495,21 +495,21 @@ class nt extends Me {
|
|
|
495
495
|
var K = /* @__PURE__ */ ((r) => (r.SelfUserInfo = "SELF_USER_INFO", r.RoomInfo = "ROOM_INFO", r.RTCInfo = "RTC_INFO", r.UserList = "USER_LIST", r.BuiltinMsg = "BUILTIN_MSG", r.CustomEvent = "CUSTOM_EVENT", r.KeyframeSync = "KEYFRAME_SYNC", r.UserKickOut = "USER_KICK_OUT", r))(K || {}), q = /* @__PURE__ */ ((r) => (r.UserChange = "user_change", r.RoomChange = "room_change", r))(q || {}), H = /* @__PURE__ */ ((r) => (r.UserMicroStatus = "change_micro_status", r.UserMicroStatusSync = "sync_micro_status", r.UserPermission = "change_permission", r.UserStatus = "change_status", r.UserInfo = "change_info", r.RoomClose = "close", r))(H || {}), Z = /* @__PURE__ */ ((r) => (r.OPEN = "OPEN", r.CLOSE = "CLOSE", r))(Z || {});
|
|
496
496
|
function Nr(r) {
|
|
497
497
|
try {
|
|
498
|
-
const
|
|
499
|
-
code:
|
|
500
|
-
message:
|
|
501
|
-
command:
|
|
502
|
-
roomCode:
|
|
503
|
-
appID:
|
|
504
|
-
requestId:
|
|
505
|
-
frontRequestId:
|
|
506
|
-
triggerUserID:
|
|
507
|
-
data:
|
|
498
|
+
const o = JSON.parse(r), e = {
|
|
499
|
+
code: o.code,
|
|
500
|
+
message: o.message,
|
|
501
|
+
command: o.command,
|
|
502
|
+
roomCode: o.room_code,
|
|
503
|
+
appID: o.app_id,
|
|
504
|
+
requestId: o.request_id,
|
|
505
|
+
frontRequestId: o.front_request_id,
|
|
506
|
+
triggerUserID: o.trigger_user_id,
|
|
507
|
+
data: o.data || {}
|
|
508
508
|
}, i = Object.keys(e).filter(
|
|
509
509
|
(n) => e[n] === void 0
|
|
510
510
|
);
|
|
511
511
|
return i.length > 0 && console.warn(`推送数据格式异常:${i.join(" ")} 值不存在!`), e;
|
|
512
|
-
} catch (
|
|
512
|
+
} catch (o) {
|
|
513
513
|
return !1;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
@@ -541,15 +541,15 @@ function sr(r) {
|
|
|
541
541
|
var ft = {};
|
|
542
542
|
(function(r) {
|
|
543
543
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.LogLevel = void 0;
|
|
544
|
-
var
|
|
544
|
+
var o;
|
|
545
545
|
(function(e) {
|
|
546
546
|
e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.OFF = 4] = "OFF";
|
|
547
|
-
})(
|
|
547
|
+
})(o = r.LogLevel || (r.LogLevel = {})), r.default = o;
|
|
548
548
|
})(ft);
|
|
549
549
|
const st = /* @__PURE__ */ sr(ft);
|
|
550
|
-
function or(r,
|
|
551
|
-
const e = r.indexOf("?") !== -1, i = Object.keys(
|
|
552
|
-
(n, c, u) => `${n}${u === 0 && !e ? "?" : "&"}${c}=${
|
|
550
|
+
function or(r, o = {}) {
|
|
551
|
+
const e = r.indexOf("?") !== -1, i = Object.keys(o).reduce(
|
|
552
|
+
(n, c, u) => `${n}${u === 0 && !e ? "?" : "&"}${c}=${o[c]}`,
|
|
553
553
|
""
|
|
554
554
|
);
|
|
555
555
|
return r + i;
|
|
@@ -558,64 +558,64 @@ const le = globalThis.navigator.userAgent, ar = /android/gi.test(le), cr = /iPho
|
|
|
558
558
|
function ye(r) {
|
|
559
559
|
return Object.prototype.toString.call(r) === "[object Object]";
|
|
560
560
|
}
|
|
561
|
-
function Se(r,
|
|
562
|
-
return r ===
|
|
561
|
+
function Se(r, o) {
|
|
562
|
+
return r === o ? !0 : typeof r != typeof o ? !1 : !!(Number.isNaN(r) && Number.isNaN(o));
|
|
563
563
|
}
|
|
564
|
-
function fr(r,
|
|
565
|
-
const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(
|
|
564
|
+
function fr(r, o) {
|
|
565
|
+
const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(o);
|
|
566
566
|
if (e.length !== i.length)
|
|
567
567
|
return !1;
|
|
568
568
|
for (let n = 0, c = e.length; n < c; n++) {
|
|
569
569
|
const u = e[n];
|
|
570
|
-
if (!Se(r[u],
|
|
570
|
+
if (!Se(r[u], o[u]))
|
|
571
571
|
return !1;
|
|
572
572
|
}
|
|
573
573
|
return !0;
|
|
574
574
|
}
|
|
575
|
-
function dr(r,
|
|
576
|
-
if (r.length !==
|
|
575
|
+
function dr(r, o) {
|
|
576
|
+
if (r.length !== o.length)
|
|
577
577
|
return !1;
|
|
578
578
|
for (let e = 0, i = r.length; e < i; e++)
|
|
579
|
-
if (!Se(r[e],
|
|
579
|
+
if (!Se(r[e], o[e]))
|
|
580
580
|
return !1;
|
|
581
581
|
return !0;
|
|
582
582
|
}
|
|
583
|
-
function hr(r,
|
|
584
|
-
return Se(r,
|
|
583
|
+
function hr(r, o) {
|
|
584
|
+
return Se(r, o) ? !0 : ye(r) && ye(o) ? fr(r, o) : Array.isArray(r) && Array.isArray(o) ? dr(r, o) : !1;
|
|
585
585
|
}
|
|
586
|
-
function De(r,
|
|
587
|
-
return Se(r,
|
|
586
|
+
function De(r, o) {
|
|
587
|
+
return Se(r, o) ? !0 : ye(r) && ye(o) ? gr(r, o) : Array.isArray(r) && Array.isArray(o) ? _r(r, o) : !1;
|
|
588
588
|
}
|
|
589
|
-
function _r(r,
|
|
590
|
-
if (r.length !==
|
|
589
|
+
function _r(r, o) {
|
|
590
|
+
if (r.length !== o.length)
|
|
591
591
|
return !1;
|
|
592
592
|
for (let e = 0, i = r.length; e < i; e++)
|
|
593
|
-
if (!De(r[e],
|
|
593
|
+
if (!De(r[e], o[e]))
|
|
594
594
|
return !1;
|
|
595
595
|
return !0;
|
|
596
596
|
}
|
|
597
|
-
function gr(r,
|
|
598
|
-
const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(
|
|
597
|
+
function gr(r, o) {
|
|
598
|
+
const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(o);
|
|
599
599
|
if (e.length !== i.length)
|
|
600
600
|
return !1;
|
|
601
601
|
for (let n = 0, c = e.length; n < c; n++) {
|
|
602
602
|
const u = e[n];
|
|
603
|
-
if (!De(r[u],
|
|
603
|
+
if (!De(r[u], o[u]))
|
|
604
604
|
return !1;
|
|
605
605
|
}
|
|
606
606
|
return !0;
|
|
607
607
|
}
|
|
608
|
-
function ot(r,
|
|
609
|
-
return e.deep ? De(r,
|
|
608
|
+
function ot(r, o, e = { deep: !1 }) {
|
|
609
|
+
return e.deep ? De(r, o) : hr(r, o);
|
|
610
610
|
}
|
|
611
611
|
class mr extends ue {
|
|
612
612
|
constructor(e) {
|
|
613
613
|
super();
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
614
|
+
s(this, "_realWebSocket");
|
|
615
|
+
s(this, "_url");
|
|
616
|
+
s(this, "_protocols");
|
|
617
|
+
s(this, "_readyState", Le.NOTINITIALIZED);
|
|
618
|
+
s(this, "_options", {
|
|
619
619
|
timeout: 1e4,
|
|
620
620
|
shouldReconnect: (e, i) => {
|
|
621
621
|
if (!(e.code === 1008 || e.code === 1011))
|
|
@@ -625,74 +625,74 @@ class mr extends ue {
|
|
|
625
625
|
ignoreConnectivityEvents: !1,
|
|
626
626
|
automaticOpen: !1
|
|
627
627
|
});
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
628
|
+
s(this, "_connectTimeout");
|
|
629
|
+
s(this, "_attempts", 0);
|
|
630
|
+
s(this, "_reconnects", -1);
|
|
631
|
+
s(this, "_reconnectWhenOnlineAgain", !1);
|
|
632
|
+
s(this, "_explicitlyClosed", !1);
|
|
633
|
+
s(this, "_pendingReconnect");
|
|
634
|
+
s(this, "_connectivityEventsAttached", !1);
|
|
635
|
+
s(this, "_heathCheckTimer");
|
|
636
636
|
/**
|
|
637
637
|
* 做一个健康检查
|
|
638
638
|
*/
|
|
639
|
-
|
|
639
|
+
s(this, "_healthCheck", async () => {
|
|
640
640
|
this._realWebSocket && this._realWebSocket.readyState !== this._readyState && (this._readyState = this._realWebSocket.readyState, this._readyState === Le.CLOSING && this.emit("closing")), await new Promise((e) => setTimeout(e, 2e3)), this._heathCheckTimer = requestAnimationFrame(this._healthCheck);
|
|
641
641
|
});
|
|
642
642
|
/**
|
|
643
643
|
* 清理超时计时器
|
|
644
644
|
*/
|
|
645
|
-
|
|
645
|
+
s(this, "_clearConnectTimeoutIfNeed", () => {
|
|
646
646
|
this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
|
|
647
647
|
});
|
|
648
648
|
/**
|
|
649
649
|
* 清理健康检查
|
|
650
650
|
*/
|
|
651
|
-
|
|
651
|
+
s(this, "_clearHeathCheckIfNeed", () => {
|
|
652
652
|
this._heathCheckTimer && (cancelAnimationFrame(this._heathCheckTimer), this._heathCheckTimer = void 0);
|
|
653
653
|
});
|
|
654
654
|
/**
|
|
655
655
|
* 开启健康检查
|
|
656
656
|
*/
|
|
657
|
-
|
|
657
|
+
s(this, "_startHealthCheck", () => {
|
|
658
658
|
this._clearHeathCheckIfNeed(), this._heathCheckTimer = requestAnimationFrame(this._healthCheck);
|
|
659
659
|
});
|
|
660
660
|
/**
|
|
661
661
|
* 停止健康检查
|
|
662
662
|
*/
|
|
663
|
-
|
|
663
|
+
s(this, "_stopHealthCheck", () => {
|
|
664
664
|
this._clearHeathCheckIfNeed();
|
|
665
665
|
});
|
|
666
666
|
/**
|
|
667
667
|
* 清理连接中的请求
|
|
668
668
|
*/
|
|
669
|
-
|
|
669
|
+
s(this, "_clearPendingReconnectIfNeeded", () => {
|
|
670
670
|
this._pendingReconnect && (clearTimeout(this._pendingReconnect), this._pendingReconnect = void 0);
|
|
671
671
|
});
|
|
672
672
|
/**
|
|
673
673
|
* 当网页连接上网络进行重连
|
|
674
674
|
* @param event
|
|
675
675
|
*/
|
|
676
|
-
|
|
676
|
+
s(this, "_online", (e) => {
|
|
677
677
|
this._reconnectWhenOnlineAgain && (this._clearPendingReconnectIfNeeded(), this._reconnect(e));
|
|
678
678
|
});
|
|
679
679
|
/**
|
|
680
680
|
* 当网页断开网络进行关闭
|
|
681
681
|
*/
|
|
682
|
-
|
|
682
|
+
s(this, "_offline", () => {
|
|
683
683
|
var e;
|
|
684
684
|
this._reconnectWhenOnlineAgain = !0, (e = this._realWebSocket) == null || e.close(1e3, "offline");
|
|
685
685
|
});
|
|
686
686
|
/**
|
|
687
687
|
* 解除网络监听事件
|
|
688
688
|
*/
|
|
689
|
-
|
|
689
|
+
s(this, "_detachConnectivityEvents", () => {
|
|
690
690
|
this._connectivityEventsAttached && (globalThis == null || globalThis.removeEventListener("online", this._online), globalThis == null || globalThis.removeEventListener("offline", this._offline), this._connectivityEventsAttached = !1);
|
|
691
691
|
});
|
|
692
692
|
/**
|
|
693
693
|
* 注册网络监听事件
|
|
694
694
|
*/
|
|
695
|
-
|
|
695
|
+
s(this, "_attachConnectivityEvents", () => {
|
|
696
696
|
this._connectivityEventsAttached || (globalThis == null || globalThis.addEventListener("online", this._online), globalThis == null || globalThis.addEventListener("offline", this._offline), this._connectivityEventsAttached = !0);
|
|
697
697
|
});
|
|
698
698
|
/**
|
|
@@ -700,7 +700,7 @@ class mr extends ue {
|
|
|
700
700
|
* @param data
|
|
701
701
|
* @returns
|
|
702
702
|
*/
|
|
703
|
-
|
|
703
|
+
s(this, "send", (e) => {
|
|
704
704
|
var i, n, c;
|
|
705
705
|
((i = this._realWebSocket) == null ? void 0 : i.readyState) === ((n = this._realWebSocket) == null ? void 0 : n.OPEN) && ((c = this._realWebSocket) == null || c.send(e));
|
|
706
706
|
});
|
|
@@ -710,21 +710,21 @@ class mr extends ue {
|
|
|
710
710
|
* @param reason 原因
|
|
711
711
|
* @returns
|
|
712
712
|
*/
|
|
713
|
-
|
|
713
|
+
s(this, "close", (e, i) => {
|
|
714
714
|
var n;
|
|
715
715
|
return typeof e != "number" && (i = e, e = 1e3), this._clearPendingReconnectIfNeeded(), this._reconnectWhenOnlineAgain = !1, this._explicitlyClosed = !0, this._detachConnectivityEvents(), (n = this._realWebSocket) == null ? void 0 : n.close(e, i);
|
|
716
716
|
});
|
|
717
717
|
/**
|
|
718
718
|
* 进行ws连接
|
|
719
719
|
*/
|
|
720
|
-
|
|
720
|
+
s(this, "open", (e) => {
|
|
721
721
|
var i, n;
|
|
722
722
|
e && (this._url = e), ((i = this._realWebSocket) == null ? void 0 : i.readyState) !== WebSocket.OPEN && ((n = this._realWebSocket) == null ? void 0 : n.readyState) !== WebSocket.CONNECTING && (this._clearPendingReconnectIfNeeded(), this._reconnectWhenOnlineAgain = !1, this._explicitlyClosed = !1, this._createWebSocket());
|
|
723
723
|
});
|
|
724
724
|
/**
|
|
725
725
|
* 创建ws连接
|
|
726
726
|
*/
|
|
727
|
-
|
|
727
|
+
s(this, "_createWebSocket", () => {
|
|
728
728
|
var n, c, u;
|
|
729
729
|
const e = typeof this._url == "string" ? this._url : (n = this._url) == null ? void 0 : n.call(this, this);
|
|
730
730
|
if (!e)
|
|
@@ -751,14 +751,14 @@ class mr extends ue {
|
|
|
751
751
|
/**
|
|
752
752
|
* 断开ws事件
|
|
753
753
|
*/
|
|
754
|
-
|
|
754
|
+
s(this, "_removeWebSocketEvent", () => {
|
|
755
755
|
var e, i, n, c;
|
|
756
756
|
(e = this._realWebSocket) == null || e.removeEventListener("open", this._webSocketOpenHandler), (i = this._realWebSocket) == null || i.removeEventListener("close", this._webSocketCloseHandler), (n = this._realWebSocket) == null || n.removeEventListener("error", this._webSocketErrorHandler), (c = this._realWebSocket) == null || c.removeEventListener("message", this._webSocketMessageHandler);
|
|
757
757
|
});
|
|
758
758
|
/**
|
|
759
759
|
* 分发ws事件
|
|
760
760
|
*/
|
|
761
|
-
|
|
761
|
+
s(this, "_dispatchWebSocketEvent", () => {
|
|
762
762
|
var e, i, n, c;
|
|
763
763
|
(e = this._realWebSocket) == null || e.addEventListener("open", this._webSocketOpenHandler), (i = this._realWebSocket) == null || i.addEventListener("close", this._webSocketCloseHandler), (n = this._realWebSocket) == null || n.addEventListener("error", this._webSocketErrorHandler), (c = this._realWebSocket) == null || c.addEventListener("message", this._webSocketMessageHandler);
|
|
764
764
|
});
|
|
@@ -766,7 +766,7 @@ class mr extends ue {
|
|
|
766
766
|
* ws连接事件
|
|
767
767
|
* @returns
|
|
768
768
|
*/
|
|
769
|
-
|
|
769
|
+
s(this, "_webSocketOpenHandler", (e) => {
|
|
770
770
|
this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
|
|
771
771
|
const i = ++this._reconnects, n = this._attempts;
|
|
772
772
|
return this._attempts = 0, this._reconnectWhenOnlineAgain = !1, this._startHealthCheck(), this.emit("open", Object.assign(e, { detail: { reconnects: i, attempts: n } }));
|
|
@@ -776,19 +776,19 @@ class mr extends ue {
|
|
|
776
776
|
* @param event
|
|
777
777
|
* @returns
|
|
778
778
|
*/
|
|
779
|
-
|
|
779
|
+
s(this, "_webSocketCloseHandler", (e) => (this._reconnect(e), this._stopHealthCheck(), this.emit("close", e)));
|
|
780
780
|
/**
|
|
781
781
|
* ws 异常
|
|
782
782
|
* @param event
|
|
783
783
|
* @returns
|
|
784
784
|
*/
|
|
785
|
-
|
|
785
|
+
s(this, "_webSocketErrorHandler", (e) => this.emit("error", new CustomEvent("error", { detail: { error: e } })));
|
|
786
786
|
/**
|
|
787
787
|
* ws消息
|
|
788
788
|
* @param event
|
|
789
789
|
* @returns
|
|
790
790
|
*/
|
|
791
|
-
|
|
791
|
+
s(this, "_webSocketMessageHandler", (e) => this.emit("message", e));
|
|
792
792
|
e && this.setOptions(e), this._startHealthCheck();
|
|
793
793
|
}
|
|
794
794
|
get attempts() {
|
|
@@ -832,39 +832,37 @@ class vr extends ue {
|
|
|
832
832
|
/**
|
|
833
833
|
* ws代理器
|
|
834
834
|
*/
|
|
835
|
-
|
|
835
|
+
s(this, "_ws", new mr({
|
|
836
836
|
url: "",
|
|
837
837
|
robustOptions: { should1000Reconnect: !0, ignoreConnectivityEvents: !0 }
|
|
838
838
|
}));
|
|
839
839
|
/**
|
|
840
840
|
* 带看连接状态
|
|
841
841
|
*/
|
|
842
|
-
|
|
842
|
+
s(this, "_state", x.NOTINITIALIZED);
|
|
843
843
|
/**
|
|
844
844
|
* 添加事件监听
|
|
845
845
|
*/
|
|
846
|
-
|
|
846
|
+
s(this, "_addWebSocketEventListeners", () => {
|
|
847
847
|
this._ws.on("close", this._handleCloseEvent), this._ws.on("closing", this._handleClosingEvent), this._ws.on("connecting", this._handleConnectingEvent), this._ws.on("error", this._handleErrorEvent), this._ws.on("message", this._handleMessageEvent), this._ws.on("open", this._handleOpenEvent), this._ws.on("timeout", this._handleTimeoutEvent);
|
|
848
848
|
});
|
|
849
849
|
/**
|
|
850
850
|
* 移除事件监听
|
|
851
851
|
*/
|
|
852
|
-
|
|
852
|
+
s(this, "_removeWebSocketEventListeners", () => {
|
|
853
853
|
this._ws.off("close", this._handleCloseEvent), this._ws.off("closing", this._handleClosingEvent), this._ws.off("connecting", this._handleConnectingEvent), this._ws.off("error", this._handleErrorEvent), this._ws.off("message", this._handleMessageEvent), this._ws.off("open", this._handleOpenEvent), this._ws.off("timeout", this._handleTimeoutEvent);
|
|
854
854
|
});
|
|
855
855
|
/**
|
|
856
856
|
* 处理房间关闭事件
|
|
857
857
|
* @param event
|
|
858
858
|
*/
|
|
859
|
-
|
|
860
|
-
O.info(
|
|
861
|
-
`live room closed bacause of ${e.code}-${e.reason || nr(e.code)}`
|
|
862
|
-
), this.state = x.CLOSED;
|
|
859
|
+
s(this, "_handleCloseEvent", (e) => {
|
|
860
|
+
O.info(`live room closed bacause of ${e.code}-${e.reason || nr(e.code)}`), this.state = x.CLOSED;
|
|
863
861
|
});
|
|
864
862
|
/**
|
|
865
863
|
* 处理房间正在关闭事件(这个时候可能是断网了)
|
|
866
864
|
*/
|
|
867
|
-
|
|
865
|
+
s(this, "_handleClosingEvent", () => {
|
|
868
866
|
var e;
|
|
869
867
|
O.info("live room is closing, onLine:", (e = globalThis == null ? void 0 : globalThis.navigator) == null ? void 0 : e.onLine), this.state = x.CLOSED;
|
|
870
868
|
});
|
|
@@ -872,21 +870,21 @@ class vr extends ue {
|
|
|
872
870
|
* 连接中
|
|
873
871
|
* @param event
|
|
874
872
|
*/
|
|
875
|
-
|
|
876
|
-
O.info("live room is connecting"), this.state = x.CONNECTING;
|
|
873
|
+
s(this, "_handleConnectingEvent", (e) => {
|
|
874
|
+
O.info("live room is connecting"), this.state = x.CONNECTING, e.detail.reconnects > 0 && this.emit("reconnecting", e.detail);
|
|
877
875
|
});
|
|
878
876
|
/**
|
|
879
877
|
* 连接发送异常
|
|
880
878
|
* @param event
|
|
881
879
|
*/
|
|
882
|
-
|
|
880
|
+
s(this, "_handleErrorEvent", (e) => {
|
|
883
881
|
O.error("live room error", e), this.state = x.CLOSED;
|
|
884
882
|
});
|
|
885
883
|
/**
|
|
886
884
|
* 接收到消息
|
|
887
885
|
* @param event
|
|
888
886
|
*/
|
|
889
|
-
|
|
887
|
+
s(this, "_handleMessageEvent", (e) => {
|
|
890
888
|
let i = (() => {
|
|
891
889
|
try {
|
|
892
890
|
return JSON.parse(e.data);
|
|
@@ -900,33 +898,33 @@ class vr extends ue {
|
|
|
900
898
|
* 连接建立成功
|
|
901
899
|
* @param event
|
|
902
900
|
*/
|
|
903
|
-
|
|
901
|
+
s(this, "_handleOpenEvent", (e) => {
|
|
904
902
|
O.info("live room open", e.detail), this.state = x.OPEN, e.detail.reconnects > 0 && this.emit("reconnected", e.detail);
|
|
905
903
|
});
|
|
906
904
|
/**
|
|
907
905
|
* 处理超时
|
|
908
906
|
* @param event
|
|
909
907
|
*/
|
|
910
|
-
|
|
908
|
+
s(this, "_handleTimeoutEvent", (e) => {
|
|
911
909
|
O.error("live room connect timeout!", e.detail), this.state = x.CLOSED;
|
|
912
910
|
});
|
|
913
911
|
/**
|
|
914
912
|
* 释放资源,释放之后需要重新实例化
|
|
915
913
|
* @returns
|
|
916
914
|
*/
|
|
917
|
-
|
|
915
|
+
s(this, "dispose", async () => (this._removeWebSocketEventListeners(), await this.close("live room close by controller disposed!")));
|
|
918
916
|
/**
|
|
919
917
|
* 开启房间链接
|
|
920
918
|
* @param url 房间链接
|
|
921
919
|
* @returns
|
|
922
920
|
*/
|
|
923
|
-
|
|
921
|
+
s(this, "open", (e) => this._ws.open(e));
|
|
924
922
|
/**
|
|
925
923
|
* 关闭房间
|
|
926
924
|
* @param code
|
|
927
925
|
* @param reason
|
|
928
926
|
*/
|
|
929
|
-
|
|
927
|
+
s(this, "close", (e, i) => new Promise((n) => {
|
|
930
928
|
this._ws.once("close", () => n(!0)), this._ws.close(e, i);
|
|
931
929
|
}));
|
|
932
930
|
this._addWebSocketEventListeners();
|
|
@@ -956,16 +954,16 @@ class vr extends ue {
|
|
|
956
954
|
this._ws && (this._ws._explicitlyClosed = !0);
|
|
957
955
|
}
|
|
958
956
|
}
|
|
959
|
-
const pr = (r) => Promise.reject("unimplemented method GetVoiceSign"), je = (r,
|
|
957
|
+
const pr = (r) => Promise.reject("unimplemented method GetVoiceSign"), je = (r, o = {}, e = []) => ({
|
|
960
958
|
command: r,
|
|
961
959
|
front_request_id: Ee(),
|
|
962
960
|
data: {
|
|
963
|
-
...
|
|
961
|
+
...o,
|
|
964
962
|
to_user_ids: Array.isArray(e) ? e : [e]
|
|
965
963
|
}
|
|
966
964
|
}), Er = () => {
|
|
967
|
-
var r,
|
|
968
|
-
window != null && window.__Realsee_Live__ && ((
|
|
965
|
+
var r, o;
|
|
966
|
+
window != null && window.__Realsee_Live__ && ((o = (r = window == null ? void 0 : window.__Realsee_Live__) == null ? void 0 : r.dispose) == null || o.call(r), window.__Realsee_Live__ = null);
|
|
969
967
|
};
|
|
970
968
|
class yr extends ue {
|
|
971
969
|
constructor(e) {
|
|
@@ -974,15 +972,15 @@ class yr extends ue {
|
|
|
974
972
|
/**
|
|
975
973
|
* 带看的配置
|
|
976
974
|
*/
|
|
977
|
-
|
|
975
|
+
s(this, "_options", {});
|
|
978
976
|
/**
|
|
979
977
|
* 帧数据监听
|
|
980
978
|
*/
|
|
981
|
-
|
|
979
|
+
s(this, "keyframes", new ue());
|
|
982
980
|
/**
|
|
983
981
|
* 内置的一些数据
|
|
984
982
|
*/
|
|
985
|
-
|
|
983
|
+
s(this, "_buildInData", {
|
|
986
984
|
keyframes: {}
|
|
987
985
|
});
|
|
988
986
|
/**
|
|
@@ -990,14 +988,14 @@ class yr extends ue {
|
|
|
990
988
|
* @param key 帧数据的键值
|
|
991
989
|
* @returns
|
|
992
990
|
*/
|
|
993
|
-
|
|
991
|
+
s(this, "getFramesByKey", (e) => this.snapshot[e]);
|
|
994
992
|
/**
|
|
995
993
|
* 发送帧数据(需要能够被序列化)
|
|
996
994
|
* @param key 帧数据键值
|
|
997
995
|
* @param frame 帧数据本体
|
|
998
996
|
* @returns
|
|
999
997
|
*/
|
|
1000
|
-
|
|
998
|
+
s(this, "sendKeyframe", (e, i) => {
|
|
1001
999
|
if (this.state !== x.OPEN)
|
|
1002
1000
|
return !1;
|
|
1003
1001
|
this._buildInData.keyframes = {
|
|
@@ -1014,30 +1012,42 @@ class yr extends ue {
|
|
|
1014
1012
|
/**
|
|
1015
1013
|
* 带看控制器
|
|
1016
1014
|
*/
|
|
1017
|
-
|
|
1015
|
+
s(this, "_controller", new vr());
|
|
1018
1016
|
/**
|
|
1019
1017
|
* 添加带看控制的事件监听
|
|
1020
1018
|
*/
|
|
1021
|
-
|
|
1022
|
-
this._controller.on("stateChange", this._handleStateChange), this._controller.on("message", this._handleMessage);
|
|
1019
|
+
s(this, "_addLiveControllerEventListeners", () => {
|
|
1020
|
+
this._controller.on("stateChange", this._handleStateChange), this._controller.on("message", this._handleMessage), this._controller.on("reconnecting", this._handleReconnecting), this._controller.on("reconnected", this._handleReconnected);
|
|
1023
1021
|
});
|
|
1024
1022
|
/**
|
|
1025
1023
|
* 移除带看控制的事件监听
|
|
1026
1024
|
*/
|
|
1027
|
-
|
|
1028
|
-
this._controller.off("stateChange", this._handleStateChange), this._controller.off("message", this._handleMessage);
|
|
1025
|
+
s(this, "_removeLiveControllerEventListeners", () => {
|
|
1026
|
+
this._controller.off("stateChange", this._handleStateChange), this._controller.off("message", this._handleMessage), this._controller.off("reconnecting", this._handleReconnecting), this._controller.off("reconnected", this._handleReconnected);
|
|
1029
1027
|
});
|
|
1028
|
+
/**
|
|
1029
|
+
* 重连中事件
|
|
1030
|
+
* @param detail
|
|
1031
|
+
* @returns
|
|
1032
|
+
*/
|
|
1033
|
+
s(this, "_handleReconnecting", (e) => this.emit("reconnecting", e));
|
|
1034
|
+
/**
|
|
1035
|
+
* 重连成功事件
|
|
1036
|
+
* @param detail
|
|
1037
|
+
* @returns
|
|
1038
|
+
*/
|
|
1039
|
+
s(this, "_handleReconnected", (e) => this.emit("reconnected", e));
|
|
1030
1040
|
/**
|
|
1031
1041
|
* 带看状态变化
|
|
1032
1042
|
* @param state
|
|
1033
1043
|
* @returns
|
|
1034
1044
|
*/
|
|
1035
|
-
|
|
1045
|
+
s(this, "_handleStateChange", (e, i) => this.emit("stateChange", e, i));
|
|
1036
1046
|
/**
|
|
1037
1047
|
* 消息接收
|
|
1038
1048
|
* @param liveMsg
|
|
1039
1049
|
*/
|
|
1040
|
-
|
|
1050
|
+
s(this, "_handleMessage", async (e) => {
|
|
1041
1051
|
var i, n, c, u, d;
|
|
1042
1052
|
if (typeof e == "object") {
|
|
1043
1053
|
const { command: g, data: v = {}, frontRequestId: E, code: y, message: I } = e;
|
|
@@ -1099,7 +1109,7 @@ class yr extends ue {
|
|
|
1099
1109
|
}
|
|
1100
1110
|
case K.BuiltinMsg: {
|
|
1101
1111
|
const _ = v;
|
|
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.
|
|
1112
|
+
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();
|
|
1103
1113
|
break;
|
|
1104
1114
|
}
|
|
1105
1115
|
case K.UserKickOut: {
|
|
@@ -1116,7 +1126,7 @@ class yr extends ue {
|
|
|
1116
1126
|
/**
|
|
1117
1127
|
* 清理带看缓存的数据
|
|
1118
1128
|
*/
|
|
1119
|
-
|
|
1129
|
+
s(this, "_clearLiveData", () => {
|
|
1120
1130
|
this._buildInData = { keyframes: {} };
|
|
1121
1131
|
});
|
|
1122
1132
|
/**
|
|
@@ -1124,7 +1134,7 @@ class yr extends ue {
|
|
|
1124
1134
|
* @param options
|
|
1125
1135
|
* @returns
|
|
1126
1136
|
*/
|
|
1127
|
-
|
|
1137
|
+
s(this, "connect", async (e = {}) => {
|
|
1128
1138
|
var u, d, g, v;
|
|
1129
1139
|
if (this._options.url = (d = (u = e.url) != null ? u : this._options.url) != null ? d : "", this._options.getTicket = (g = e.getTicket) != null ? g : this._options.getTicket, this._options.initialMicroStatus = (v = e.rtcMicStatus) != null ? v : this._options.initialMicroStatus, !/^ws(s):\/\//.test(this._options.url) || typeof this._options.getTicket != "function")
|
|
1130
1140
|
return /^ws(s):\/\//.test(this._options.url) ? typeof this._options.getTicket != "function" ? new Error("getTicket muse be function") : !1 : new Error("Illegal realsee live room link");
|
|
@@ -1152,39 +1162,50 @@ class yr extends ue {
|
|
|
1152
1162
|
* 退出带看
|
|
1153
1163
|
* @returns
|
|
1154
1164
|
*/
|
|
1155
|
-
|
|
1165
|
+
s(this, "_exit", async () => {
|
|
1156
1166
|
var e;
|
|
1157
|
-
|
|
1158
|
-
return !0;
|
|
1167
|
+
this._clearLiveData();
|
|
1159
1168
|
try {
|
|
1160
1169
|
await ((e = this.$RTC) == null ? void 0 : e.quit());
|
|
1161
1170
|
} catch (i) {
|
|
1162
1171
|
O.warn(i);
|
|
1163
1172
|
}
|
|
1164
|
-
return await this._controller.close();
|
|
1173
|
+
return this.state !== x.OPEN ? !0 : await this._controller.close();
|
|
1165
1174
|
});
|
|
1175
|
+
/**
|
|
1176
|
+
* 退出带看
|
|
1177
|
+
* @returns
|
|
1178
|
+
*/
|
|
1179
|
+
s(this, "exit", async () => this.close());
|
|
1166
1180
|
/**
|
|
1167
1181
|
* 关闭带看房间
|
|
1168
1182
|
* @param code
|
|
1169
1183
|
* @param reason
|
|
1170
1184
|
* @returns
|
|
1171
1185
|
*/
|
|
1172
|
-
|
|
1173
|
-
|
|
1186
|
+
s(this, "close", async () => {
|
|
1187
|
+
var e;
|
|
1188
|
+
await this._controller.readyClose();
|
|
1189
|
+
try {
|
|
1190
|
+
await ((e = this.$RTC) == null ? void 0 : e.quit());
|
|
1191
|
+
} catch (i) {
|
|
1192
|
+
O.warn(i);
|
|
1193
|
+
}
|
|
1194
|
+
await this.updateStatus(q.RoomChange, H.RoomClose, {});
|
|
1174
1195
|
});
|
|
1175
1196
|
/**
|
|
1176
1197
|
* 销毁带看
|
|
1177
1198
|
* @returns
|
|
1178
1199
|
*/
|
|
1179
|
-
|
|
1200
|
+
s(this, "dispose", async () => (this._removeLiveControllerEventListeners(), this._clearLiveData(), await this._controller.dispose()));
|
|
1180
1201
|
/**
|
|
1181
1202
|
* 设置自己的用户信息
|
|
1182
1203
|
* @param userInfo
|
|
1183
1204
|
* @returns
|
|
1184
1205
|
*/
|
|
1185
|
-
|
|
1206
|
+
s(this, "setSelfInfo", async (e) => await this.updateStatus(q.UserChange, H.UserInfo, e));
|
|
1186
1207
|
// 仅用于用户自己的麦克风控制
|
|
1187
|
-
|
|
1208
|
+
s(this, "toggleMicro", async (e) => {
|
|
1188
1209
|
var n, c, u;
|
|
1189
1210
|
if (!((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_own_micro))
|
|
1190
1211
|
return !1;
|
|
@@ -1204,7 +1225,7 @@ class yr extends ue {
|
|
|
1204
1225
|
* @param toUserIds
|
|
1205
1226
|
* @returns
|
|
1206
1227
|
*/
|
|
1207
|
-
|
|
1228
|
+
s(this, "forbidMicro", async (e, i) => {
|
|
1208
1229
|
var n, c;
|
|
1209
1230
|
return typeof this._options.canForbidUserMicro == "function" && !this._options.canForbidUserMicro(i) || !((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_other_micro) ? !1 : await this.updateStatus(
|
|
1210
1231
|
q.UserChange,
|
|
@@ -1221,7 +1242,7 @@ class yr extends ue {
|
|
|
1221
1242
|
* @param toUserIds
|
|
1222
1243
|
* @returns
|
|
1223
1244
|
*/
|
|
1224
|
-
|
|
1245
|
+
s(this, "forbidSync", async (e, i) => {
|
|
1225
1246
|
var n, c;
|
|
1226
1247
|
return typeof this._options.canForbidUserSync == "function" && !this._options.canForbidUserSync(i) || !((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_other_sync) ? !1 : await this.updateStatus(
|
|
1227
1248
|
q.UserChange,
|
|
@@ -1235,7 +1256,7 @@ class yr extends ue {
|
|
|
1235
1256
|
* @param toUserIds
|
|
1236
1257
|
* @returns
|
|
1237
1258
|
*/
|
|
1238
|
-
|
|
1259
|
+
s(this, "kick", async (e) => {
|
|
1239
1260
|
var i, n;
|
|
1240
1261
|
return typeof this._options.canForbidUserKick == "function" && !this._options.canForbidUserKick(e) || !((n = (i = this.selfInfo) == null ? void 0 : i.permission) != null && n.change_other_status) ? !1 : await this.updateStatus(
|
|
1241
1262
|
q.UserChange,
|
|
@@ -1419,7 +1440,7 @@ function Cr() {
|
|
|
1419
1440
|
if (at)
|
|
1420
1441
|
return oe;
|
|
1421
1442
|
at = 1;
|
|
1422
|
-
var r = D,
|
|
1443
|
+
var r = D, o = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
1423
1444
|
function u(d, g, v) {
|
|
1424
1445
|
var E, y = {}, I = null, _ = null;
|
|
1425
1446
|
v !== void 0 && (I = "" + v), g.key !== void 0 && (I = "" + g.key), g.ref !== void 0 && (_ = g.ref);
|
|
@@ -1428,7 +1449,7 @@ function Cr() {
|
|
|
1428
1449
|
if (d && d.defaultProps)
|
|
1429
1450
|
for (E in g = d.defaultProps, g)
|
|
1430
1451
|
y[E] === void 0 && (y[E] = g[E]);
|
|
1431
|
-
return { $$typeof:
|
|
1452
|
+
return { $$typeof: o, type: d, key: I, ref: _, props: y, _owner: n.current };
|
|
1432
1453
|
}
|
|
1433
1454
|
return oe.Fragment = e, oe.jsx = u, oe.jsxs = u, oe;
|
|
1434
1455
|
}
|
|
@@ -1445,7 +1466,7 @@ var ae = {};
|
|
|
1445
1466
|
var ct;
|
|
1446
1467
|
function wr() {
|
|
1447
1468
|
return ct || (ct = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1448
|
-
var r = D,
|
|
1469
|
+
var r = D, o = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), V = Symbol.iterator, C = "@@iterator";
|
|
1449
1470
|
function k(t) {
|
|
1450
1471
|
if (t === null || typeof t != "object")
|
|
1451
1472
|
return null;
|
|
@@ -1827,7 +1848,7 @@ function wr() {
|
|
|
1827
1848
|
var It = function(t, a, l, h, b, R, p) {
|
|
1828
1849
|
var m = {
|
|
1829
1850
|
// This tag allows us to uniquely identify this as a React Element
|
|
1830
|
-
$$typeof:
|
|
1851
|
+
$$typeof: o,
|
|
1831
1852
|
// Built-in properties that belong on the element
|
|
1832
1853
|
type: t,
|
|
1833
1854
|
key: a,
|
|
@@ -1882,7 +1903,7 @@ function wr() {
|
|
|
1882
1903
|
var ke;
|
|
1883
1904
|
ke = !1;
|
|
1884
1905
|
function Pe(t) {
|
|
1885
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
1906
|
+
return typeof t == "object" && t !== null && t.$$typeof === o;
|
|
1886
1907
|
}
|
|
1887
1908
|
function Je() {
|
|
1888
1909
|
{
|
|
@@ -1998,7 +2019,7 @@ Check the top-level render call using <` + l + ">.");
|
|
|
1998
2019
|
var $ = kt(b);
|
|
1999
2020
|
$ ? m += $ : m += Je();
|
|
2000
2021
|
var j;
|
|
2001
|
-
t === null ? j = "null" : Oe(t) ? j = "array" : t !== void 0 && t.$$typeof ===
|
|
2022
|
+
t === null ? j = "null" : Oe(t) ? j = "array" : t !== void 0 && t.$$typeof === o ? (j = "<" + (G(t.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : j = typeof t, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, m);
|
|
2002
2023
|
}
|
|
2003
2024
|
var L = Tt(t, a, l, b, R);
|
|
2004
2025
|
if (L == null)
|
|
@@ -2034,8 +2055,8 @@ Check the top-level render call using <` + l + ">.");
|
|
|
2034
2055
|
})(Sr);
|
|
2035
2056
|
const Rr = Ae.jsx;
|
|
2036
2057
|
function jr(r) {
|
|
2037
|
-
const
|
|
2038
|
-
const f = D.useContext(
|
|
2058
|
+
const o = Gt(null), e = br(r), i = e.jsBridge, n = (f) => /* @__PURE__ */ Rr(o.Provider, { value: e, children: f.children }), c = () => {
|
|
2059
|
+
const f = D.useContext(o);
|
|
2039
2060
|
if (!f)
|
|
2040
2061
|
throw new Error("LiveProvider never found.");
|
|
2041
2062
|
return f;
|