@rongcloud/plugin-rtc 5.4.7-alpha.4 → 5.4.7-beem-enterprise.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/core/room/RCAudioLevelReport.d.ts +2 -0
- package/dist/core/webrtc/RCRTCPeerConnection.d.ts +10 -2
- package/dist/index.d.ts +12 -4
- package/dist/index.esm.js +123 -92
- package/dist/index.js +123 -92
- package/dist/index.umd.js +123 -92
- package/package.json +3 -3
|
@@ -10,6 +10,8 @@ export default class RCAudioLevelReport {
|
|
|
10
10
|
* 通知业务端音量 > 0 的数据,数组每一项包含 track、audioLevel
|
|
11
11
|
*/
|
|
12
12
|
private _audioLevelReport;
|
|
13
|
+
private startAutoExecute;
|
|
14
|
+
private stopAutoExecute;
|
|
13
15
|
onAudioLevelChange(handler: IAudioLevelChangeHandler | null, gap: number): void;
|
|
14
16
|
clearAudioLevelReportTimer(): void;
|
|
15
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRCRTCReportListener } from '../interfaces';
|
|
1
|
+
import { IRCRTCReportListener, IInnerRCRTCStateReport } from '../interfaces';
|
|
2
2
|
import PolarisReporter from '../PolarisReporter';
|
|
3
3
|
import { RCLocalTrack } from '../tracks/RCLocalTrack';
|
|
4
4
|
import { RCRemoteTrack } from '../tracks/RCRemoteTrack';
|
|
@@ -33,6 +33,8 @@ export default class RCRTCPeerConnection extends EventEmitter {
|
|
|
33
33
|
private _reportStatsTimer;
|
|
34
34
|
private _reportR3R4ToPolarisTimer;
|
|
35
35
|
private _isDestroyed;
|
|
36
|
+
private _reportStatsData?;
|
|
37
|
+
private _originReportStatsData?;
|
|
36
38
|
constructor(
|
|
37
39
|
/**
|
|
38
40
|
* peerConnection 对应名称
|
|
@@ -53,6 +55,8 @@ export default class RCRTCPeerConnection extends EventEmitter {
|
|
|
53
55
|
getName(): string;
|
|
54
56
|
getLocalTracks(): RCLocalTrack[];
|
|
55
57
|
private _onConnectionStateChange;
|
|
58
|
+
private startAutoExecute;
|
|
59
|
+
private stopAutoExecute;
|
|
56
60
|
private _onICEConnectionStateChange;
|
|
57
61
|
private _onTrackReady;
|
|
58
62
|
/**
|
|
@@ -87,7 +91,7 @@ export default class RCRTCPeerConnection extends EventEmitter {
|
|
|
87
91
|
* @returns 返回格式化后的数据
|
|
88
92
|
*/
|
|
89
93
|
private _getStatsData;
|
|
90
|
-
getAudioLevelReportData(): Promise<{
|
|
94
|
+
getAudioLevelReportData(gap?: number): Promise<{
|
|
91
95
|
trackId: string;
|
|
92
96
|
audioLevel: number | null;
|
|
93
97
|
}[] | undefined>;
|
|
@@ -96,6 +100,10 @@ export default class RCRTCPeerConnection extends EventEmitter {
|
|
|
96
100
|
* @todo
|
|
97
101
|
*/
|
|
98
102
|
private _reportHandle;
|
|
103
|
+
/**
|
|
104
|
+
* 获取缓存的本地质量数据
|
|
105
|
+
*/
|
|
106
|
+
_getCacheStatsData(): IInnerRCRTCStateReport | null | undefined;
|
|
99
107
|
/**
|
|
100
108
|
* 北极星上报 R3、R4 数据
|
|
101
109
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.4.7-
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.4.7-beem-enterprise.1
|
|
3
|
+
* CommitId - f6d422487789e25a83b33d99ce339c2d264d3d88
|
|
4
|
+
* Wed Sep 21 2022 12:27:46 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
import { EventEmitter, RTCMode, IRuntime, RTCPluginContext, IJoinRTCRoomData, IReceivedMessage, ErrorCode, RTCJoinType, IRTCUserData, KVString, IServerRTCRoomEntry, LogLevel, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
|
|
@@ -2517,6 +2517,8 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
2517
2517
|
private _reportStatsTimer;
|
|
2518
2518
|
private _reportR3R4ToPolarisTimer;
|
|
2519
2519
|
private _isDestroyed;
|
|
2520
|
+
private _reportStatsData?;
|
|
2521
|
+
private _originReportStatsData?;
|
|
2520
2522
|
constructor(
|
|
2521
2523
|
/**
|
|
2522
2524
|
* peerConnection 对应名称
|
|
@@ -2537,6 +2539,8 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
2537
2539
|
getName(): string;
|
|
2538
2540
|
getLocalTracks(): RCLocalTrack[];
|
|
2539
2541
|
private _onConnectionStateChange;
|
|
2542
|
+
private startAutoExecute;
|
|
2543
|
+
private stopAutoExecute;
|
|
2540
2544
|
private _onICEConnectionStateChange;
|
|
2541
2545
|
private _onTrackReady;
|
|
2542
2546
|
/**
|
|
@@ -2571,7 +2575,7 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
2571
2575
|
* @returns 返回格式化后的数据
|
|
2572
2576
|
*/
|
|
2573
2577
|
private _getStatsData;
|
|
2574
|
-
getAudioLevelReportData(): Promise<{
|
|
2578
|
+
getAudioLevelReportData(gap?: number): Promise<{
|
|
2575
2579
|
trackId: string;
|
|
2576
2580
|
audioLevel: number | null;
|
|
2577
2581
|
}[] | undefined>;
|
|
@@ -2580,6 +2584,10 @@ declare class RCRTCPeerConnection extends EventEmitter {
|
|
|
2580
2584
|
* @todo
|
|
2581
2585
|
*/
|
|
2582
2586
|
private _reportHandle;
|
|
2587
|
+
/**
|
|
2588
|
+
* 获取缓存的本地质量数据
|
|
2589
|
+
*/
|
|
2590
|
+
_getCacheStatsData(): IInnerRCRTCStateReport | null | undefined;
|
|
2583
2591
|
/**
|
|
2584
2592
|
* 北极星上报 R3、R4 数据
|
|
2585
2593
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.4.7-
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.4.7-beem-enterprise.1
|
|
3
|
+
* CommitId - f6d422487789e25a83b33d99ce339c2d264d3d88
|
|
4
|
+
* Wed Sep 21 2022 12:27:46 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
import { Logger, EventEmitter, logger as logger$1, LogSource, isNumber, validate, ErrorCode, HttpMethod, ConnectionStatus, RTCMode, notEmptyString, isObject as isObject$1, isString, RTCJoinType, RTCApiType, isArray, assert, ConversationType, isHttpUrl, isBoolean, isUndefined, RTCIdentityChangeType, VersionManage } from '@rongcloud/engine';
|
|
@@ -6474,7 +6474,8 @@ class RCTrack extends EventEmitter {
|
|
|
6474
6474
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6475
6475
|
logger$1.info(RCLoggerTag.L_TRACK_PLAY_T, {
|
|
6476
6476
|
element,
|
|
6477
|
-
options
|
|
6477
|
+
options,
|
|
6478
|
+
msg: `start play trackId: ${this._id}`
|
|
6478
6479
|
}, {
|
|
6479
6480
|
logSource: LogSource.RTC
|
|
6480
6481
|
});
|
|
@@ -7545,7 +7546,7 @@ const isNull = (val) => {
|
|
|
7545
7546
|
* 公有云连接私有云 SDK 为非法连接
|
|
7546
7547
|
*/
|
|
7547
7548
|
const isIllegalConnection = (navi) => {
|
|
7548
|
-
return
|
|
7549
|
+
return !true ;
|
|
7549
7550
|
};
|
|
7550
7551
|
/**
|
|
7551
7552
|
* 获取将要发布的 track 数量
|
|
@@ -7939,7 +7940,7 @@ const getCommonHeader = () => ({
|
|
|
7939
7940
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
7940
7941
|
'Cache-Control': 'no-cache',
|
|
7941
7942
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
7942
|
-
ClientVersion: "5.4.7-
|
|
7943
|
+
ClientVersion: "5.4.7-beem-enterprise.1",
|
|
7943
7944
|
'Client-Session-Id': getUUID(),
|
|
7944
7945
|
'Request-Id': Date.now().toString()
|
|
7945
7946
|
});
|
|
@@ -8457,16 +8458,11 @@ class AbstractStatParser {
|
|
|
8457
8458
|
});
|
|
8458
8459
|
}
|
|
8459
8460
|
parseRTCStatsReport(reports) {
|
|
8460
|
-
const keys = reports.keys();
|
|
8461
8461
|
const stats = {};
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
const value = reports.get(key);
|
|
8466
|
-
if (!/^RTCCodec_/.test(key)) {
|
|
8467
|
-
stats[key] = value;
|
|
8462
|
+
for (const key of reports.keys()) {
|
|
8463
|
+
if (!key.includes('RTCCodec_')) {
|
|
8464
|
+
stats[key] = reports.get(key);
|
|
8468
8465
|
}
|
|
8469
|
-
temp = keys.next();
|
|
8470
8466
|
}
|
|
8471
8467
|
return stats;
|
|
8472
8468
|
}
|
|
@@ -9592,7 +9588,7 @@ class ASdpStrategy {
|
|
|
9592
9588
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9593
9589
|
// 过滤行末的空格,服务可能产生空格数据
|
|
9594
9590
|
sdp = ASdpBuilder.trimBlankLine(sdp);
|
|
9595
|
-
logger
|
|
9591
|
+
logger.info(`set remote answer -> ${sdp}`);
|
|
9596
9592
|
try {
|
|
9597
9593
|
yield this._peer.setRemoteDescription({ type: 'answer', sdp });
|
|
9598
9594
|
}
|
|
@@ -10229,6 +10225,10 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10229
10225
|
// 上报上下行数据至北极星定时器
|
|
10230
10226
|
this._reportR3R4ToPolarisTimer = null;
|
|
10231
10227
|
this._isDestroyed = false;
|
|
10228
|
+
// 格式化后的质量数据
|
|
10229
|
+
this._reportStatsData = null;
|
|
10230
|
+
// 格式化之前的质量数据
|
|
10231
|
+
this._originReportStatsData = null;
|
|
10232
10232
|
this._reportListener = null;
|
|
10233
10233
|
const sdpSemantics = ASdpStrategy.getSdpSemantics();
|
|
10234
10234
|
const peer = this._rtcPeerConn = new RTCPeerConnection({ sdpSemantics });
|
|
@@ -10260,15 +10260,24 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10260
10260
|
logSource: LogSource.RTC
|
|
10261
10261
|
});
|
|
10262
10262
|
}
|
|
10263
|
+
startAutoExecute(gap = 1000) {
|
|
10264
|
+
this._reportStatsTimer = setTimeout(() => {
|
|
10265
|
+
this._reportHandle(gap);
|
|
10266
|
+
this._reportStatsTimer = this.startAutoExecute();
|
|
10267
|
+
}, gap);
|
|
10268
|
+
}
|
|
10269
|
+
stopAutoExecute() {
|
|
10270
|
+
clearTimeout(this._reportStatsTimer);
|
|
10271
|
+
}
|
|
10263
10272
|
_onICEConnectionStateChange() {
|
|
10264
10273
|
var _a, _b;
|
|
10265
10274
|
logger.info(`oniceconnectionstatechange -> ${this._rtcPeerConn.iceConnectionState}, ${this._pcName}`);
|
|
10266
10275
|
if (this._rtcPeerConn.iceConnectionState === 'connected') {
|
|
10267
10276
|
// 开启 peerConnection stats 统计定时器
|
|
10268
10277
|
if (this._reportStatsTimer) {
|
|
10269
|
-
|
|
10278
|
+
this.stopAutoExecute();
|
|
10270
10279
|
}
|
|
10271
|
-
this.
|
|
10280
|
+
this.startAutoExecute();
|
|
10272
10281
|
}
|
|
10273
10282
|
// ICE 连接中断后,需要尝试重新走 exchange 流程以恢复
|
|
10274
10283
|
if (this._rtcPeerConn.iceConnectionState === 'failed' || this._rtcPeerConn.iceConnectionState === 'disconnected') {
|
|
@@ -10523,33 +10532,53 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10523
10532
|
* 获取 peerConnection stats 数据并格式化
|
|
10524
10533
|
* @returns 返回格式化后的数据
|
|
10525
10534
|
*/
|
|
10526
|
-
_getStatsData() {
|
|
10527
|
-
var _a, _b;
|
|
10535
|
+
_getStatsData(gap = 1000) {
|
|
10536
|
+
var _a, _b, _c;
|
|
10528
10537
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10538
|
+
let data = null;
|
|
10539
|
+
if (((_a = this._originReportStatsData) === null || _a === void 0 ? void 0 : _a.timestamp) && this._originReportStatsData.timestamp > Date.now() - gap) {
|
|
10540
|
+
data = this._originReportStatsData.data;
|
|
10541
|
+
}
|
|
10542
|
+
else {
|
|
10543
|
+
const reports = yield this._rtcPeerConn.getStats();
|
|
10544
|
+
/**
|
|
10545
|
+
* 解析 stats 数据
|
|
10546
|
+
*/
|
|
10547
|
+
data = (_b = this.reportParser) === null || _b === void 0 ? void 0 : _b.parseRTCStatsReport(reports);
|
|
10548
|
+
this._originReportStatsData = {
|
|
10549
|
+
data,
|
|
10550
|
+
timestamp: Date.now()
|
|
10551
|
+
};
|
|
10552
|
+
}
|
|
10534
10553
|
/**
|
|
10535
10554
|
* 获取 report 中的 iceCandidatePair、senders、receivers 中的所有字段
|
|
10536
10555
|
*/
|
|
10537
|
-
const formatData = (
|
|
10556
|
+
const formatData = (_c = this.reportParser) === null || _c === void 0 ? void 0 : _c.formatRCRTCStateReport(data);
|
|
10538
10557
|
return formatData;
|
|
10539
10558
|
});
|
|
10540
10559
|
}
|
|
10541
|
-
getAudioLevelReportData() {
|
|
10542
|
-
var _a, _b;
|
|
10560
|
+
getAudioLevelReportData(gap = 1000) {
|
|
10561
|
+
var _a, _b, _c;
|
|
10543
10562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10563
|
+
let data = null;
|
|
10564
|
+
if (((_a = this._originReportStatsData) === null || _a === void 0 ? void 0 : _a.timestamp) && this._originReportStatsData.timestamp > Date.now() - gap) {
|
|
10565
|
+
data = this._originReportStatsData.data;
|
|
10566
|
+
}
|
|
10567
|
+
else {
|
|
10568
|
+
const reports = yield this._rtcPeerConn.getStats();
|
|
10569
|
+
/**
|
|
10570
|
+
* 解析 stats 数据
|
|
10571
|
+
*/
|
|
10572
|
+
data = (_b = this.reportParser) === null || _b === void 0 ? void 0 : _b.parseRTCStatsReport(reports);
|
|
10573
|
+
this._originReportStatsData = {
|
|
10574
|
+
data,
|
|
10575
|
+
timestamp: Date.now()
|
|
10576
|
+
};
|
|
10577
|
+
}
|
|
10549
10578
|
if (!data) {
|
|
10550
10579
|
return [];
|
|
10551
10580
|
}
|
|
10552
|
-
const audioLevelData = (
|
|
10581
|
+
const audioLevelData = (_c = this.reportParser) === null || _c === void 0 ? void 0 : _c.getAudioLevelList(data);
|
|
10553
10582
|
return audioLevelData;
|
|
10554
10583
|
});
|
|
10555
10584
|
}
|
|
@@ -10557,13 +10586,14 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10557
10586
|
* 通知用户质量数据、peerConnection 北极星数据上报
|
|
10558
10587
|
* @todo
|
|
10559
10588
|
*/
|
|
10560
|
-
_reportHandle() {
|
|
10589
|
+
_reportHandle(gap) {
|
|
10561
10590
|
var _a, _b;
|
|
10562
10591
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10563
|
-
const formatData = yield this._getStatsData();
|
|
10592
|
+
const formatData = yield this._getStatsData(gap);
|
|
10564
10593
|
if (!formatData) {
|
|
10565
10594
|
return;
|
|
10566
10595
|
}
|
|
10596
|
+
this._reportStatsData = formatData;
|
|
10567
10597
|
/**
|
|
10568
10598
|
* 组装用户层抛出数据
|
|
10569
10599
|
*/
|
|
@@ -10571,13 +10601,19 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10571
10601
|
(_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, reportData);
|
|
10572
10602
|
});
|
|
10573
10603
|
}
|
|
10604
|
+
/**
|
|
10605
|
+
* 获取缓存的本地质量数据
|
|
10606
|
+
*/
|
|
10607
|
+
_getCacheStatsData() {
|
|
10608
|
+
return this._reportStatsData;
|
|
10609
|
+
}
|
|
10574
10610
|
/**
|
|
10575
10611
|
* 北极星上报 R3、R4 数据
|
|
10576
10612
|
*/
|
|
10577
10613
|
_sendR3R4Data() {
|
|
10578
10614
|
var _a;
|
|
10579
10615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10580
|
-
const formatData =
|
|
10616
|
+
const formatData = this._getCacheStatsData();
|
|
10581
10617
|
if (!formatData) {
|
|
10582
10618
|
return true;
|
|
10583
10619
|
}
|
|
@@ -10596,7 +10632,9 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10596
10632
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10597
10633
|
clearTimeout(this._reportR3R4ToPolarisTimer);
|
|
10598
10634
|
yield this._sendR3R4Data();
|
|
10599
|
-
this._reportR3R4ToPolarisTimer = setTimeout(
|
|
10635
|
+
this._reportR3R4ToPolarisTimer = setTimeout(() => {
|
|
10636
|
+
this.__reportR3R4ToPolaris();
|
|
10637
|
+
}, 2000);
|
|
10600
10638
|
});
|
|
10601
10639
|
}
|
|
10602
10640
|
getRTCPeerConn() {
|
|
@@ -10608,7 +10646,7 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
10608
10646
|
clearTimeout(this._reportR3R4ToPolarisTimer);
|
|
10609
10647
|
// 停止计时
|
|
10610
10648
|
if (this._reportStatsTimer) {
|
|
10611
|
-
|
|
10649
|
+
this.stopAutoExecute();
|
|
10612
10650
|
this._reportStatsTimer = null;
|
|
10613
10651
|
}
|
|
10614
10652
|
this.registerReportListener(null);
|
|
@@ -10835,7 +10873,7 @@ class PolarisReporter {
|
|
|
10835
10873
|
* 加入房间
|
|
10836
10874
|
*/
|
|
10837
10875
|
sendR1() {
|
|
10838
|
-
const rtcVersion = "5.4.7-
|
|
10876
|
+
const rtcVersion = "5.4.7-beem-enterprise.1";
|
|
10839
10877
|
const imVersion = this._context.getCoreVersion();
|
|
10840
10878
|
const platform = 'web';
|
|
10841
10879
|
const pcName = navigator.platform;
|
|
@@ -10868,7 +10906,7 @@ class RCAudioLevelReport {
|
|
|
10868
10906
|
/**
|
|
10869
10907
|
* 通知业务端音量 > 0 的数据,数组每一项包含 track、audioLevel
|
|
10870
10908
|
*/
|
|
10871
|
-
_audioLevelReport() {
|
|
10909
|
+
_audioLevelReport(gap) {
|
|
10872
10910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10873
10911
|
if (!this._audioLevelChangeHandler) {
|
|
10874
10912
|
return;
|
|
@@ -10880,23 +10918,31 @@ class RCAudioLevelReport {
|
|
|
10880
10918
|
if (pc.getRTCPeerConn().iceConnectionState === 'new') {
|
|
10881
10919
|
return;
|
|
10882
10920
|
}
|
|
10883
|
-
const audioLevelData = yield pc.getAudioLevelReportData();
|
|
10884
|
-
|
|
10921
|
+
const audioLevelData = yield pc.getAudioLevelReportData(gap);
|
|
10922
|
+
audioLevelData === null || audioLevelData === void 0 ? void 0 : audioLevelData.forEach(item => {
|
|
10885
10923
|
const { userId } = parseTrackId(item.trackId);
|
|
10886
10924
|
const isLocal = this._room.getCrtUserId() === userId;
|
|
10887
10925
|
const track = isLocal ? this._room.getLocalTrack(item.trackId) : this._room.getRemoteTrack(item.trackId);
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10926
|
+
if (track) {
|
|
10927
|
+
audioLevelList.push({
|
|
10928
|
+
track,
|
|
10929
|
+
audioLevel: item.audioLevel || 0
|
|
10930
|
+
});
|
|
10931
|
+
}
|
|
10894
10932
|
});
|
|
10895
|
-
audioLevelList.push(...list);
|
|
10896
10933
|
}
|
|
10897
10934
|
this._audioLevelChangeHandler(audioLevelList);
|
|
10898
10935
|
});
|
|
10899
10936
|
}
|
|
10937
|
+
startAutoExecute(gap = 1000) {
|
|
10938
|
+
this._timer = setTimeout(() => {
|
|
10939
|
+
this._audioLevelReport(gap);
|
|
10940
|
+
this._timer = this.startAutoExecute(gap);
|
|
10941
|
+
}, gap);
|
|
10942
|
+
}
|
|
10943
|
+
stopAutoExecute() {
|
|
10944
|
+
clearTimeout(this._timer);
|
|
10945
|
+
}
|
|
10900
10946
|
onAudioLevelChange(handler, gap) {
|
|
10901
10947
|
if (gap < 300 || gap > 1000) {
|
|
10902
10948
|
logger.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000');
|
|
@@ -10907,12 +10953,12 @@ class RCAudioLevelReport {
|
|
|
10907
10953
|
}
|
|
10908
10954
|
else {
|
|
10909
10955
|
this._audioLevelChangeHandler = handler;
|
|
10910
|
-
this.
|
|
10956
|
+
this.startAutoExecute(gap);
|
|
10911
10957
|
}
|
|
10912
10958
|
}
|
|
10913
10959
|
clearAudioLevelReportTimer() {
|
|
10914
10960
|
if (this._timer) {
|
|
10915
|
-
|
|
10961
|
+
this.stopAutoExecute();
|
|
10916
10962
|
this._timer = null;
|
|
10917
10963
|
}
|
|
10918
10964
|
}
|
|
@@ -11658,14 +11704,7 @@ class JoinRoomCommand extends BaseCommand {
|
|
|
11658
11704
|
}, { logSource: LogSource.RTC });
|
|
11659
11705
|
return { code: RCRTCCode.SIGNAL_DISCONNECTED };
|
|
11660
11706
|
}
|
|
11661
|
-
if (isIllegalConnection(context.getNaviInfo()))
|
|
11662
|
-
logger$1.error(logTag, {
|
|
11663
|
-
status: RCLoggerStatus.FAILED,
|
|
11664
|
-
code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,
|
|
11665
|
-
msg: 'navi_usl error'
|
|
11666
|
-
}, { logSource: LogSource.RTC });
|
|
11667
|
-
return { code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR };
|
|
11668
|
-
}
|
|
11707
|
+
if (isIllegalConnection(context.getNaviInfo())) ;
|
|
11669
11708
|
if (!validate('roomId', this.roomId, notEmptyString, true)) {
|
|
11670
11709
|
logger$1.error(logTag, {
|
|
11671
11710
|
status: RCLoggerStatus.FAILED,
|
|
@@ -12124,7 +12163,7 @@ class ParseUserStateCommand extends BaseCommand {
|
|
|
12124
12163
|
users.forEach(item => {
|
|
12125
12164
|
const userId = item.userId;
|
|
12126
12165
|
if (+item.state === 0) {
|
|
12127
|
-
logger.
|
|
12166
|
+
logger.info(`user joined -> ${userId}`);
|
|
12128
12167
|
// 对端 im 重连之后调加入房间信令获取最新数据,服务会给本端下发“对端加入房间”的消息,本端内存已包含对端人员,所以需过滤掉
|
|
12129
12168
|
const resArr = store.getResourcesByUserId(userId);
|
|
12130
12169
|
if (!resArr) {
|
|
@@ -12133,7 +12172,7 @@ class ParseUserStateCommand extends BaseCommand {
|
|
|
12133
12172
|
store.setResourcesByUserId(userId, resArr || []);
|
|
12134
12173
|
}
|
|
12135
12174
|
else {
|
|
12136
|
-
logger.
|
|
12175
|
+
logger.info(`user left -> ${userId}`);
|
|
12137
12176
|
item.switchRoleType ? downgrade.push(userId) : left.push(userId);
|
|
12138
12177
|
}
|
|
12139
12178
|
});
|
|
@@ -13514,12 +13553,14 @@ class RCAbstractRoom extends EventEmitter {
|
|
|
13514
13553
|
}
|
|
13515
13554
|
__parseInnerMessage(message) {
|
|
13516
13555
|
const { targetId: roomId, conversationType } = message;
|
|
13517
|
-
// 过滤非 RTC 消息
|
|
13518
|
-
if (conversationType !== ConversationType.RTC_ROOM) {
|
|
13519
|
-
return false;
|
|
13520
|
-
}
|
|
13521
13556
|
// 为 RTC 消息,但不属于当前房间的不处理
|
|
13522
13557
|
if (roomId !== this._roomId) {
|
|
13558
|
+
logger$1.warn(RCLoggerTag.L_RTC_CLIENT_MESSAGE_O, {
|
|
13559
|
+
status: RCLoggerStatus.FAILED,
|
|
13560
|
+
message: `roomId is different, msg roomId-> ${roomId}, this._roomId-> ${this._roomId} `
|
|
13561
|
+
}, {
|
|
13562
|
+
logSource: LogSource.RTC
|
|
13563
|
+
});
|
|
13523
13564
|
return true;
|
|
13524
13565
|
}
|
|
13525
13566
|
logger.info(`recv inner msg -> message: ${JSON.stringify(message)} | roomid: ${this._roomId}`);
|
|
@@ -16772,16 +16813,7 @@ class RCAudienceClient {
|
|
|
16772
16813
|
logSource: LogSource.RTC
|
|
16773
16814
|
});
|
|
16774
16815
|
const tracks = [];
|
|
16775
|
-
if (isIllegalConnection(this._context.getNaviInfo()))
|
|
16776
|
-
logger$1.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, {
|
|
16777
|
-
status: RCLoggerStatus.FAILED,
|
|
16778
|
-
code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,
|
|
16779
|
-
msg: 'navi_url error'
|
|
16780
|
-
}, {
|
|
16781
|
-
logSource: LogSource.RTC
|
|
16782
|
-
});
|
|
16783
|
-
return { code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR, tracks };
|
|
16784
|
-
}
|
|
16816
|
+
if (isIllegalConnection(this._context.getNaviInfo())) ;
|
|
16785
16817
|
// 客户端主动调用 api 发请求时,清除 ice 断线重连的定时器
|
|
16786
16818
|
!this._fromRetry && ((_a = this._pc) === null || _a === void 0 ? void 0 : _a.clearReTryExchangeTimer());
|
|
16787
16819
|
this._fromRetry = false;
|
|
@@ -18791,7 +18823,6 @@ class RCRTCClient extends RCMediaStreamCapture {
|
|
|
18791
18823
|
this._context.onmessage = this._handleMessage.bind(this);
|
|
18792
18824
|
}
|
|
18793
18825
|
_handleMessage(message) {
|
|
18794
|
-
var _a;
|
|
18795
18826
|
// 过滤非 RTC 消息
|
|
18796
18827
|
if (message.conversationType !== ConversationType.RTC_ROOM) {
|
|
18797
18828
|
return false;
|
|
@@ -18803,13 +18834,22 @@ class RCRTCClient extends RCMediaStreamCapture {
|
|
|
18803
18834
|
room.__parseInnerMessage(message);
|
|
18804
18835
|
});
|
|
18805
18836
|
}
|
|
18806
|
-
(_a = this._crtRoom) === null || _a === void 0 ? void 0 : _a.__parseInnerMessage(message);
|
|
18807
18837
|
logger$1.info(RCLoggerTag.L_RTC_CLIENT_MESSAGE_O, {
|
|
18808
18838
|
status: RCLoggerStatus.SUCCESSED,
|
|
18809
|
-
message
|
|
18839
|
+
message
|
|
18810
18840
|
}, {
|
|
18811
18841
|
logSource: LogSource.RTC
|
|
18812
18842
|
});
|
|
18843
|
+
if (!this._crtRoom) {
|
|
18844
|
+
logger$1.warn(RCLoggerTag.L_RTC_CLIENT_MESSAGE_O, {
|
|
18845
|
+
status: RCLoggerStatus.FAILED,
|
|
18846
|
+
message: 'the crtRoom is empty'
|
|
18847
|
+
}, {
|
|
18848
|
+
logSource: LogSource.RTC
|
|
18849
|
+
});
|
|
18850
|
+
return true;
|
|
18851
|
+
}
|
|
18852
|
+
this._crtRoom.__parseInnerMessage(message);
|
|
18813
18853
|
return true;
|
|
18814
18854
|
}
|
|
18815
18855
|
/**
|
|
@@ -19012,16 +19052,7 @@ class RCRTCClient extends RCMediaStreamCapture {
|
|
|
19012
19052
|
}, {
|
|
19013
19053
|
logSource: LogSource.RTC
|
|
19014
19054
|
});
|
|
19015
|
-
if (isIllegalConnection(this._context.getNaviInfo()))
|
|
19016
|
-
logger$1.error(RCLoggerTag.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R, {
|
|
19017
|
-
status: RCLoggerStatus.FAILED,
|
|
19018
|
-
code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,
|
|
19019
|
-
msg: 'navi_url error'
|
|
19020
|
-
}, {
|
|
19021
|
-
logSource: LogSource.RTC
|
|
19022
|
-
});
|
|
19023
|
-
return { code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR };
|
|
19024
|
-
}
|
|
19055
|
+
if (isIllegalConnection(this._context.getNaviInfo())) ;
|
|
19025
19056
|
if (!(validate('roomId', roomId, notEmptyString, true) &&
|
|
19026
19057
|
validate('livingType', livingType, (value) => value === RCLivingType.AUDIO || value === RCLivingType.VIDEO))) {
|
|
19027
19058
|
logger$1.error(RCLoggerTag.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R, {
|
|
@@ -19329,9 +19360,9 @@ const installer = {
|
|
|
19329
19360
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
19330
19361
|
return false;
|
|
19331
19362
|
}
|
|
19332
|
-
VersionManage.add('plugin-rtc', "5.4.7-
|
|
19333
|
-
if (!VersionManage.validEngine("5.
|
|
19334
|
-
logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"5.
|
|
19363
|
+
VersionManage.add('plugin-rtc', "5.4.7-beem-enterprise.1");
|
|
19364
|
+
if (!VersionManage.validEngine("5.4.2-beem-enterprise.2")) {
|
|
19365
|
+
logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"5.4.2-beem-enterprise.2"}'.`);
|
|
19335
19366
|
return false;
|
|
19336
19367
|
}
|
|
19337
19368
|
return true;
|
|
@@ -19340,7 +19371,7 @@ const installer = {
|
|
|
19340
19371
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19341
19372
|
logger.setLogLevel(options.logLevel);
|
|
19342
19373
|
logger.setLogStdout(options.logStdout);
|
|
19343
|
-
logger.warn(`RCRTC Version: ${"5.4.7-
|
|
19374
|
+
logger.warn(`RCRTC Version: ${"5.4.7-beem-enterprise.1"}, Commit: ${"f6d422487789e25a83b33d99ce339c2d264d3d88"}`);
|
|
19344
19375
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
19345
19376
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
19346
19377
|
logger.warn(`browserInfo.version -> ${browserInfo.version}`);
|