@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
package/dist/realsee-live.esm.js
CHANGED
|
@@ -161,6 +161,54 @@ var BuiltInRTCType;
|
|
|
161
161
|
BuiltInRTCType["RealseeXChimeRTC"] = "chime";
|
|
162
162
|
})(BuiltInRTCType || (BuiltInRTCType = {}));
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* 输出格式化日志
|
|
166
|
+
*/
|
|
167
|
+
// 获取当前时间
|
|
168
|
+
const getTime = () => {
|
|
169
|
+
const date = new Date();
|
|
170
|
+
const year = date.getFullYear();
|
|
171
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
|
|
172
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
173
|
+
const hour = date.getHours().toString().padStart(2, '0');
|
|
174
|
+
const min = date.getMinutes().toString().padStart(2, '0');
|
|
175
|
+
const sec = date.getSeconds().toString().padStart(2, '0');
|
|
176
|
+
const ms = date.getMilliseconds();
|
|
177
|
+
return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
|
|
178
|
+
};
|
|
179
|
+
var LOG_LEVEL;
|
|
180
|
+
(function (LOG_LEVEL) {
|
|
181
|
+
LOG_LEVEL["info"] = "INFO";
|
|
182
|
+
LOG_LEVEL["log"] = "LOG";
|
|
183
|
+
LOG_LEVEL["error"] = "ERROR";
|
|
184
|
+
LOG_LEVEL["warn"] = "WARN";
|
|
185
|
+
})(LOG_LEVEL || (LOG_LEVEL = {}));
|
|
186
|
+
// 输出日志
|
|
187
|
+
const echo = (logLevel, args = []) => {
|
|
188
|
+
args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
|
|
189
|
+
switch (logLevel) {
|
|
190
|
+
case LOG_LEVEL.info:
|
|
191
|
+
return console.info(...args);
|
|
192
|
+
case LOG_LEVEL.error:
|
|
193
|
+
return console.error(...args);
|
|
194
|
+
case LOG_LEVEL.warn:
|
|
195
|
+
return console.warn(...args);
|
|
196
|
+
default:
|
|
197
|
+
return console.log(...args);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const log = (...args) => echo(LOG_LEVEL.log, args);
|
|
201
|
+
const info = (...args) => echo(LOG_LEVEL.info, args);
|
|
202
|
+
const error = (...args) => echo(LOG_LEVEL.error, args);
|
|
203
|
+
const warn = (...args) => echo(LOG_LEVEL.warn, args);
|
|
204
|
+
const logger = {
|
|
205
|
+
log,
|
|
206
|
+
info,
|
|
207
|
+
error,
|
|
208
|
+
warn,
|
|
209
|
+
};
|
|
210
|
+
var logger$1 = logger;
|
|
211
|
+
|
|
164
212
|
// uuid
|
|
165
213
|
function S4() {
|
|
166
214
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
@@ -288,7 +336,10 @@ class BrowserRTC extends CoreRTC {
|
|
|
288
336
|
navigator.mediaDevices
|
|
289
337
|
.getUserMedia(rule)
|
|
290
338
|
.then(() => resolve(true))
|
|
291
|
-
.catch(() =>
|
|
339
|
+
.catch((e) => {
|
|
340
|
+
logger$1.error(e.message);
|
|
341
|
+
resolve(false);
|
|
342
|
+
});
|
|
292
343
|
}
|
|
293
344
|
catch (e) {
|
|
294
345
|
console.error(e);
|
|
@@ -603,6 +654,9 @@ var RTCJoinedInfoCodeEnum;
|
|
|
603
654
|
})(RTCJoinedInfoCodeEnum || (RTCJoinedInfoCodeEnum = {}));
|
|
604
655
|
|
|
605
656
|
class VRWebViewRTC extends CoreRTC {
|
|
657
|
+
get jsBridge() {
|
|
658
|
+
return this.options.jsBridge;
|
|
659
|
+
}
|
|
606
660
|
constructor({ jsBridge, getVoiceSign }) {
|
|
607
661
|
super();
|
|
608
662
|
this.type = RTCType.RealseeVRWebViewRTC;
|
|
@@ -621,9 +675,6 @@ class VRWebViewRTC extends CoreRTC {
|
|
|
621
675
|
this.emit('weakNetwork');
|
|
622
676
|
});
|
|
623
677
|
}
|
|
624
|
-
get jsBridge() {
|
|
625
|
-
return this.options.jsBridge;
|
|
626
|
-
}
|
|
627
678
|
join(options) {
|
|
628
679
|
return __awaiter(this, void 0, void 0, function* () {
|
|
629
680
|
try {
|
|
@@ -976,7 +1027,7 @@ exports.default = LogLevel;
|
|
|
976
1027
|
|
|
977
1028
|
var LogLevel = /*@__PURE__*/getDefaultExportFromCjs(LogLevel_1);
|
|
978
1029
|
|
|
979
|
-
function appendUri(uri, query) {
|
|
1030
|
+
function appendUri(uri, query = {}) {
|
|
980
1031
|
const hasQuery = uri.indexOf('?') !== -1;
|
|
981
1032
|
const newQuery = Object.keys(query).reduce((accu, curr, idx) => `${accu}${(idx === 0 && !hasQuery) ? '?' : '&'}${curr}=${query[curr]}`, '');
|
|
982
1033
|
return uri + newQuery;
|
|
@@ -1114,66 +1165,21 @@ function objEqualDeep(value, other) {
|
|
|
1114
1165
|
* @param options 可选参数,可选项:`deep` 是否深比较。
|
|
1115
1166
|
* @returns {boolean} 是否相等。
|
|
1116
1167
|
*/
|
|
1117
|
-
function equal(value, other, opt) {
|
|
1168
|
+
function equal(value, other, opt = { deep: false }) {
|
|
1118
1169
|
if (!opt.deep)
|
|
1119
1170
|
return isShallowEqual(value, other);
|
|
1120
1171
|
return isDeepEqual(value, other);
|
|
1121
1172
|
}
|
|
1122
1173
|
|
|
1123
|
-
/**
|
|
1124
|
-
* 输出格式化日志
|
|
1125
|
-
*/
|
|
1126
|
-
// 获取当前时间
|
|
1127
|
-
const getTime = () => {
|
|
1128
|
-
const date = new Date();
|
|
1129
|
-
const year = date.getFullYear();
|
|
1130
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //月份是从0开始的
|
|
1131
|
-
const day = date.getDate().toString().padStart(2, '0');
|
|
1132
|
-
const hour = date.getHours().toString().padStart(2, '0');
|
|
1133
|
-
const min = date.getMinutes().toString().padStart(2, '0');
|
|
1134
|
-
const sec = date.getSeconds().toString().padStart(2, '0');
|
|
1135
|
-
const ms = date.getMilliseconds();
|
|
1136
|
-
return `[${year}-${month}-${day} ${hour}:${min}:${sec}.${ms}]`;
|
|
1137
|
-
};
|
|
1138
|
-
var LOG_LEVEL;
|
|
1139
|
-
(function (LOG_LEVEL) {
|
|
1140
|
-
LOG_LEVEL["info"] = "INFO";
|
|
1141
|
-
LOG_LEVEL["log"] = "LOG";
|
|
1142
|
-
LOG_LEVEL["error"] = "ERROR";
|
|
1143
|
-
LOG_LEVEL["warn"] = "WARN";
|
|
1144
|
-
})(LOG_LEVEL || (LOG_LEVEL = {}));
|
|
1145
|
-
// 输出日志
|
|
1146
|
-
const echo = (logLevel, args = []) => {
|
|
1147
|
-
args.unshift(`Realsee Live ${getTime()} <${logLevel}> `);
|
|
1148
|
-
switch (logLevel) {
|
|
1149
|
-
case LOG_LEVEL.info:
|
|
1150
|
-
return console.info(...args);
|
|
1151
|
-
case LOG_LEVEL.error:
|
|
1152
|
-
return console.error(...args);
|
|
1153
|
-
case LOG_LEVEL.warn:
|
|
1154
|
-
return console.warn(...args);
|
|
1155
|
-
default:
|
|
1156
|
-
return console.log(...args);
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
const log = (...args) => echo(LOG_LEVEL.log, args);
|
|
1160
|
-
const info = (...args) => echo(LOG_LEVEL.info, args);
|
|
1161
|
-
const error = (...args) => echo(LOG_LEVEL.error, args);
|
|
1162
|
-
const warn = (...args) => echo(LOG_LEVEL.warn, args);
|
|
1163
|
-
const logger = {
|
|
1164
|
-
log,
|
|
1165
|
-
info,
|
|
1166
|
-
error,
|
|
1167
|
-
warn,
|
|
1168
|
-
};
|
|
1169
|
-
var logger$1 = logger;
|
|
1170
|
-
|
|
1171
1174
|
/**
|
|
1172
1175
|
* 具有鲁棒性的WebSocket封装
|
|
1173
1176
|
* 1、自动重连
|
|
1174
1177
|
* 2、可根据网络情况进行重连
|
|
1175
1178
|
*/
|
|
1176
1179
|
class RobustWebSocket extends Subscribe {
|
|
1180
|
+
get attempts() {
|
|
1181
|
+
return this._attempts;
|
|
1182
|
+
}
|
|
1177
1183
|
constructor(options) {
|
|
1178
1184
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
1179
1185
|
super();
|
|
@@ -1421,9 +1427,6 @@ class RobustWebSocket extends Subscribe {
|
|
|
1421
1427
|
}
|
|
1422
1428
|
this._startHealthCheck();
|
|
1423
1429
|
}
|
|
1424
|
-
get attempts() {
|
|
1425
|
-
return this._attempts;
|
|
1426
|
-
}
|
|
1427
1430
|
setOptions(options) {
|
|
1428
1431
|
if (!options)
|
|
1429
1432
|
return;
|
|
@@ -1465,6 +1468,14 @@ class RobustWebSocket extends Subscribe {
|
|
|
1465
1468
|
}
|
|
1466
1469
|
|
|
1467
1470
|
class LiveController extends Subscribe {
|
|
1471
|
+
set state(state) {
|
|
1472
|
+
const prevState = JSON.parse(JSON.stringify(this._state));
|
|
1473
|
+
this._state = state;
|
|
1474
|
+
this.emit('stateChange', this.state, prevState);
|
|
1475
|
+
}
|
|
1476
|
+
get state() {
|
|
1477
|
+
return this._state;
|
|
1478
|
+
}
|
|
1468
1479
|
constructor() {
|
|
1469
1480
|
super();
|
|
1470
1481
|
/**
|
|
@@ -1594,14 +1605,6 @@ class LiveController extends Subscribe {
|
|
|
1594
1605
|
});
|
|
1595
1606
|
this._addWebSocketEventListeners();
|
|
1596
1607
|
}
|
|
1597
|
-
set state(state) {
|
|
1598
|
-
const prevState = JSON.parse(JSON.stringify(this._state));
|
|
1599
|
-
this._state = state;
|
|
1600
|
-
this.emit('stateChange', this.state, prevState);
|
|
1601
|
-
}
|
|
1602
|
-
get state() {
|
|
1603
|
-
return this._state;
|
|
1604
|
-
}
|
|
1605
1608
|
/**
|
|
1606
1609
|
* 发送数据
|
|
1607
1610
|
* @param data
|
|
@@ -1633,6 +1636,65 @@ const _clearLiveInstanceIfNeed = () => {
|
|
|
1633
1636
|
}
|
|
1634
1637
|
};
|
|
1635
1638
|
class Live extends Subscribe {
|
|
1639
|
+
get options() {
|
|
1640
|
+
return Object.freeze(this._options || {});
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* 带看状态
|
|
1644
|
+
*/
|
|
1645
|
+
get state() {
|
|
1646
|
+
return this._controller.state;
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* 兼容老逻辑
|
|
1650
|
+
* @deprecated 请直接读取 state 属性字段,未来将移除该属性
|
|
1651
|
+
*/
|
|
1652
|
+
get readyState() {
|
|
1653
|
+
return this._controller.state;
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
|
|
1657
|
+
* @deprecated 带看不需要关注底层ws的相关信息,未来将移除
|
|
1658
|
+
*/
|
|
1659
|
+
get url() {
|
|
1660
|
+
return this.options.url;
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* 获取当前live使用的RTC实例
|
|
1664
|
+
*/
|
|
1665
|
+
get $RTC() {
|
|
1666
|
+
return this._options.rtc;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* 获取当前live使用的jsBridge实例
|
|
1670
|
+
*/
|
|
1671
|
+
get jsBridge() {
|
|
1672
|
+
return this._options.jsBridge;
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* 当前帧数据快照
|
|
1676
|
+
*/
|
|
1677
|
+
get snapshot() {
|
|
1678
|
+
return this._buildInData.keyframes;
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* 当前用户信息
|
|
1682
|
+
*/
|
|
1683
|
+
get selfInfo() {
|
|
1684
|
+
return this._buildInData.selfInfo;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* 当前用户列表
|
|
1688
|
+
*/
|
|
1689
|
+
get userList() {
|
|
1690
|
+
return this._buildInData.userList || [];
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* 当前带看房间信息
|
|
1694
|
+
*/
|
|
1695
|
+
get roomInfo() {
|
|
1696
|
+
return this._buildInData.roomInfo;
|
|
1697
|
+
}
|
|
1636
1698
|
constructor(opts) {
|
|
1637
1699
|
var _a;
|
|
1638
1700
|
super();
|
|
@@ -1705,7 +1767,7 @@ class Live extends Subscribe {
|
|
|
1705
1767
|
* @param liveMsg
|
|
1706
1768
|
*/
|
|
1707
1769
|
this._handleMessage = (liveMsg) => __awaiter(this, void 0, void 0, function* () {
|
|
1708
|
-
var _b, _c, _d, _e, _f
|
|
1770
|
+
var _b, _c, _d, _e, _f;
|
|
1709
1771
|
if (typeof liveMsg === 'object') {
|
|
1710
1772
|
const { command, data = {}, frontRequestId, code, message } = liveMsg;
|
|
1711
1773
|
if (code === 'SUCCESS') {
|
|
@@ -1745,7 +1807,7 @@ class Live extends Subscribe {
|
|
|
1745
1807
|
}));
|
|
1746
1808
|
if (result) {
|
|
1747
1809
|
const status = (_f = this._options.initialMicroStatus) !== null && _f !== void 0 ? _f : MicroStatus.OPEN;
|
|
1748
|
-
yield
|
|
1810
|
+
yield this.toggleMicro(status === MicroStatus.OPEN);
|
|
1749
1811
|
}
|
|
1750
1812
|
else {
|
|
1751
1813
|
logger$1.error('加入语音房间失败');
|
|
@@ -1859,12 +1921,12 @@ class Live extends Subscribe {
|
|
|
1859
1921
|
* @returns
|
|
1860
1922
|
*/
|
|
1861
1923
|
this.connect = (options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
1862
|
-
var _h, _j, _k
|
|
1924
|
+
var _g, _h, _j, _k;
|
|
1863
1925
|
// 检查 url 和 票据获取接口实现
|
|
1864
|
-
this._options.url = (
|
|
1865
|
-
this._options.getTicket = (
|
|
1926
|
+
this._options.url = (_h = (_g = options.url) !== null && _g !== void 0 ? _g : this._options.url) !== null && _h !== void 0 ? _h : '';
|
|
1927
|
+
this._options.getTicket = (_j = options.getTicket) !== null && _j !== void 0 ? _j : this._options.getTicket;
|
|
1866
1928
|
this._options.initialMicroStatus =
|
|
1867
|
-
(
|
|
1929
|
+
(_k = options.rtcMicStatus) !== null && _k !== void 0 ? _k : this._options.initialMicroStatus;
|
|
1868
1930
|
if (!/^ws(s):\/\//.test(this._options.url) ||
|
|
1869
1931
|
typeof this._options.getTicket !== 'function') {
|
|
1870
1932
|
if (!/^ws(s):\/\//.test(this._options.url)) {
|
|
@@ -1913,11 +1975,11 @@ class Live extends Subscribe {
|
|
|
1913
1975
|
* @returns
|
|
1914
1976
|
*/
|
|
1915
1977
|
this.exit = () => __awaiter(this, void 0, void 0, function* () {
|
|
1916
|
-
var
|
|
1978
|
+
var _l;
|
|
1917
1979
|
this._clearLiveData();
|
|
1918
1980
|
try {
|
|
1919
1981
|
/** 退出强制关闭语音 */
|
|
1920
|
-
(
|
|
1982
|
+
(_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
|
|
1921
1983
|
yield this.updateStatus(BuiltinEventType.RoomChange, BuiltinActionType.RoomClose, {});
|
|
1922
1984
|
}
|
|
1923
1985
|
catch (e) {
|
|
@@ -1944,10 +2006,10 @@ class Live extends Subscribe {
|
|
|
1944
2006
|
});
|
|
1945
2007
|
// 仅用于用户自己的麦克风控制
|
|
1946
2008
|
this.toggleMicro = (microStatus) => __awaiter(this, void 0, void 0, function* () {
|
|
1947
|
-
var _o, _p
|
|
1948
|
-
if (!((
|
|
2009
|
+
var _m, _o, _p;
|
|
2010
|
+
if (!((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.control_own_micro))
|
|
1949
2011
|
return false;
|
|
1950
|
-
const result = yield ((
|
|
2012
|
+
const result = yield ((_p = this.$RTC) === null || _p === void 0 ? void 0 : _p.toggleMicro(microStatus));
|
|
1951
2013
|
if (result) {
|
|
1952
2014
|
yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserMicroStatus, {
|
|
1953
2015
|
status: microStatus ? MicroStatus.OPEN : MicroStatus.CLOSE,
|
|
@@ -1962,12 +2024,12 @@ class Live extends Subscribe {
|
|
|
1962
2024
|
* @returns
|
|
1963
2025
|
*/
|
|
1964
2026
|
this.forbidMicro = (microStatus, toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1965
|
-
var
|
|
2027
|
+
var _q, _r;
|
|
1966
2028
|
if (typeof this._options.canForbidUserMicro === 'function' &&
|
|
1967
2029
|
!this._options.canForbidUserMicro(toUserIds)) {
|
|
1968
2030
|
return false;
|
|
1969
2031
|
}
|
|
1970
|
-
if (!((
|
|
2032
|
+
if (!((_r = (_q = this.selfInfo) === null || _q === void 0 ? void 0 : _q.permission) === null || _r === void 0 ? void 0 : _r.control_other_micro)) {
|
|
1971
2033
|
return false;
|
|
1972
2034
|
}
|
|
1973
2035
|
return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserMicroStatus, {
|
|
@@ -1981,12 +2043,12 @@ class Live extends Subscribe {
|
|
|
1981
2043
|
* @returns
|
|
1982
2044
|
*/
|
|
1983
2045
|
this.forbidSync = (sync, toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1984
|
-
var
|
|
2046
|
+
var _s, _t;
|
|
1985
2047
|
if (typeof this._options.canForbidUserSync === 'function' &&
|
|
1986
2048
|
!this._options.canForbidUserSync(toUserIds)) {
|
|
1987
2049
|
return false;
|
|
1988
2050
|
}
|
|
1989
|
-
if (!((
|
|
2051
|
+
if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_sync)) {
|
|
1990
2052
|
return false;
|
|
1991
2053
|
}
|
|
1992
2054
|
return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
|
|
@@ -1997,12 +2059,12 @@ class Live extends Subscribe {
|
|
|
1997
2059
|
* @returns
|
|
1998
2060
|
*/
|
|
1999
2061
|
this.kick = (toUserIds) => __awaiter(this, void 0, void 0, function* () {
|
|
2000
|
-
var
|
|
2062
|
+
var _u, _v;
|
|
2001
2063
|
if (typeof this._options.canForbidUserKick === 'function' &&
|
|
2002
2064
|
!this._options.canForbidUserKick(toUserIds)) {
|
|
2003
2065
|
return false;
|
|
2004
2066
|
}
|
|
2005
|
-
if (!((
|
|
2067
|
+
if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.change_other_status)) {
|
|
2006
2068
|
return false;
|
|
2007
2069
|
}
|
|
2008
2070
|
return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserStatus, {
|
|
@@ -2103,65 +2165,6 @@ class Live extends Subscribe {
|
|
|
2103
2165
|
Object.assign(window, { $liveController: this._controller, $live: this });
|
|
2104
2166
|
}
|
|
2105
2167
|
}
|
|
2106
|
-
get options() {
|
|
2107
|
-
return Object.freeze(this._options || {});
|
|
2108
|
-
}
|
|
2109
|
-
/**
|
|
2110
|
-
* 带看状态
|
|
2111
|
-
*/
|
|
2112
|
-
get state() {
|
|
2113
|
-
return this._controller.state;
|
|
2114
|
-
}
|
|
2115
|
-
/**
|
|
2116
|
-
* 兼容老逻辑
|
|
2117
|
-
* @deprecated 请直接读取 state 属性字段,未来将移除该属性
|
|
2118
|
-
*/
|
|
2119
|
-
get readyState() {
|
|
2120
|
-
return this._controller.state;
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* 获取当前WebSocket连接的URL。(注意:这个是WebSocket连接的完整连接,附带一些query参数)。
|
|
2124
|
-
* @deprecated 带看不需要关注底层ws的相关信息,未来将移除
|
|
2125
|
-
*/
|
|
2126
|
-
get url() {
|
|
2127
|
-
return this.options.url;
|
|
2128
|
-
}
|
|
2129
|
-
/**
|
|
2130
|
-
* 获取当前live使用的RTC实例
|
|
2131
|
-
*/
|
|
2132
|
-
get $RTC() {
|
|
2133
|
-
return this._options.rtc;
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* 获取当前live使用的jsBridge实例
|
|
2137
|
-
*/
|
|
2138
|
-
get jsBridge() {
|
|
2139
|
-
return this._options.jsBridge;
|
|
2140
|
-
}
|
|
2141
|
-
/**
|
|
2142
|
-
* 当前帧数据快照
|
|
2143
|
-
*/
|
|
2144
|
-
get snapshot() {
|
|
2145
|
-
return this._buildInData.keyframes;
|
|
2146
|
-
}
|
|
2147
|
-
/**
|
|
2148
|
-
* 当前用户信息
|
|
2149
|
-
*/
|
|
2150
|
-
get selfInfo() {
|
|
2151
|
-
return this._buildInData.selfInfo;
|
|
2152
|
-
}
|
|
2153
|
-
/**
|
|
2154
|
-
* 当前用户列表
|
|
2155
|
-
*/
|
|
2156
|
-
get userList() {
|
|
2157
|
-
return this._buildInData.userList || [];
|
|
2158
|
-
}
|
|
2159
|
-
/**
|
|
2160
|
-
* 当前带看房间信息
|
|
2161
|
-
*/
|
|
2162
|
-
get roomInfo() {
|
|
2163
|
-
return this._buildInData.roomInfo;
|
|
2164
|
-
}
|
|
2165
2168
|
/**
|
|
2166
2169
|
* 修改状态
|
|
2167
2170
|
* @param evtType
|