@realsee/live 0.5.2-dev.1 → 0.5.2-dev.3
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/live/controller.d.ts +1 -1
- package/dist/live/createLiveReact.d.ts +1 -1
- package/dist/live/live.d.ts +1 -1
- package/dist/realsee-live.cjs.development.js +144 -141
- package/dist/realsee-live.cjs.development.js.map +1 -1
- package/dist/realsee-live.cjs.production.js +1 -1
- package/dist/realsee-live.cjs.production.js.map +1 -1
- package/dist/realsee-live.esm.js +144 -141
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +1172 -966
- package/dist/realsee-live.umd.development.js.map +1 -1
- package/dist/realsee-live.umd.production.js +1 -1
- package/dist/realsee-live.umd.production.js.map +1 -1
- package/dist/typings/live/EventType.d.ts +3 -3
- package/dist/typings/live/GetVoiceSign.d.ts +1 -1
- package/dist/typings/live/LiveConnectOptions.d.ts +1 -1
- package/dist/typings/live/LiveMsg.d.ts +3 -3
- package/dist/typings/live/RoomInfo.d.ts +1 -1
- package/dist/typings/live/UserInfo.d.ts +20 -3
- package/dist/typings/live/UserVolume.d.ts +1 -1
- package/dist/typings/live/WebSocket.d.ts +1 -1
- package/dist/typings/react/RTCActionReactCallback.d.ts +1 -1
- package/dist/typings/rtc/eventType.d.ts +1 -1
- package/dist/utils/RobustWebSocket.d.ts +5 -5
- package/dist/utils/subscribe.d.ts +1 -1
- package/docs/classes/BrowserRTC.html +3 -3
- package/docs/modules.html +2 -2
- package/package.json +13 -12
|
@@ -2,7 +2,7 @@ import { LiveMsg } from '../typings';
|
|
|
2
2
|
import { LiveState } from '../typings/live/LiveState';
|
|
3
3
|
import { RobustWebSocketEventDetail } from '../utils/RobustWebSocket';
|
|
4
4
|
import { Subscribe } from '../utils/subscribe';
|
|
5
|
-
export
|
|
5
|
+
export type LiveControllerEventMap = {
|
|
6
6
|
stateChange: (state: LiveState, prevState: LiveState) => void;
|
|
7
7
|
message: (message: LiveMsg) => void;
|
|
8
8
|
reconnected: (detail: RobustWebSocketEventDetail) => void;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { BuiltinActionType, BuiltinEventType, KeyframeTypes, LiveConnectOptions, LiveEventType, LiveOptions, MicroStatus, RTCEventType, RTCType, UserInfo } from '../typings';
|
|
3
3
|
import { LiveState } from '../typings/live/LiveState';
|
|
4
4
|
import { Live } from './live';
|
|
5
|
-
export
|
|
5
|
+
export type LiveProviderPropTypes<KeyframesSnapshot extends Record<string, any>> = {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
live?: Live<KeyframesSnapshot>;
|
|
8
8
|
};
|
package/dist/live/live.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { RTCProtocol } from '../rtc';
|
|
|
3
3
|
import { EventType, KeyframeTypes, LiveOptions, RoomInfo, RTCType, UserInfo, BuiltinEventType, BuiltinActionType, MicroStatus, LiveConnectOptions } from '../typings';
|
|
4
4
|
import { LiveState } from '../typings/live/LiveState';
|
|
5
5
|
import { Subscribe } from '../utils/subscribe';
|
|
6
|
-
export
|
|
6
|
+
export type LiveBuiltInData<KeyframesSnapshot> = {
|
|
7
7
|
selfInfo?: UserInfo;
|
|
8
8
|
userList?: UserInfo[];
|
|
9
9
|
roomInfo?: RoomInfo;
|
|
@@ -171,6 +171,54 @@ exports.BuiltInRTCType = void 0;
|
|
|
171
171
|
BuiltInRTCType["RealseeXChimeRTC"] = "chime";
|
|
172
172
|
})(exports.BuiltInRTCType || (exports.BuiltInRTCType = {}));
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* 输出格式化日志
|
|
176
|
+
*/
|
|
177
|
+
// 获取当前时间
|
|
178
|
+
const getTime = () => {
|
|
179
|
+
const date = new Date();
|
|
180
|
+
const year = date.getFullYear();
|
|
181
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
|
|
182
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
183
|
+
const hour = date.getHours().toString().padStart(2, '0');
|
|
184
|
+
const min = date.getMinutes().toString().padStart(2, '0');
|
|
185
|
+
const sec = date.getSeconds().toString().padStart(2, '0');
|
|
186
|
+
const ms = date.getMilliseconds();
|
|
187
|
+
return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
|
|
188
|
+
};
|
|
189
|
+
var LOG_LEVEL;
|
|
190
|
+
(function (LOG_LEVEL) {
|
|
191
|
+
LOG_LEVEL["info"] = "INFO";
|
|
192
|
+
LOG_LEVEL["log"] = "LOG";
|
|
193
|
+
LOG_LEVEL["error"] = "ERROR";
|
|
194
|
+
LOG_LEVEL["warn"] = "WARN";
|
|
195
|
+
})(LOG_LEVEL || (LOG_LEVEL = {}));
|
|
196
|
+
// 输出日志
|
|
197
|
+
const echo = (logLevel, args = []) => {
|
|
198
|
+
args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
|
|
199
|
+
switch (logLevel) {
|
|
200
|
+
case LOG_LEVEL.info:
|
|
201
|
+
return console.info(...args);
|
|
202
|
+
case LOG_LEVEL.error:
|
|
203
|
+
return console.error(...args);
|
|
204
|
+
case LOG_LEVEL.warn:
|
|
205
|
+
return console.warn(...args);
|
|
206
|
+
default:
|
|
207
|
+
return console.log(...args);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const log = (...args) => echo(LOG_LEVEL.log, args);
|
|
211
|
+
const info = (...args) => echo(LOG_LEVEL.info, args);
|
|
212
|
+
const error = (...args) => echo(LOG_LEVEL.error, args);
|
|
213
|
+
const warn = (...args) => echo(LOG_LEVEL.warn, args);
|
|
214
|
+
const logger = {
|
|
215
|
+
log,
|
|
216
|
+
info,
|
|
217
|
+
error,
|
|
218
|
+
warn,
|
|
219
|
+
};
|
|
220
|
+
var logger$1 = logger;
|
|
221
|
+
|
|
174
222
|
// uuid
|
|
175
223
|
function S4() {
|
|
176
224
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
@@ -298,7 +346,10 @@ class BrowserRTC extends CoreRTC {
|
|
|
298
346
|
navigator.mediaDevices
|
|
299
347
|
.getUserMedia(rule)
|
|
300
348
|
.then(() => resolve(true))
|
|
301
|
-
.catch(() =>
|
|
349
|
+
.catch((e) => {
|
|
350
|
+
logger$1.error(e.message);
|
|
351
|
+
resolve(false);
|
|
352
|
+
});
|
|
302
353
|
}
|
|
303
354
|
catch (e) {
|
|
304
355
|
console.error(e);
|
|
@@ -613,6 +664,9 @@ exports.RTCJoinedInfoCodeEnum = void 0;
|
|
|
613
664
|
})(exports.RTCJoinedInfoCodeEnum || (exports.RTCJoinedInfoCodeEnum = {}));
|
|
614
665
|
|
|
615
666
|
class VRWebViewRTC extends CoreRTC {
|
|
667
|
+
get jsBridge() {
|
|
668
|
+
return this.options.jsBridge;
|
|
669
|
+
}
|
|
616
670
|
constructor({ jsBridge, getVoiceSign }) {
|
|
617
671
|
super();
|
|
618
672
|
this.type = exports.RTCType.RealseeVRWebViewRTC;
|
|
@@ -631,9 +685,6 @@ class VRWebViewRTC extends CoreRTC {
|
|
|
631
685
|
this.emit('weakNetwork');
|
|
632
686
|
});
|
|
633
687
|
}
|
|
634
|
-
get jsBridge() {
|
|
635
|
-
return this.options.jsBridge;
|
|
636
|
-
}
|
|
637
688
|
join(options) {
|
|
638
689
|
return __awaiter(this, void 0, void 0, function* () {
|
|
639
690
|
try {
|
|
@@ -986,7 +1037,7 @@ exports.default = LogLevel;
|
|
|
986
1037
|
|
|
987
1038
|
var LogLevel = /*@__PURE__*/getDefaultExportFromCjs(LogLevel_1);
|
|
988
1039
|
|
|
989
|
-
function appendUri(uri, query) {
|
|
1040
|
+
function appendUri(uri, query = {}) {
|
|
990
1041
|
const hasQuery = uri.indexOf('?') !== -1;
|
|
991
1042
|
const newQuery = Object.keys(query).reduce((accu, curr, idx) => `${accu}${(idx === 0 && !hasQuery) ? '?' : '&'}${curr}=${query[curr]}`, '');
|
|
992
1043
|
return uri + newQuery;
|
|
@@ -1124,66 +1175,21 @@ function objEqualDeep(value, other) {
|
|
|
1124
1175
|
* @param options 可选参数,可选项:`deep` 是否深比较。
|
|
1125
1176
|
* @returns {boolean} 是否相等。
|
|
1126
1177
|
*/
|
|
1127
|
-
function equal(value, other, opt) {
|
|
1178
|
+
function equal(value, other, opt = { deep: false }) {
|
|
1128
1179
|
if (!opt.deep)
|
|
1129
1180
|
return isShallowEqual(value, other);
|
|
1130
1181
|
return isDeepEqual(value, other);
|
|
1131
1182
|
}
|
|
1132
1183
|
|
|
1133
|
-
/**
|
|
1134
|
-
* 输出格式化日志
|
|
1135
|
-
*/
|
|
1136
|
-
// 获取当前时间
|
|
1137
|
-
const getTime = () => {
|
|
1138
|
-
const date = new Date();
|
|
1139
|
-
const year = date.getFullYear();
|
|
1140
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
|
|
1141
|
-
const day = date.getDate().toString().padStart(2, '0');
|
|
1142
|
-
const hour = date.getHours().toString().padStart(2, '0');
|
|
1143
|
-
const min = date.getMinutes().toString().padStart(2, '0');
|
|
1144
|
-
const sec = date.getSeconds().toString().padStart(2, '0');
|
|
1145
|
-
const ms = date.getMilliseconds();
|
|
1146
|
-
return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
|
|
1147
|
-
};
|
|
1148
|
-
var LOG_LEVEL;
|
|
1149
|
-
(function (LOG_LEVEL) {
|
|
1150
|
-
LOG_LEVEL["info"] = "INFO";
|
|
1151
|
-
LOG_LEVEL["log"] = "LOG";
|
|
1152
|
-
LOG_LEVEL["error"] = "ERROR";
|
|
1153
|
-
LOG_LEVEL["warn"] = "WARN";
|
|
1154
|
-
})(LOG_LEVEL || (LOG_LEVEL = {}));
|
|
1155
|
-
// 输出日志
|
|
1156
|
-
const echo = (logLevel, args = []) => {
|
|
1157
|
-
args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
|
|
1158
|
-
switch (logLevel) {
|
|
1159
|
-
case LOG_LEVEL.info:
|
|
1160
|
-
return console.info(...args);
|
|
1161
|
-
case LOG_LEVEL.error:
|
|
1162
|
-
return console.error(...args);
|
|
1163
|
-
case LOG_LEVEL.warn:
|
|
1164
|
-
return console.warn(...args);
|
|
1165
|
-
default:
|
|
1166
|
-
return console.log(...args);
|
|
1167
|
-
}
|
|
1168
|
-
};
|
|
1169
|
-
const log = (...args) => echo(LOG_LEVEL.log, args);
|
|
1170
|
-
const info = (...args) => echo(LOG_LEVEL.info, args);
|
|
1171
|
-
const error = (...args) => echo(LOG_LEVEL.error, args);
|
|
1172
|
-
const warn = (...args) => echo(LOG_LEVEL.warn, args);
|
|
1173
|
-
const logger = {
|
|
1174
|
-
log,
|
|
1175
|
-
info,
|
|
1176
|
-
error,
|
|
1177
|
-
warn,
|
|
1178
|
-
};
|
|
1179
|
-
var logger$1 = logger;
|
|
1180
|
-
|
|
1181
1184
|
/**
|
|
1182
1185
|
* 具有鲁棒性的WebSocket封装
|
|
1183
1186
|
* 1、自动重连
|
|
1184
1187
|
* 2、可根据网络情况进行重连
|
|
1185
1188
|
*/
|
|
1186
1189
|
class RobustWebSocket extends Subscribe {
|
|
1190
|
+
get attempts() {
|
|
1191
|
+
return this._attempts;
|
|
1192
|
+
}
|
|
1187
1193
|
constructor(options) {
|
|
1188
1194
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
1189
1195
|
super();
|
|
@@ -1431,9 +1437,6 @@ class RobustWebSocket extends Subscribe {
|
|
|
1431
1437
|
}
|
|
1432
1438
|
this._startHealthCheck();
|
|
1433
1439
|
}
|
|
1434
|
-
get attempts() {
|
|
1435
|
-
return this._attempts;
|
|
1436
|
-
}
|
|
1437
1440
|
setOptions(options) {
|
|
1438
1441
|
if (!options)
|
|
1439
1442
|
return;
|
|
@@ -1475,6 +1478,14 @@ class RobustWebSocket extends Subscribe {
|
|
|
1475
1478
|
}
|
|
1476
1479
|
|
|
1477
1480
|
class LiveController extends Subscribe {
|
|
1481
|
+
set state(state) {
|
|
1482
|
+
const prevState = JSON.parse(JSON.stringify(this._state));
|
|
1483
|
+
this._state = state;
|
|
1484
|
+
this.emit('stateChange', this.state, prevState);
|
|
1485
|
+
}
|
|
1486
|
+
get state() {
|
|
1487
|
+
return this._state;
|
|
1488
|
+
}
|
|
1478
1489
|
constructor() {
|
|
1479
1490
|
super();
|
|
1480
1491
|
/**
|
|
@@ -1604,14 +1615,6 @@ class LiveController extends Subscribe {
|
|
|
1604
1615
|
});
|
|
1605
1616
|
this._addWebSocketEventListeners();
|
|
1606
1617
|
}
|
|
1607
|
-
set state(state) {
|
|
1608
|
-
const prevState = JSON.parse(JSON.stringify(this._state));
|
|
1609
|
-
this._state = state;
|
|
1610
|
-
this.emit('stateChange', this.state, prevState);
|
|
1611
|
-
}
|
|
1612
|
-
get state() {
|
|
1613
|
-
return this._state;
|
|
1614
|
-
}
|
|
1615
1618
|
/**
|
|
1616
1619
|
* 发送数据
|
|
1617
1620
|
* @param data
|
|
@@ -1643,6 +1646,65 @@ const _clearLiveInstanceIfNeed = () => {
|
|
|
1643
1646
|
}
|
|
1644
1647
|
};
|
|
1645
1648
|
class Live extends Subscribe {
|
|
1649
|
+
get options() {
|
|
1650
|
+
return Object.freeze(this._options || {});
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* 带看状态
|
|
1654
|
+
*/
|
|
1655
|
+
get state() {
|
|
1656
|
+
return this._controller.state;
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* 兼容老逻辑
|
|
1660
|
+
* @deprecated 请直接读取 state 属性字段,未来将移除该属性
|
|
1661
|
+
*/
|
|
1662
|
+
get readyState() {
|
|
1663
|
+
return this._controller.state;
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
|
|
1667
|
+
* @deprecated 带看不需要关注底层ws的相关信息,未来将移除
|
|
1668
|
+
*/
|
|
1669
|
+
get url() {
|
|
1670
|
+
return this.options.url;
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* 获取当前live使用的RTC实例
|
|
1674
|
+
*/
|
|
1675
|
+
get $RTC() {
|
|
1676
|
+
return this._options.rtc;
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* 获取当前live使用的jsBridge实例
|
|
1680
|
+
*/
|
|
1681
|
+
get jsBridge() {
|
|
1682
|
+
return this._options.jsBridge;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* 当前帧数据快照
|
|
1686
|
+
*/
|
|
1687
|
+
get snapshot() {
|
|
1688
|
+
return this._buildInData.keyframes;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* 当前用户信息
|
|
1692
|
+
*/
|
|
1693
|
+
get selfInfo() {
|
|
1694
|
+
return this._buildInData.selfInfo;
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* 当前用户列表
|
|
1698
|
+
*/
|
|
1699
|
+
get userList() {
|
|
1700
|
+
return this._buildInData.userList || [];
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* 当前带看房间信息
|
|
1704
|
+
*/
|
|
1705
|
+
get roomInfo() {
|
|
1706
|
+
return this._buildInData.roomInfo;
|
|
1707
|
+
}
|
|
1646
1708
|
constructor(opts) {
|
|
1647
1709
|
var _a;
|
|
1648
1710
|
super();
|
|
@@ -1715,7 +1777,7 @@ class Live extends Subscribe {
|
|
|
1715
1777
|
* @param liveMsg
|
|
1716
1778
|
*/
|
|
1717
1779
|
this._handleMessage = (liveMsg) => __awaiter(this, void 0, void 0, function* () {
|
|
1718
|
-
var _b, _c, _d, _e, _f
|
|
1780
|
+
var _b, _c, _d, _e, _f;
|
|
1719
1781
|
if (typeof liveMsg === 'object') {
|
|
1720
1782
|
const { command, data = {}, frontRequestId, code, message } = liveMsg;
|
|
1721
1783
|
if (code === 'SUCCESS') {
|
|
@@ -1755,7 +1817,7 @@ class Live extends Subscribe {
|
|
|
1755
1817
|
}));
|
|
1756
1818
|
if (result) {
|
|
1757
1819
|
const status = (_f = this._options.initialMicroStatus) !== null && _f !== void 0 ? _f : exports.MicroStatus.OPEN;
|
|
1758
|
-
yield
|
|
1820
|
+
yield this.toggleMicro(status === exports.MicroStatus.OPEN);
|
|
1759
1821
|
}
|
|
1760
1822
|
else {
|
|
1761
1823
|
logger$1.error('加入语音房间失败');
|
|
@@ -1869,12 +1931,12 @@ class Live extends Subscribe {
|
|
|
1869
1931
|
* @returns
|
|
1870
1932
|
*/
|
|
1871
1933
|
this.connect = (options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
1872
|
-
var _h, _j, _k
|
|
1934
|
+
var _g, _h, _j, _k;
|
|
1873
1935
|
// 检查 url 和 票据获取接口实现
|
|
1874
|
-
this._options.url = (
|
|
1875
|
-
this._options.getTicket = (
|
|
1936
|
+
this._options.url = (_h = (_g = options.url) !== null && _g !== void 0 ? _g : this._options.url) !== null && _h !== void 0 ? _h : '';
|
|
1937
|
+
this._options.getTicket = (_j = options.getTicket) !== null && _j !== void 0 ? _j : this._options.getTicket;
|
|
1876
1938
|
this._options.initialMicroStatus =
|
|
1877
|
-
(
|
|
1939
|
+
(_k = options.rtcMicStatus) !== null && _k !== void 0 ? _k : this._options.initialMicroStatus;
|
|
1878
1940
|
if (!/^ws(s):\/\//.test(this._options.url) ||
|
|
1879
1941
|
typeof this._options.getTicket !== 'function') {
|
|
1880
1942
|
if (!/^ws(s):\/\//.test(this._options.url)) {
|
|
@@ -1923,11 +1985,11 @@ class Live extends Subscribe {
|
|
|
1923
1985
|
* @returns
|
|
1924
1986
|
*/
|
|
1925
1987
|
this.exit = () => __awaiter(this, void 0, void 0, function* () {
|
|
1926
|
-
var
|
|
1988
|
+
var _l;
|
|
1927
1989
|
this._clearLiveData();
|
|
1928
1990
|
try {
|
|
1929
1991
|
/** 退出强制关闭语音 */
|
|
1930
|
-
(
|
|
1992
|
+
(_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
|
|
1931
1993
|
yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
|
|
1932
1994
|
}
|
|
1933
1995
|
catch (e) {
|
|
@@ -1954,10 +2016,10 @@ class Live extends Subscribe {
|
|
|
1954
2016
|
});
|
|
1955
2017
|
// 仅用于用户自己的麦克风控制
|
|
1956
2018
|
this.toggleMicro = (microStatus) => __awaiter(this, void 0, void 0, function* () {
|
|
1957
|
-
var _o, _p
|
|
1958
|
-
if (!((
|
|
2019
|
+
var _m, _o, _p;
|
|
2020
|
+
if (!((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.control_own_micro))
|
|
1959
2021
|
return false;
|
|
1960
|
-
const result = yield ((
|
|
2022
|
+
const result = yield ((_p = this.$RTC) === null || _p === void 0 ? void 0 : _p.toggleMicro(microStatus));
|
|
1961
2023
|
if (result) {
|
|
1962
2024
|
yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
|
|
1963
2025
|
status: microStatus ? exports.MicroStatus.OPEN : exports.MicroStatus.CLOSE,
|
|
@@ -1972,12 +2034,12 @@ class Live extends Subscribe {
|
|
|
1972
2034
|
* @returns
|
|
1973
2035
|
*/
|
|
1974
2036
|
this.forbidMicro = (microStatus, toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1975
|
-
var
|
|
2037
|
+
var _q, _r;
|
|
1976
2038
|
if (typeof this._options.canForbidUserMicro === 'function' &&
|
|
1977
2039
|
!this._options.canForbidUserMicro(toUserIds)) {
|
|
1978
2040
|
return false;
|
|
1979
2041
|
}
|
|
1980
|
-
if (!((
|
|
2042
|
+
if (!((_r = (_q = this.selfInfo) === null || _q === void 0 ? void 0 : _q.permission) === null || _r === void 0 ? void 0 : _r.control_other_micro)) {
|
|
1981
2043
|
return false;
|
|
1982
2044
|
}
|
|
1983
2045
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
|
|
@@ -1991,12 +2053,12 @@ class Live extends Subscribe {
|
|
|
1991
2053
|
* @returns
|
|
1992
2054
|
*/
|
|
1993
2055
|
this.forbidSync = (sync, toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1994
|
-
var
|
|
2056
|
+
var _s, _t;
|
|
1995
2057
|
if (typeof this._options.canForbidUserSync === 'function' &&
|
|
1996
2058
|
!this._options.canForbidUserSync(toUserIds)) {
|
|
1997
2059
|
return false;
|
|
1998
2060
|
}
|
|
1999
|
-
if (!((
|
|
2061
|
+
if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_sync)) {
|
|
2000
2062
|
return false;
|
|
2001
2063
|
}
|
|
2002
2064
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
|
|
@@ -2007,12 +2069,12 @@ class Live extends Subscribe {
|
|
|
2007
2069
|
* @returns
|
|
2008
2070
|
*/
|
|
2009
2071
|
this.kick = (toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
2010
|
-
var
|
|
2072
|
+
var _u, _v;
|
|
2011
2073
|
if (typeof this._options.canForbidUserKick === 'function' &&
|
|
2012
2074
|
!this._options.canForbidUserKick(toUserIds)) {
|
|
2013
2075
|
return false;
|
|
2014
2076
|
}
|
|
2015
|
-
if (!((
|
|
2077
|
+
if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.change_other_status)) {
|
|
2016
2078
|
return false;
|
|
2017
2079
|
}
|
|
2018
2080
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserStatus, {
|
|
@@ -2113,65 +2175,6 @@ class Live extends Subscribe {
|
|
|
2113
2175
|
Object.assign(window, { $liveController: this._controller, $live: this });
|
|
2114
2176
|
}
|
|
2115
2177
|
}
|
|
2116
|
-
get options() {
|
|
2117
|
-
return Object.freeze(this._options || {});
|
|
2118
|
-
}
|
|
2119
|
-
/**
|
|
2120
|
-
* 带看状态
|
|
2121
|
-
*/
|
|
2122
|
-
get state() {
|
|
2123
|
-
return this._controller.state;
|
|
2124
|
-
}
|
|
2125
|
-
/**
|
|
2126
|
-
* 兼容老逻辑
|
|
2127
|
-
* @deprecated 请直接读取 state 属性字段,未来将移除该属性
|
|
2128
|
-
*/
|
|
2129
|
-
get readyState() {
|
|
2130
|
-
return this._controller.state;
|
|
2131
|
-
}
|
|
2132
|
-
/**
|
|
2133
|
-
* 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
|
|
2134
|
-
* @deprecated 带看不需要关注底层ws的相关信息,未来将移除
|
|
2135
|
-
*/
|
|
2136
|
-
get url() {
|
|
2137
|
-
return this.options.url;
|
|
2138
|
-
}
|
|
2139
|
-
/**
|
|
2140
|
-
* 获取当前live使用的RTC实例
|
|
2141
|
-
*/
|
|
2142
|
-
get $RTC() {
|
|
2143
|
-
return this._options.rtc;
|
|
2144
|
-
}
|
|
2145
|
-
/**
|
|
2146
|
-
* 获取当前live使用的jsBridge实例
|
|
2147
|
-
*/
|
|
2148
|
-
get jsBridge() {
|
|
2149
|
-
return this._options.jsBridge;
|
|
2150
|
-
}
|
|
2151
|
-
/**
|
|
2152
|
-
* 当前帧数据快照
|
|
2153
|
-
*/
|
|
2154
|
-
get snapshot() {
|
|
2155
|
-
return this._buildInData.keyframes;
|
|
2156
|
-
}
|
|
2157
|
-
/**
|
|
2158
|
-
* 当前用户信息
|
|
2159
|
-
*/
|
|
2160
|
-
get selfInfo() {
|
|
2161
|
-
return this._buildInData.selfInfo;
|
|
2162
|
-
}
|
|
2163
|
-
/**
|
|
2164
|
-
* 当前用户列表
|
|
2165
|
-
*/
|
|
2166
|
-
get userList() {
|
|
2167
|
-
return this._buildInData.userList || [];
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* 当前带看房间信息
|
|
2171
|
-
*/
|
|
2172
|
-
get roomInfo() {
|
|
2173
|
-
return this._buildInData.roomInfo;
|
|
2174
|
-
}
|
|
2175
2178
|
/**
|
|
2176
2179
|
* 修改状态
|
|
2177
2180
|
* @param evtType
|