@rongcloud/plugin-rtc 5.6.4-alpha.1 → 5.6.5-beem
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.d.ts +15 -23
- package/dist/index.esm.js +117 -176
- package/dist/index.js +117 -176
- package/dist/index.umd.js +117 -176
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.6.
|
|
3
|
-
* CommitId -
|
|
4
|
-
* Fri
|
|
2
|
+
* RCRTC - v5.6.5-beem
|
|
3
|
+
* CommitId - 6bae08310b35cf5ec94005dfbf39555ce874cd7c
|
|
4
|
+
* Fri Dec 09 2022 10:16:58 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
@@ -7420,15 +7420,6 @@
|
|
|
7420
7420
|
}
|
|
7421
7421
|
}
|
|
7422
7422
|
class RCLocalFileTrack extends RCLocalTrack {
|
|
7423
|
-
constructor(tag, userId, kind, track,
|
|
7424
|
-
/**
|
|
7425
|
-
* 自定义文件流的播放宿主原生,该类型流所持有的 MediaStreamTrack 实例是由该宿主元素 `captureStream` 获取
|
|
7426
|
-
*/
|
|
7427
|
-
_resource) {
|
|
7428
|
-
super(tag, userId, kind, track);
|
|
7429
|
-
this._resource = _resource;
|
|
7430
|
-
RCLocalFileTrack.__innerSetMapping(this.getTrackId(), _resource);
|
|
7431
|
-
}
|
|
7432
7423
|
/**
|
|
7433
7424
|
* 建立 trackId 与宿主播放元素的映射关系
|
|
7434
7425
|
* @param trackId
|
|
@@ -7451,6 +7442,15 @@
|
|
|
7451
7442
|
video.src = '';
|
|
7452
7443
|
(_b = video.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(video);
|
|
7453
7444
|
}
|
|
7445
|
+
constructor(tag, userId, kind, track,
|
|
7446
|
+
/**
|
|
7447
|
+
* 自定义文件流的播放宿主原生,该类型流所持有的 MediaStreamTrack 实例是由该宿主元素 `captureStream` 获取
|
|
7448
|
+
*/
|
|
7449
|
+
_resource) {
|
|
7450
|
+
super(tag, userId, kind, track);
|
|
7451
|
+
this._resource = _resource;
|
|
7452
|
+
RCLocalFileTrack.__innerSetMapping(this.getTrackId(), _resource);
|
|
7453
|
+
}
|
|
7454
7454
|
destroy() {
|
|
7455
7455
|
this.isAudioTrack() && this.mute();
|
|
7456
7456
|
RCLocalFileTrack.__innerRemoveMapping(this.getTrackId(), this._resource);
|
|
@@ -14816,7 +14816,7 @@
|
|
|
14816
14816
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
14817
14817
|
'Cache-Control': 'no-cache',
|
|
14818
14818
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
14819
|
-
ClientVersion: "5.6.
|
|
14819
|
+
ClientVersion: "5.6.5-beem",
|
|
14820
14820
|
'Client-Session-Id': getUUID(),
|
|
14821
14821
|
'Request-Id': Date.now().toString(),
|
|
14822
14822
|
});
|
|
@@ -15054,6 +15054,10 @@
|
|
|
15054
15054
|
}
|
|
15055
15055
|
memo.mediaService.push(data);
|
|
15056
15056
|
};
|
|
15057
|
+
const clearMediaServerRequestData = () => {
|
|
15058
|
+
const memo = Memo.getMemo();
|
|
15059
|
+
memo.mediaService = [];
|
|
15060
|
+
};
|
|
15057
15061
|
const reportQualitySubscribeAndUnsubscribeData = (attrs, code) => {
|
|
15058
15062
|
var _a;
|
|
15059
15063
|
const memo = Memo.getMemo();
|
|
@@ -15085,6 +15089,7 @@
|
|
|
15085
15089
|
logger.__statistics(RCLoggerTag.L_QS_UNSUBSCRIBE_S, reportData);
|
|
15086
15090
|
});
|
|
15087
15091
|
}
|
|
15092
|
+
clearMediaServerRequestData();
|
|
15088
15093
|
};
|
|
15089
15094
|
const recordIceStatusData = (params) => {
|
|
15090
15095
|
var _a, _b, _c, _d, _e;
|
|
@@ -15191,6 +15196,7 @@
|
|
|
15191
15196
|
const reportData = JSON.stringify(Object.assign(Object.assign({}, memo.qualityPublishReportData), { dur: dateNow - (((_a = memo.publish) === null || _a === void 0 ? void 0 : _a.start) || 0), cod: code, msas, time: dateNow, resid: track.getTrackId(), mtp: parseTrackId(track.getTrackId()).mediaType, smct: track instanceof RCLocalVideoTrack && track.__isTiny() ? 2 : 1 }));
|
|
15192
15197
|
logger.__statistics(RCLoggerTag.L_QS_PUBLISH_S, reportData);
|
|
15193
15198
|
});
|
|
15199
|
+
clearMediaServerRequestData();
|
|
15194
15200
|
};
|
|
15195
15201
|
const reportQualityPublishSignalTotalData = (allPublishList, code) => {
|
|
15196
15202
|
var _a, _b;
|
|
@@ -15216,6 +15222,7 @@
|
|
|
15216
15222
|
sigs, time: dateNow, resid: getTrackId(resource), mtp: resource.mediaType, smct: resource.simulcast }));
|
|
15217
15223
|
logger.__statistics(RCLoggerTag.L_QS_PUBLISH_S, reportData);
|
|
15218
15224
|
});
|
|
15225
|
+
clearMediaServerRequestData();
|
|
15219
15226
|
};
|
|
15220
15227
|
const recordPublishSignalTotalData = () => {
|
|
15221
15228
|
const memo = Memo.getMemo();
|
|
@@ -15273,6 +15280,7 @@
|
|
|
15273
15280
|
sigs, time: dateNow, resid: trackId, mtp: parseTrackId(trackId).mediaType, smct: track instanceof RCLocalVideoTrack && track.__isTiny() ? 2 : 1 }));
|
|
15274
15281
|
logger.__statistics(RCLoggerTag.L_QS_UNPUBLISH_S, reportData);
|
|
15275
15282
|
});
|
|
15283
|
+
clearMediaServerRequestData();
|
|
15276
15284
|
};
|
|
15277
15285
|
const reportQualityUnpublishSignalTotalData = (unpublishList, code) => {
|
|
15278
15286
|
var _a, _b;
|
|
@@ -15301,6 +15309,7 @@
|
|
|
15301
15309
|
logger.__statistics(RCLoggerTag.L_QS_UNPUBLISH_S, reportData);
|
|
15302
15310
|
}
|
|
15303
15311
|
});
|
|
15312
|
+
clearMediaServerRequestData();
|
|
15304
15313
|
};
|
|
15305
15314
|
const reportQualityRecvPubMsgData = (roomId, sessionId, userId, sentTime, senderUserId) => {
|
|
15306
15315
|
var _a;
|
|
@@ -15392,7 +15401,7 @@
|
|
|
15392
15401
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
15393
15402
|
'Cache-Control': 'no-cache',
|
|
15394
15403
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
15395
|
-
ClientVersion: "5.6.
|
|
15404
|
+
ClientVersion: "5.6.5-beem",
|
|
15396
15405
|
'Client-Session-Id': getUUID(),
|
|
15397
15406
|
'Request-Id': Date.now().toString(),
|
|
15398
15407
|
});
|
|
@@ -15522,7 +15531,7 @@
|
|
|
15522
15531
|
* @param header
|
|
15523
15532
|
* @param body
|
|
15524
15533
|
*/
|
|
15525
|
-
_request(path, headers, body, traceId) {
|
|
15534
|
+
_request(path, headers, body, traceId, isNeedUpdateMsas) {
|
|
15526
15535
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15527
15536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15528
15537
|
const openGzip = ((_a = this._context.getNaviInfo()) === null || _a === void 0 ? void 0 : _a.openGzip) || false;
|
|
@@ -15573,7 +15582,7 @@
|
|
|
15573
15582
|
method: engine.HttpMethod.POST,
|
|
15574
15583
|
timeout: this._timeout,
|
|
15575
15584
|
});
|
|
15576
|
-
recordMediaServiceRequestData({
|
|
15585
|
+
isNeedUpdateMsas && recordMediaServiceRequestData({
|
|
15577
15586
|
start,
|
|
15578
15587
|
end: Date.now(),
|
|
15579
15588
|
reqId,
|
|
@@ -15612,10 +15621,10 @@
|
|
|
15612
15621
|
* @param header
|
|
15613
15622
|
* @param body
|
|
15614
15623
|
*/
|
|
15615
|
-
exchange(headers, body, traceId) {
|
|
15624
|
+
exchange(headers, body, traceId, isNeedUpdateMsas) {
|
|
15616
15625
|
var _a;
|
|
15617
15626
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15618
|
-
const data = yield this._request('/exchange', headers, body, traceId);
|
|
15627
|
+
const data = yield this._request('/exchange', headers, body, traceId, isNeedUpdateMsas);
|
|
15619
15628
|
if (data.code === exports.RCRTCCode.SUCCESS && ((_a = data.data) === null || _a === void 0 ? void 0 : _a.resultCode) === exports.RCRTCCode.SUCCESS) {
|
|
15620
15629
|
const { urls } = data.data;
|
|
15621
15630
|
if (urls) {
|
|
@@ -15785,9 +15794,10 @@
|
|
|
15785
15794
|
* 处理音量 * 100,并向下取整
|
|
15786
15795
|
*/
|
|
15787
15796
|
const handleAudioLevel = (audioLevel, factor = 2) => {
|
|
15788
|
-
if (audioLevel > 1) {
|
|
15789
|
-
|
|
15790
|
-
}
|
|
15797
|
+
// if (audioLevel > 1) {
|
|
15798
|
+
// audioLevel /= 32767;
|
|
15799
|
+
// }
|
|
15800
|
+
(audioLevel > 1) && (audioLevel = 1);
|
|
15791
15801
|
const rate = 10 ** factor;
|
|
15792
15802
|
return Math.round(audioLevel * rate);
|
|
15793
15803
|
};
|
|
@@ -16832,6 +16842,12 @@
|
|
|
16832
16842
|
* 从而获取 SDPHeader | videoStreams | audioStreams 并对其内容进行处理
|
|
16833
16843
|
*/
|
|
16834
16844
|
class ASdpBuilder {
|
|
16845
|
+
get videoSdps() {
|
|
16846
|
+
return this.videoStreams.slice();
|
|
16847
|
+
}
|
|
16848
|
+
get audioSdps() {
|
|
16849
|
+
return this.audioStreams.slice();
|
|
16850
|
+
}
|
|
16835
16851
|
constructor(SDP, type) {
|
|
16836
16852
|
this.SDP = SDP;
|
|
16837
16853
|
this.type = type;
|
|
@@ -16844,12 +16860,6 @@
|
|
|
16844
16860
|
this.spliteStreams(streamPositions);
|
|
16845
16861
|
this._logger = RTCLogger.getLogger();
|
|
16846
16862
|
}
|
|
16847
|
-
get videoSdps() {
|
|
16848
|
-
return this.videoStreams.slice();
|
|
16849
|
-
}
|
|
16850
|
-
get audioSdps() {
|
|
16851
|
-
return this.audioStreams.slice();
|
|
16852
|
-
}
|
|
16853
16863
|
/**
|
|
16854
16864
|
* 它从 SDP 中删除空行和尾随空格
|
|
16855
16865
|
* @param {string} sdp - 要处理的 SDP 字符串。
|
|
@@ -17115,12 +17125,6 @@
|
|
|
17115
17125
|
RtpTransceiverDirection["INACTIVE"] = "inactive";
|
|
17116
17126
|
})(RtpTransceiverDirection || (RtpTransceiverDirection = {}));
|
|
17117
17127
|
class ASdpStrategy {
|
|
17118
|
-
constructor(_peer) {
|
|
17119
|
-
this._peer = _peer;
|
|
17120
|
-
this._outboundStreams = {};
|
|
17121
|
-
this._logger = null;
|
|
17122
|
-
this._logger = RTCLogger.getLogger();
|
|
17123
|
-
}
|
|
17124
17128
|
/**
|
|
17125
17129
|
* 设置指定的 SDP 协议版本
|
|
17126
17130
|
* @param sdpSemantics 优先版本
|
|
@@ -17169,6 +17173,12 @@
|
|
|
17169
17173
|
static getSdpSemantics() {
|
|
17170
17174
|
return ASdpStrategy._sdpSemantics;
|
|
17171
17175
|
}
|
|
17176
|
+
constructor(_peer) {
|
|
17177
|
+
this._peer = _peer;
|
|
17178
|
+
this._outboundStreams = {};
|
|
17179
|
+
this._logger = null;
|
|
17180
|
+
this._logger = RTCLogger.getLogger();
|
|
17181
|
+
}
|
|
17172
17182
|
getOutboundVideoInfo() {
|
|
17173
17183
|
const result = [];
|
|
17174
17184
|
for (const msid in this._outboundStreams) {
|
|
@@ -17366,7 +17376,7 @@
|
|
|
17366
17376
|
offer.sdp = offer.sdp.replace(new RegExp(streamId, 'g'), msid);
|
|
17367
17377
|
}
|
|
17368
17378
|
if (offer.sdp) {
|
|
17369
|
-
offer.sdp =
|
|
17379
|
+
offer.sdp = this.resetSdp(offer.sdp);
|
|
17370
17380
|
}
|
|
17371
17381
|
yield this._peer.setLocalDescription(offer);
|
|
17372
17382
|
return { type: 'offer', semantics: 'plan-b', sdp: offer.sdp };
|
|
@@ -17954,9 +17964,7 @@
|
|
|
17954
17964
|
this._reportR3R4ToPolarisTimer = null;
|
|
17955
17965
|
this._isDestroyed = false;
|
|
17956
17966
|
// 格式化后的质量数据
|
|
17957
|
-
this.
|
|
17958
|
-
// 格式化之前的质量数据
|
|
17959
|
-
this._originReportStatsData = null;
|
|
17967
|
+
this._formatStatsData = null;
|
|
17960
17968
|
// 日志上传实例
|
|
17961
17969
|
this._logger = null;
|
|
17962
17970
|
this._reportListener = null;
|
|
@@ -17986,11 +17994,11 @@
|
|
|
17986
17994
|
pcName: this._pcName,
|
|
17987
17995
|
}));
|
|
17988
17996
|
}
|
|
17989
|
-
startAutoExecute(gap
|
|
17997
|
+
startAutoExecute(gap) {
|
|
17990
17998
|
this.stopAutoExecute();
|
|
17991
17999
|
this._reportStatsTimer = setTimeout(() => {
|
|
17992
|
-
this._reportHandle(
|
|
17993
|
-
this.startAutoExecute();
|
|
18000
|
+
this._reportHandle();
|
|
18001
|
+
this.startAutoExecute(gap);
|
|
17994
18002
|
}, gap);
|
|
17995
18003
|
}
|
|
17996
18004
|
stopAutoExecute() {
|
|
@@ -18014,8 +18022,7 @@
|
|
|
18014
18022
|
reportQualityFirstSubOrPubStatusData();
|
|
18015
18023
|
reportQualityIceStatusData();
|
|
18016
18024
|
// 开启 peerConnection stats 统计定时器
|
|
18017
|
-
this.
|
|
18018
|
-
this.startAutoExecute();
|
|
18025
|
+
this.startAutoExecute(1000);
|
|
18019
18026
|
}
|
|
18020
18027
|
// ICE 连接中断后,需要尝试重新走 exchange 流程以恢复
|
|
18021
18028
|
if (this._rtcPeerConn.iceConnectionState === 'failed' || this._rtcPeerConn.iceConnectionState === 'disconnected') {
|
|
@@ -18251,73 +18258,48 @@
|
|
|
18251
18258
|
* 获取 peerConnection stats 数据并格式化
|
|
18252
18259
|
* @returns 返回格式化后的数据
|
|
18253
18260
|
*/
|
|
18254
|
-
_getStatsData(
|
|
18255
|
-
var _a, _b
|
|
18261
|
+
_getStatsData() {
|
|
18262
|
+
var _a, _b;
|
|
18256
18263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18264
|
+
this._formatStatsData = null;
|
|
18257
18265
|
let data = null;
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
/**
|
|
18264
|
-
* 解析 stats 数据
|
|
18265
|
-
*/
|
|
18266
|
-
data = (_b = this.reportParser) === null || _b === void 0 ? void 0 : _b.parseRTCStatsReport(reports);
|
|
18267
|
-
this._originReportStatsData = {
|
|
18268
|
-
data,
|
|
18269
|
-
timestamp: Date.now(),
|
|
18270
|
-
};
|
|
18271
|
-
}
|
|
18266
|
+
const reports = yield this._rtcPeerConn.getStats();
|
|
18267
|
+
/**
|
|
18268
|
+
* 解析 stats 数据
|
|
18269
|
+
*/
|
|
18270
|
+
data = (_a = this.reportParser) === null || _a === void 0 ? void 0 : _a.parseRTCStatsReport(reports);
|
|
18272
18271
|
/**
|
|
18273
18272
|
* 获取 report 中的 iceCandidatePair、senders、receivers 中的所有字段
|
|
18274
18273
|
*/
|
|
18275
|
-
const formatData = (
|
|
18274
|
+
const formatData = (_b = this.reportParser) === null || _b === void 0 ? void 0 : _b.formatRCRTCStateReport(data);
|
|
18275
|
+
this._formatStatsData = formatData;
|
|
18276
18276
|
return formatData;
|
|
18277
18277
|
});
|
|
18278
18278
|
}
|
|
18279
|
-
getAudioLevelReportData(gap = 1000) {
|
|
18280
|
-
var _a, _b, _c;
|
|
18281
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18282
|
-
let data = null;
|
|
18283
|
-
if (((_a = this._originReportStatsData) === null || _a === void 0 ? void 0 : _a.timestamp) && this._originReportStatsData.timestamp > Date.now() - gap) {
|
|
18284
|
-
data = this._originReportStatsData.data;
|
|
18285
|
-
}
|
|
18286
|
-
else {
|
|
18287
|
-
const reports = yield this._rtcPeerConn.getStats();
|
|
18288
|
-
/**
|
|
18289
|
-
* 解析 stats 数据
|
|
18290
|
-
*/
|
|
18291
|
-
data = (_b = this.reportParser) === null || _b === void 0 ? void 0 : _b.parseRTCStatsReport(reports);
|
|
18292
|
-
this._originReportStatsData = {
|
|
18293
|
-
data,
|
|
18294
|
-
timestamp: Date.now(),
|
|
18295
|
-
};
|
|
18296
|
-
}
|
|
18297
|
-
if (!data) {
|
|
18298
|
-
return [];
|
|
18299
|
-
}
|
|
18300
|
-
const audioLevelData = (_c = this.reportParser) === null || _c === void 0 ? void 0 : _c.getAudioLevelList(data);
|
|
18301
|
-
return audioLevelData;
|
|
18302
|
-
});
|
|
18303
|
-
}
|
|
18304
18279
|
/**
|
|
18305
18280
|
* 通知用户质量数据、peerConnection 北极星数据上报
|
|
18306
18281
|
* @todo
|
|
18307
18282
|
*/
|
|
18308
|
-
_reportHandle(
|
|
18283
|
+
_reportHandle() {
|
|
18309
18284
|
var _a, _b, _c, _d;
|
|
18310
18285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18311
|
-
const formatData = yield this._getStatsData(
|
|
18286
|
+
const formatData = yield this._getStatsData();
|
|
18312
18287
|
if (!formatData) {
|
|
18313
18288
|
return;
|
|
18314
18289
|
}
|
|
18315
|
-
this._reportStatsData = formatData;
|
|
18316
18290
|
/**
|
|
18317
|
-
*
|
|
18291
|
+
* 组装质量数据,给业务层上报
|
|
18318
18292
|
*/
|
|
18319
18293
|
const reportData = this._createRCRTCStateReport(formatData);
|
|
18320
18294
|
(_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, reportData);
|
|
18295
|
+
/**
|
|
18296
|
+
* 获取音量数据,给业务层上报
|
|
18297
|
+
*/
|
|
18298
|
+
const audioLevelList = [...formatData.receivers, ...formatData.senders].filter((item) => !!(item.kind === 'audio')).map((item) => ({
|
|
18299
|
+
trackId: item.trackId,
|
|
18300
|
+
audioLevel: item.audioLevel,
|
|
18301
|
+
}));
|
|
18302
|
+
this.emit(RCRTCPeerConnection.__INNER_AUDIOLEVEL_CHANGE__, audioLevelList);
|
|
18321
18303
|
/**
|
|
18322
18304
|
* 仅观众加房间上报合流音源信息
|
|
18323
18305
|
*/
|
|
@@ -18348,21 +18330,13 @@
|
|
|
18348
18330
|
};
|
|
18349
18331
|
}).filter((item) => !!item.userId);
|
|
18350
18332
|
}
|
|
18351
|
-
/**
|
|
18352
|
-
* 获取缓存的本地质量数据
|
|
18353
|
-
*/
|
|
18354
|
-
_getCacheStatsData() {
|
|
18355
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18356
|
-
return this._getStatsData();
|
|
18357
|
-
});
|
|
18358
|
-
}
|
|
18359
18333
|
/**
|
|
18360
18334
|
* 北极星上报 R3、R4 数据
|
|
18361
18335
|
*/
|
|
18362
18336
|
_sendR3R4Data() {
|
|
18363
18337
|
var _a, _b;
|
|
18364
18338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18365
|
-
const formatData =
|
|
18339
|
+
const formatData = this._formatStatsData;
|
|
18366
18340
|
if (!formatData) {
|
|
18367
18341
|
return true;
|
|
18368
18342
|
}
|
|
@@ -18500,6 +18474,7 @@
|
|
|
18500
18474
|
}
|
|
18501
18475
|
}
|
|
18502
18476
|
RCRTCPeerConnection.__INNER_EVENT_TRACK_READY__ = 'inner-track-ready';
|
|
18477
|
+
RCRTCPeerConnection.__INNER_AUDIOLEVEL_CHANGE__ = 'inner-audio-level-change';
|
|
18503
18478
|
|
|
18504
18479
|
/**
|
|
18505
18480
|
* 流状态
|
|
@@ -18718,7 +18693,7 @@
|
|
|
18718
18693
|
* 加入房间
|
|
18719
18694
|
*/
|
|
18720
18695
|
sendR1() {
|
|
18721
|
-
const rtcVersion = "5.6.
|
|
18696
|
+
const rtcVersion = "5.6.5-beem";
|
|
18722
18697
|
const imVersion = this._context.getCoreVersion();
|
|
18723
18698
|
const platform = 'web';
|
|
18724
18699
|
const pcName = navigator.platform;
|
|
@@ -18868,7 +18843,7 @@
|
|
|
18868
18843
|
_formatR1Data() {
|
|
18869
18844
|
return {
|
|
18870
18845
|
joinTime: this._context.userJoinTime || 0,
|
|
18871
|
-
rtcVersion: "5.6.
|
|
18846
|
+
rtcVersion: "5.6.5-beem",
|
|
18872
18847
|
imVersion: this._context.getCoreVersion(),
|
|
18873
18848
|
platform: 'web',
|
|
18874
18849
|
device: navigator.platform,
|
|
@@ -19030,66 +19005,30 @@
|
|
|
19030
19005
|
this._room = _room;
|
|
19031
19006
|
// 音量上报事件
|
|
19032
19007
|
this._audioLevelChangeHandler = null;
|
|
19033
|
-
// 音量上报定时器
|
|
19034
|
-
this._timer = null;
|
|
19035
19008
|
}
|
|
19036
19009
|
/**
|
|
19037
19010
|
* 通知业务端音量 > 0 的数据,数组每一项包含 track、audioLevel
|
|
19038
19011
|
*/
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
const
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19052
|
-
audioLevelData === null || audioLevelData === void 0 ? void 0 : audioLevelData.forEach((item) => {
|
|
19053
|
-
const { userId } = parseTrackId(item.trackId);
|
|
19054
|
-
const isLocal = this._room.getCrtUserId() === userId;
|
|
19055
|
-
const track = isLocal ? this._room.getLocalTrack(item.trackId) : this._room.getRemoteTrack(item.trackId);
|
|
19056
|
-
if (track) {
|
|
19057
|
-
audioLevelList.push({
|
|
19058
|
-
track,
|
|
19059
|
-
audioLevel: item.audioLevel || 0,
|
|
19060
|
-
});
|
|
19061
|
-
}
|
|
19012
|
+
audioLevelReport(audioLevelData) {
|
|
19013
|
+
if (!this._audioLevelChangeHandler) {
|
|
19014
|
+
return;
|
|
19015
|
+
}
|
|
19016
|
+
const audioLevelList = [];
|
|
19017
|
+
audioLevelData.forEach((item) => {
|
|
19018
|
+
const { userId } = parseTrackId(item.trackId);
|
|
19019
|
+
const isLocal = this._room.getCrtUserId() === userId;
|
|
19020
|
+
const track = isLocal ? this._room.getLocalTrack(item.trackId) : this._room.getRemoteTrack(item.trackId);
|
|
19021
|
+
if (track) {
|
|
19022
|
+
audioLevelList.push({
|
|
19023
|
+
track,
|
|
19024
|
+
audioLevel: item.audioLevel || 0,
|
|
19062
19025
|
});
|
|
19063
19026
|
}
|
|
19064
|
-
this._audioLevelChangeHandler(audioLevelList);
|
|
19065
19027
|
});
|
|
19028
|
+
this._audioLevelChangeHandler(audioLevelList);
|
|
19066
19029
|
}
|
|
19067
|
-
|
|
19068
|
-
this.
|
|
19069
|
-
this._timer = setTimeout(() => {
|
|
19070
|
-
this._audioLevelReport(gap);
|
|
19071
|
-
this.startAutoExecute(gap);
|
|
19072
|
-
}, gap);
|
|
19073
|
-
}
|
|
19074
|
-
stopAutoExecute() {
|
|
19075
|
-
clearTimeout(this._timer);
|
|
19076
|
-
}
|
|
19077
|
-
onAudioLevelChange(handler, gap) {
|
|
19078
|
-
if (gap < 300 || gap > 1000) {
|
|
19079
|
-
const logger = RTCLogger.getLogger();
|
|
19080
|
-
logger === null || logger === void 0 ? void 0 : logger.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000');
|
|
19081
|
-
return;
|
|
19082
|
-
}
|
|
19083
|
-
if (!handler) {
|
|
19084
|
-
this._audioLevelChangeHandler = null;
|
|
19085
|
-
}
|
|
19086
|
-
else {
|
|
19087
|
-
this._audioLevelChangeHandler = handler;
|
|
19088
|
-
this.startAutoExecute(gap);
|
|
19089
|
-
}
|
|
19090
|
-
}
|
|
19091
|
-
clearAudioLevelReportTimer() {
|
|
19092
|
-
this.stopAutoExecute();
|
|
19030
|
+
onAudioLevelChange(handler) {
|
|
19031
|
+
this._audioLevelChangeHandler = handler;
|
|
19093
19032
|
}
|
|
19094
19033
|
}
|
|
19095
19034
|
|
|
@@ -20169,16 +20108,17 @@
|
|
|
20169
20108
|
})(RCInnerCDNBroadcast || (RCInnerCDNBroadcast = {}));
|
|
20170
20109
|
|
|
20171
20110
|
class ExchangeCommand extends BaseCommand {
|
|
20172
|
-
constructor(headers, reqBody, traceId) {
|
|
20111
|
+
constructor(headers, reqBody, traceId, isNeedUpdateMsas) {
|
|
20173
20112
|
super();
|
|
20174
20113
|
this.headers = headers;
|
|
20175
20114
|
this.reqBody = reqBody;
|
|
20176
20115
|
this.traceId = traceId;
|
|
20116
|
+
this.isNeedUpdateMsas = isNeedUpdateMsas;
|
|
20177
20117
|
}
|
|
20178
20118
|
execute(store, invoker) {
|
|
20179
20119
|
var _a, _b;
|
|
20180
20120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20181
|
-
const res = yield store.service.exchange(this.headers, this.reqBody, this.traceId);
|
|
20121
|
+
const res = yield store.service.exchange(this.headers, this.reqBody, this.traceId, this.isNeedUpdateMsas);
|
|
20182
20122
|
if (store.roomMode !== RTCMode.LIVE) {
|
|
20183
20123
|
return res;
|
|
20184
20124
|
}
|
|
@@ -20293,7 +20233,7 @@
|
|
|
20293
20233
|
* 直播房间需携带 pushOtherRooms 信息
|
|
20294
20234
|
*/
|
|
20295
20235
|
pushOtherRooms && (reqBody.pushOtherRooms = pushOtherRooms);
|
|
20296
|
-
const result = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
|
|
20236
|
+
const result = yield new ExchangeCommand(headers, reqBody, this.traceId, true).execute(store, invoker);
|
|
20297
20237
|
attrs.map((item) => item.track.getTrackId());
|
|
20298
20238
|
if (result.code !== exports.RCRTCCode.SUCCESS) {
|
|
20299
20239
|
reportQualitySubscribeAndUnsubscribeData(attrs, result.code);
|
|
@@ -20849,6 +20789,12 @@
|
|
|
20849
20789
|
let parseData;
|
|
20850
20790
|
const userId = this.senderId;
|
|
20851
20791
|
const { messageType } = this;
|
|
20792
|
+
/**
|
|
20793
|
+
* 房间内没有某个人时,不再处理此人的资源数据
|
|
20794
|
+
*/
|
|
20795
|
+
if (!store.getRemoteUserIds().includes(userId)) {
|
|
20796
|
+
return;
|
|
20797
|
+
}
|
|
20852
20798
|
// 当前资源清单
|
|
20853
20799
|
const nowResources = store.getResourcesByUserId(userId) || [];
|
|
20854
20800
|
switch (messageType) {
|
|
@@ -21139,7 +21085,7 @@
|
|
|
21139
21085
|
pushOtherRooms && (reqBody.pushOtherRooms = pushOtherRooms);
|
|
21140
21086
|
// 缓存发布资源的ssrc和msid
|
|
21141
21087
|
AbstractStatParser.formatSourceIdMapFromSdp(reqBody.sdp.sdp, 'publish');
|
|
21142
|
-
const resp = yield new ExchangeCommand(headers, reqBody, this._traceId).execute(store, invoker);
|
|
21088
|
+
const resp = yield new ExchangeCommand(headers, reqBody, this._traceId, true).execute(store, invoker);
|
|
21143
21089
|
if (resp.code !== exports.RCRTCCode.SUCCESS) {
|
|
21144
21090
|
// 连通率相关埋点-发布资源结束
|
|
21145
21091
|
reportQualityPublishData(localTracks, resp.code);
|
|
@@ -21388,7 +21334,7 @@
|
|
|
21388
21334
|
*/
|
|
21389
21335
|
const { pushOtherRooms, headers } = this.unpubhook(tracks, pcName);
|
|
21390
21336
|
pushOtherRooms && (reqBody.pushOtherRooms = pushOtherRooms);
|
|
21391
|
-
const result = yield new ExchangeCommand(headers, reqBody, this._traceId).execute(store, invoker);
|
|
21337
|
+
const result = yield new ExchangeCommand(headers, reqBody, this._traceId, true).execute(store, invoker);
|
|
21392
21338
|
if (result.code !== exports.RCRTCCode.SUCCESS) {
|
|
21393
21339
|
// 连通率相关埋点-取消发布资源结束
|
|
21394
21340
|
reportQualityUnpublishData(tracks, result.code);
|
|
@@ -22830,7 +22776,6 @@
|
|
|
22830
22776
|
remoteTracks.forEach((track) => track.mute());
|
|
22831
22777
|
}
|
|
22832
22778
|
_leaveHandle(quitRoom) {
|
|
22833
|
-
var _a;
|
|
22834
22779
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22835
22780
|
if (this._invoker.isDestroyed()) {
|
|
22836
22781
|
return;
|
|
@@ -22841,9 +22786,6 @@
|
|
|
22841
22786
|
this._invoker.destroy();
|
|
22842
22787
|
// 静默所有远端音视频
|
|
22843
22788
|
this._muteRemoteTracksBeforeQuit();
|
|
22844
|
-
this._muteRemoteTracksBeforeQuit();
|
|
22845
|
-
// 清除音量上报定时器
|
|
22846
|
-
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
22847
22789
|
if (quitRoom) {
|
|
22848
22790
|
// 退出 signal 房间
|
|
22849
22791
|
yield this._context.quitRTCRoom(this._roomId);
|
|
@@ -22960,6 +22902,7 @@
|
|
|
22960
22902
|
_subhook(tracks) {
|
|
22961
22903
|
const { pc, pcName } = this._peerCManager.createPeerCList(tracks)[0];
|
|
22962
22904
|
pc.on(RCRTCPeerConnection.__INNER_EVENT_TRACK_READY__, this._onTrackReady, this);
|
|
22905
|
+
this._audioLevelReport && pc.on(RCRTCPeerConnection.__INNER_AUDIOLEVEL_CHANGE__, this._audioLevelReport.audioLevelReport, this._audioLevelReport);
|
|
22963
22906
|
// 发送上下行数据至北极星
|
|
22964
22907
|
pc.__reportR3R4ToPolaris();
|
|
22965
22908
|
pc.registerReportListener(this._reportListener);
|
|
@@ -22973,6 +22916,7 @@
|
|
|
22973
22916
|
const { pc, pcName } = item;
|
|
22974
22917
|
pc.on(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, this._onLocalTrackMuted, this);
|
|
22975
22918
|
pc.on(RCLocalTrack.__INNER_EVENT_DESTROY__, this._onLocalTrackDestroied, this);
|
|
22919
|
+
this._audioLevelReport && pc.on(RCRTCPeerConnection.__INNER_AUDIOLEVEL_CHANGE__, this._audioLevelReport.audioLevelReport, this._audioLevelReport);
|
|
22976
22920
|
pc.registerReportListener(this._reportListener);
|
|
22977
22921
|
// 发送上下行数据至北极星
|
|
22978
22922
|
pc.__reportR3R4ToPolaris();
|
|
@@ -23126,15 +23070,14 @@
|
|
|
23126
23070
|
* @param gap 上报时间间隔
|
|
23127
23071
|
*/
|
|
23128
23072
|
onAudioLevelChange(handler, gap) {
|
|
23129
|
-
var _a, _b
|
|
23073
|
+
var _a, _b;
|
|
23130
23074
|
(_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_AUDIO_LEVEL_O, JSON.stringify({
|
|
23131
23075
|
status: RCLoggerStatus.SUCCESSED,
|
|
23132
23076
|
handler: handler === null || handler === void 0 ? void 0 : handler.name,
|
|
23133
23077
|
gap,
|
|
23134
23078
|
}));
|
|
23135
|
-
(_c = this._audioLevelReport) === null || _c === void 0 ? void 0 : _c.clearAudioLevelReportTimer();
|
|
23136
23079
|
this._audioLevelReport = new RCAudioLevelReport(this);
|
|
23137
|
-
this._audioLevelReport.onAudioLevelChange(handler
|
|
23080
|
+
this._audioLevelReport.onAudioLevelChange(handler);
|
|
23138
23081
|
}
|
|
23139
23082
|
/**
|
|
23140
23083
|
* 断线重连后尝试补发断线过程中的通知信息
|
|
@@ -24244,7 +24187,7 @@
|
|
|
24244
24187
|
const reqBody = yield createExchangeParams(subscribeList, false, pc, store);
|
|
24245
24188
|
const { pushOtherRooms, headers } = this.hooks(pcNameList[index]);
|
|
24246
24189
|
reqBody.pushOtherRooms = pushOtherRooms;
|
|
24247
|
-
const resp = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
|
|
24190
|
+
const resp = yield new ExchangeCommand(headers, reqBody, this.traceId, true).execute(store, invoker);
|
|
24248
24191
|
if (resp.code !== exports.RCRTCCode.SUCCESS) {
|
|
24249
24192
|
(_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
|
|
24250
24193
|
status: RCLoggerStatus.FAILED,
|
|
@@ -26333,6 +26276,7 @@
|
|
|
26333
26276
|
}));
|
|
26334
26277
|
this._callAppListener('onTrackReady', rTrack);
|
|
26335
26278
|
});
|
|
26279
|
+
this._audioLevelReport && this._pc.on(RCRTCPeerConnection.__INNER_AUDIOLEVEL_CHANGE__, this._audioLevelReport.audioLevelReport, this._audioLevelReport);
|
|
26336
26280
|
}
|
|
26337
26281
|
_getReqHeaders() {
|
|
26338
26282
|
const userId = this._crtUserId;
|
|
@@ -26698,14 +26642,12 @@
|
|
|
26698
26642
|
* 退出房间并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
26699
26643
|
*/
|
|
26700
26644
|
__destroy(quitRoom) {
|
|
26701
|
-
var _a
|
|
26645
|
+
var _a;
|
|
26702
26646
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26703
26647
|
if (this._destroyed) {
|
|
26704
26648
|
return;
|
|
26705
26649
|
}
|
|
26706
26650
|
this._destroyed = true;
|
|
26707
|
-
// 清除音量上报定时器
|
|
26708
|
-
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
26709
26651
|
// 退出 signal 房间
|
|
26710
26652
|
if (quitRoom) {
|
|
26711
26653
|
yield this._context.quitLivingRoomAsAudience(this._roomId);
|
|
@@ -26713,7 +26655,7 @@
|
|
|
26713
26655
|
// 中断与 MediaServer 的连接
|
|
26714
26656
|
yield this._service.broadcastExit(this._getReqHeaders());
|
|
26715
26657
|
// 销毁 pc 连接
|
|
26716
|
-
(
|
|
26658
|
+
(_a = this._pc) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
26717
26659
|
// 销毁 memo 缓存
|
|
26718
26660
|
Memo.destroy();
|
|
26719
26661
|
// 销毁 polarisReport 实例
|
|
@@ -26774,11 +26716,10 @@
|
|
|
26774
26716
|
* @param gap 上报时间间隔
|
|
26775
26717
|
*/
|
|
26776
26718
|
onAudioLevelChange(handler, gap) {
|
|
26777
|
-
var _a, _b
|
|
26778
|
-
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
26719
|
+
var _a, _b;
|
|
26779
26720
|
this._audioLevelReport = new RCAudioLevelReport(this);
|
|
26780
|
-
this._audioLevelReport.onAudioLevelChange(handler
|
|
26781
|
-
(
|
|
26721
|
+
this._audioLevelReport.onAudioLevelChange(handler);
|
|
26722
|
+
(_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
|
|
26782
26723
|
handler: handler === null || handler === void 0 ? void 0 : handler.name,
|
|
26783
26724
|
gap,
|
|
26784
26725
|
}));
|
|
@@ -28103,7 +28044,7 @@
|
|
|
28103
28044
|
}
|
|
28104
28045
|
reportSDKInfo() {
|
|
28105
28046
|
this._context.reportSDKInfo({
|
|
28106
|
-
'plugin-rtc': "5.6.
|
|
28047
|
+
'plugin-rtc': "5.6.5-beem",
|
|
28107
28048
|
});
|
|
28108
28049
|
}
|
|
28109
28050
|
}
|
|
@@ -29096,7 +29037,7 @@ message probuf {
|
|
|
29096
29037
|
console.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
29097
29038
|
return false;
|
|
29098
29039
|
}
|
|
29099
|
-
engine.VersionManage.add('plugin-rtc', "5.6.
|
|
29040
|
+
engine.VersionManage.add('plugin-rtc', "5.6.5-beem");
|
|
29100
29041
|
if (!engine.VersionManage.validEngine("^5.6.0")) {
|
|
29101
29042
|
console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
|
|
29102
29043
|
return false;
|
|
@@ -29110,8 +29051,8 @@ message probuf {
|
|
|
29110
29051
|
RTCLogger.setLogger(originLogger);
|
|
29111
29052
|
logger.setLogger(originLogger);
|
|
29112
29053
|
originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
|
|
29113
|
-
'RCRTC Version': "5.6.
|
|
29114
|
-
Commit: "
|
|
29054
|
+
'RCRTC Version': "5.6.5-beem",
|
|
29055
|
+
Commit: "6bae08310b35cf5ec94005dfbf39555ce874cd7c",
|
|
29115
29056
|
'browserInfo.browser': browserInfo.browser,
|
|
29116
29057
|
'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
|
|
29117
29058
|
'browserInfo.version': browserInfo.version,
|