@rongcloud/plugin-rtc 5.2.4-beem.1 → 5.2.4-beem.4
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 +8 -3
- package/dist/index.esm.js +81 -51
- package/dist/index.js +81 -51
- package/dist/index.umd.js +81 -51
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.2.4-beem.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.2.4-beem.4
|
|
3
|
+
* CommitId - a3cdebb13c1c9a8f31555277f185522a69f7e42f
|
|
4
|
+
* Fri May 20 2022 19:05:14 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
import { EventEmitter, LogLevel, RTCMode, IRuntime, RTCPluginContext, IServerRTCRoomEntry, IJoinRTCRoomData, IReceivedMessage, KVString, RTCJoinType, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';
|
|
@@ -2226,6 +2226,11 @@ declare abstract class RCAbstractRoom {
|
|
|
2226
2226
|
* 退出并销毁当前房间实例,退出后该房间的所有方法将不可用
|
|
2227
2227
|
*/
|
|
2228
2228
|
__destroy(quitRoom: boolean): Promise<void>;
|
|
2229
|
+
/**
|
|
2230
|
+
* 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
|
|
2231
|
+
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
2232
|
+
*/
|
|
2233
|
+
private _muteRemoteTracksBeforeQuit;
|
|
2229
2234
|
private _leaveHandle;
|
|
2230
2235
|
private _onLocalTrackDestroied;
|
|
2231
2236
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.2.4-beem.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.2.4-beem.4
|
|
3
|
+
* CommitId - a3cdebb13c1c9a8f31555277f185522a69f7e42f
|
|
4
|
+
* Fri May 20 2022 19:05:14 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
import { Logger, EventEmitter, isNumber, ErrorCode, ConnectionStatus, assert, ConversationType, RTCApiType, validate, isArray, RTCMode, isHttpUrl, isBoolean, HttpMethod, isString, notEmptyString, RTCJoinType, RTCIdentityChangeType, VersionManage } from '@rongcloud/engine';
|
|
@@ -137,6 +137,7 @@ class AsyncTaskQueue {
|
|
|
137
137
|
}
|
|
138
138
|
this.locked = true;
|
|
139
139
|
const { resolve, task, reject } = this.queue.shift();
|
|
140
|
+
logger.info(`async task queue waiting length -> ${this.queue.length}`);
|
|
140
141
|
let result;
|
|
141
142
|
try {
|
|
142
143
|
result = yield task();
|
|
@@ -152,7 +153,8 @@ class AsyncTaskQueue {
|
|
|
152
153
|
}
|
|
153
154
|
push(task) {
|
|
154
155
|
const promise = new Promise((resolve, reject) => {
|
|
155
|
-
this.queue.push({ resolve, task, reject });
|
|
156
|
+
const length = this.queue.push({ resolve, task, reject });
|
|
157
|
+
logger.info(`async task queue length -> ${length}`);
|
|
156
158
|
});
|
|
157
159
|
this.checkToStart();
|
|
158
160
|
return promise;
|
|
@@ -6589,54 +6591,66 @@ class Pinger {
|
|
|
6589
6591
|
* 记录最近一次成功的 Ping 时间戳
|
|
6590
6592
|
*/
|
|
6591
6593
|
this._latestTimestamp = Date.now();
|
|
6594
|
+
this._started = false;
|
|
6592
6595
|
this._timer = null;
|
|
6593
6596
|
}
|
|
6594
6597
|
/**
|
|
6595
6598
|
* 启动 Ping
|
|
6596
6599
|
*/
|
|
6597
6600
|
start() {
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6601
|
+
if (this._started) {
|
|
6602
|
+
return;
|
|
6603
|
+
}
|
|
6604
|
+
logger.info('rtcping start ->');
|
|
6605
|
+
this._started = true;
|
|
6606
|
+
this._checkAlive();
|
|
6607
|
+
}
|
|
6608
|
+
_sendPing() {
|
|
6609
|
+
return new Promise(resolve => {
|
|
6610
|
+
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6611
|
+
.then(resolve)
|
|
6612
|
+
.catch(error => {
|
|
6613
|
+
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6614
|
+
resolve(ErrorCode.UNKNOWN);
|
|
6615
|
+
});
|
|
6616
|
+
setTimeout(resolve, PING_TIMEOUT, ErrorCode.TIMEOUT);
|
|
6604
6617
|
});
|
|
6605
6618
|
}
|
|
6606
|
-
|
|
6619
|
+
_checkAlive() {
|
|
6607
6620
|
var _a, _b, _c;
|
|
6608
6621
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6609
|
-
|
|
6610
|
-
const code = yield
|
|
6611
|
-
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6612
|
-
.then(resolve)
|
|
6613
|
-
.catch(error => {
|
|
6614
|
-
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6615
|
-
resolve(ErrorCode.UNKNOWN);
|
|
6616
|
-
});
|
|
6617
|
-
setTimeout(resolve, PING_TIMEOUT, ErrorCode.TIMEOUT);
|
|
6618
|
-
});
|
|
6622
|
+
logger.info('rtcping ->');
|
|
6623
|
+
const code = yield this._sendPing();
|
|
6619
6624
|
const now = Date.now();
|
|
6620
|
-
// ping
|
|
6625
|
+
// ping 成功
|
|
6621
6626
|
if (code === ErrorCode.SUCCESS) {
|
|
6622
|
-
|
|
6627
|
+
logger.info('rtcping success ->');
|
|
6623
6628
|
this._latestTimestamp = now;
|
|
6624
6629
|
(_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, RCRTCPingResult.SUCCESS);
|
|
6630
|
+
// 延迟递归
|
|
6631
|
+
this._timer = setTimeout(() => this._checkAlive(), this._gap);
|
|
6625
6632
|
return;
|
|
6626
6633
|
}
|
|
6627
|
-
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, RCRTCPingResult.FAIL);
|
|
6628
6634
|
logger.warn(`rtcping failed -> code: ${code}`);
|
|
6635
|
+
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, RCRTCPingResult.FAIL);
|
|
6629
6636
|
// 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
|
|
6630
6637
|
if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
|
|
6631
6638
|
this.stop();
|
|
6632
6639
|
(_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
|
|
6640
|
+
return;
|
|
6633
6641
|
}
|
|
6642
|
+
// 延迟发 rtcping,避免调用栈递归阻塞
|
|
6643
|
+
this._timer = setTimeout(() => this._checkAlive(), 500);
|
|
6634
6644
|
});
|
|
6635
6645
|
}
|
|
6636
6646
|
stop() {
|
|
6647
|
+
if (!this._started) {
|
|
6648
|
+
return;
|
|
6649
|
+
}
|
|
6650
|
+
logger.info('rtcping stop ->');
|
|
6651
|
+
this._started = false;
|
|
6637
6652
|
if (this._timer) {
|
|
6638
|
-
|
|
6639
|
-
clearInterval(this._timer);
|
|
6653
|
+
clearTimeout(this._timer);
|
|
6640
6654
|
this._timer = null;
|
|
6641
6655
|
}
|
|
6642
6656
|
}
|
|
@@ -7644,6 +7658,7 @@ class ASdpStrategy {
|
|
|
7644
7658
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7645
7659
|
// 过滤行末的空格,服务可能产生空格数据
|
|
7646
7660
|
sdp = sdp.replace(/\s+\r\n/g, '\r\n');
|
|
7661
|
+
logger.info(`set remote answer -> ${sdp}`);
|
|
7647
7662
|
try {
|
|
7648
7663
|
yield this._peer.setRemoteDescription({ type: 'answer', sdp });
|
|
7649
7664
|
}
|
|
@@ -8052,14 +8067,12 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
8052
8067
|
createOffer(iceRestart) {
|
|
8053
8068
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8054
8069
|
const offer = yield this._sdpStrategy.createOffer(iceRestart);
|
|
8055
|
-
|
|
8056
|
-
logger.debug(`offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8070
|
+
logger.info(`create offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8057
8071
|
return offer;
|
|
8058
8072
|
});
|
|
8059
8073
|
}
|
|
8060
8074
|
setRemoteAnswer(answer) {
|
|
8061
8075
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8062
|
-
logger.debug(`answer -> ${JSON.stringify(answer)}`);
|
|
8063
8076
|
return this._sdpStrategy.setRemoteAnswer(answer);
|
|
8064
8077
|
});
|
|
8065
8078
|
}
|
|
@@ -8434,7 +8447,7 @@ class PolarisReporter {
|
|
|
8434
8447
|
* 加入房间
|
|
8435
8448
|
*/
|
|
8436
8449
|
sendR1() {
|
|
8437
|
-
const rtcVersion = "5.2.4-beem.
|
|
8450
|
+
const rtcVersion = "5.2.4-beem.4";
|
|
8438
8451
|
const imVersion = this._context.getCoreVersion();
|
|
8439
8452
|
const platform = 'web';
|
|
8440
8453
|
const pcName = navigator.platform;
|
|
@@ -8598,7 +8611,7 @@ class RCAbstractRoom {
|
|
|
8598
8611
|
this._initRemoteTracks();
|
|
8599
8612
|
const crtUserId = this._context.getCurrentId();
|
|
8600
8613
|
const selfRes = this._roomResources[crtUserId] = this._roomResources[crtUserId] || [];
|
|
8601
|
-
logger.
|
|
8614
|
+
logger.info(`room data -> ${JSON.stringify(this._roomResources)}`);
|
|
8602
8615
|
/*
|
|
8603
8616
|
* 加入房间后,若房间中已存在己方发布的资源,表示之前未能完成正常退出流程
|
|
8604
8617
|
* 需先清除房间内的己方资源,通知房间内其他人己方已取消当前资源的发布
|
|
@@ -8676,6 +8689,7 @@ class RCAbstractRoom {
|
|
|
8676
8689
|
}
|
|
8677
8690
|
_callAppListener(eventType, ...attrs) {
|
|
8678
8691
|
var _a;
|
|
8692
|
+
eventType !== 'onPing' && logger.info(`${eventType} callback ->`, ...attrs);
|
|
8679
8693
|
const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
|
|
8680
8694
|
if (!handle) {
|
|
8681
8695
|
return;
|
|
@@ -8713,7 +8727,7 @@ class RCAbstractRoom {
|
|
|
8713
8727
|
logger.error(`unpublish prev uris failed -> code: ${code}`);
|
|
8714
8728
|
}
|
|
8715
8729
|
else {
|
|
8716
|
-
logger.
|
|
8730
|
+
logger.info('unpublish uris prev login succeed');
|
|
8717
8731
|
}
|
|
8718
8732
|
});
|
|
8719
8733
|
}
|
|
@@ -8761,7 +8775,10 @@ class RCAbstractRoom {
|
|
|
8761
8775
|
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
8762
8776
|
*/
|
|
8763
8777
|
_kickoff(byServer, content) {
|
|
8764
|
-
|
|
8778
|
+
if (this._destroyed) {
|
|
8779
|
+
return;
|
|
8780
|
+
}
|
|
8781
|
+
// logger.warn(`onKickOff -> byServer: ${byServer}`)
|
|
8765
8782
|
this._ntfClearRoomItem();
|
|
8766
8783
|
this._leaveHandle(!byServer);
|
|
8767
8784
|
// 扩展字段,备注用户为什么被踢出房间
|
|
@@ -8857,7 +8874,7 @@ class RCAbstractRoom {
|
|
|
8857
8874
|
// 重新订阅二次发布资源
|
|
8858
8875
|
if (subedTracks.length) {
|
|
8859
8876
|
const trackIds = subedTracks.map(item => item.getTrackId());
|
|
8860
|
-
logger.
|
|
8877
|
+
logger.info(`resub tracks -> ${JSON.stringify(trackIds)}`);
|
|
8861
8878
|
const { code } = yield push(() => this.__subscribe(subedTracks, true));
|
|
8862
8879
|
if (code !== RCRTCCode.SUCCESS) {
|
|
8863
8880
|
logger.error(`resub tracks failed -> code: ${code}, ids: ${JSON.stringify(trackIds)}`);
|
|
@@ -8926,7 +8943,7 @@ class RCAbstractRoom {
|
|
|
8926
8943
|
const downgrade = [];
|
|
8927
8944
|
users.forEach(item => {
|
|
8928
8945
|
if (+item.state === 0) {
|
|
8929
|
-
logger.
|
|
8946
|
+
logger.info(`user joined -> ${item.userId}`);
|
|
8930
8947
|
// 对端 im 重连之后调加入房间信令获取最新数据,服务会给本端下发“对端加入房间”的消息,本端内存已包含对端人员,所以需过滤掉
|
|
8931
8948
|
if (!this._roomResources[item.userId]) {
|
|
8932
8949
|
item.switchRoleType ? upgrade.push(item.userId) : joined.push(item.userId);
|
|
@@ -8934,7 +8951,7 @@ class RCAbstractRoom {
|
|
|
8934
8951
|
this._roomResources[item.userId] = this._roomResources[item.userId] || [];
|
|
8935
8952
|
}
|
|
8936
8953
|
else {
|
|
8937
|
-
logger.
|
|
8954
|
+
logger.info(`user left -> ${item.userId}`);
|
|
8938
8955
|
item.switchRoleType ? downgrade.push(item.userId) : left.push(item.userId);
|
|
8939
8956
|
}
|
|
8940
8957
|
});
|
|
@@ -9139,6 +9156,17 @@ class RCAbstractRoom {
|
|
|
9139
9156
|
__destroy(quitRoom) {
|
|
9140
9157
|
return this._leaveHandle(quitRoom);
|
|
9141
9158
|
}
|
|
9159
|
+
/**
|
|
9160
|
+
* 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
|
|
9161
|
+
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
9162
|
+
*/
|
|
9163
|
+
_muteRemoteTracksBeforeQuit() {
|
|
9164
|
+
const remoteTracks = Object.values(this._remoteTracks);
|
|
9165
|
+
if (!remoteTracks.length) {
|
|
9166
|
+
return;
|
|
9167
|
+
}
|
|
9168
|
+
remoteTracks.forEach((track) => track.mute());
|
|
9169
|
+
}
|
|
9142
9170
|
_leaveHandle(quitRoom) {
|
|
9143
9171
|
var _a;
|
|
9144
9172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9146,6 +9174,7 @@ class RCAbstractRoom {
|
|
|
9146
9174
|
return;
|
|
9147
9175
|
}
|
|
9148
9176
|
this._destroyed = true;
|
|
9177
|
+
this._muteRemoteTracksBeforeQuit();
|
|
9149
9178
|
// 清除音量上报定时器
|
|
9150
9179
|
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
9151
9180
|
if (quitRoom) {
|
|
@@ -9217,7 +9246,7 @@ class RCAbstractRoom {
|
|
|
9217
9246
|
_removePubFailedTracks(tracks) {
|
|
9218
9247
|
tracks.forEach(item => {
|
|
9219
9248
|
const track = item instanceof RCLocalTrack ? item : item.track;
|
|
9220
|
-
logger.
|
|
9249
|
+
logger.info(`remove pub failed track from peerconnection -> trackId: ${track.getTrackId()}`);
|
|
9221
9250
|
this._pc.removeLocalTrackById(track.getTrackId());
|
|
9222
9251
|
});
|
|
9223
9252
|
}
|
|
@@ -9250,7 +9279,7 @@ class RCAbstractRoom {
|
|
|
9250
9279
|
logger.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`);
|
|
9251
9280
|
return { code: RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED };
|
|
9252
9281
|
}
|
|
9253
|
-
logger.
|
|
9282
|
+
logger.info(`publish tracks -> roomId: ${this._roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
|
|
9254
9283
|
/*
|
|
9255
9284
|
* 资源发布应先与 mediaserver 交换资源,建 PeerConnection 通道,后通知房间
|
|
9256
9285
|
* 资源取消发布则应先通知取消发布,后与 mediaServer 协商取消资源发布
|
|
@@ -9331,7 +9360,7 @@ class RCAbstractRoom {
|
|
|
9331
9360
|
const { track: localTrack } = item instanceof RCLocalTrack ? { track: item } : item;
|
|
9332
9361
|
localTrack.__innerSetPublished(true);
|
|
9333
9362
|
});
|
|
9334
|
-
logger.
|
|
9363
|
+
logger.info(`publish success -> ${publishTrackIds.join(',')}`);
|
|
9335
9364
|
if (this._roomMode === RTCMode.LIVE) {
|
|
9336
9365
|
return { code: RCRTCCode.SUCCESS, liveUrl: urls === null || urls === void 0 ? void 0 : urls.liveUrl };
|
|
9337
9366
|
}
|
|
@@ -9477,7 +9506,7 @@ class RCAbstractRoom {
|
|
|
9477
9506
|
logger.error('send unpublish notification failed:', singalCode);
|
|
9478
9507
|
return { code: RCRTCCode.SIGNAL_ERROR };
|
|
9479
9508
|
}
|
|
9480
|
-
logger.
|
|
9509
|
+
logger.info(`unpublish success -> tracks: ${resourceIds.join(',')}`);
|
|
9481
9510
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9482
9511
|
if (resCode !== RCRTCCode.SUCCESS) {
|
|
9483
9512
|
return { code: resCode };
|
|
@@ -9702,7 +9731,7 @@ class RCAbstractRoom {
|
|
|
9702
9731
|
logger.error(`change subscribe list failed: ${resultCode}`);
|
|
9703
9732
|
return { code: resultCode };
|
|
9704
9733
|
}
|
|
9705
|
-
logger.
|
|
9734
|
+
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9706
9735
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9707
9736
|
if (resCode !== RCRTCCode.SUCCESS) {
|
|
9708
9737
|
return { code: resCode };
|
|
@@ -9764,10 +9793,10 @@ class RCAbstractRoom {
|
|
|
9764
9793
|
}
|
|
9765
9794
|
const { code, data } = yield this._context.joinRTCRoom(this._roomId, this._roomMode, livingType);
|
|
9766
9795
|
if (code !== ErrorCode.SUCCESS) {
|
|
9767
|
-
logger.
|
|
9796
|
+
logger.warn(`RTC __onReconnected getRTCRoomInfo failed: ${code}`);
|
|
9768
9797
|
return;
|
|
9769
9798
|
}
|
|
9770
|
-
logger.
|
|
9799
|
+
logger.info(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(data)}`);
|
|
9771
9800
|
// 查找新加入人员
|
|
9772
9801
|
const joinedUserIds = [];
|
|
9773
9802
|
// 新发布资源
|
|
@@ -10676,7 +10705,7 @@ const getCommonHeader = () => ({
|
|
|
10676
10705
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10677
10706
|
'Cache-Control': 'no-cache',
|
|
10678
10707
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10679
|
-
ClientVersion: "5.2.4-beem.
|
|
10708
|
+
ClientVersion: "5.2.4-beem.4",
|
|
10680
10709
|
'Client-Session-Id': getUUID(),
|
|
10681
10710
|
'Request-Id': Date.now().toString()
|
|
10682
10711
|
});
|
|
@@ -10751,7 +10780,7 @@ class RCMediaService {
|
|
|
10751
10780
|
for (let i = 0; i < urls.length; i += 1) {
|
|
10752
10781
|
const url = `${urls[i]}${path}`;
|
|
10753
10782
|
const commonHeader = getCommonHeader();
|
|
10754
|
-
logger.
|
|
10783
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10755
10784
|
const { status, data } = yield this._runtime.httpReq({
|
|
10756
10785
|
url,
|
|
10757
10786
|
body: JSON.stringify(body),
|
|
@@ -10767,11 +10796,11 @@ class RCMediaService {
|
|
|
10767
10796
|
if (resp.clusterId) {
|
|
10768
10797
|
this._clusterId = resp.clusterId;
|
|
10769
10798
|
}
|
|
10770
|
-
logger.
|
|
10799
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10771
10800
|
return { code: RCRTCCode.SUCCESS, data: resp };
|
|
10772
10801
|
}
|
|
10773
10802
|
else {
|
|
10774
|
-
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}
|
|
10803
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}`);
|
|
10775
10804
|
// 失败的请求需记录,避免多配置时总是请求无效的地址
|
|
10776
10805
|
this._failedMs.push(...this._msInNavi.splice(i, 1));
|
|
10777
10806
|
}
|
|
@@ -10834,7 +10863,7 @@ class RCMediaService {
|
|
|
10834
10863
|
// mcu 地址默认使用 https 协议
|
|
10835
10864
|
const url = `${this._configUrl.replace(/^(https?:\/\/)?/, 'https://')}/server/mcu/config`;
|
|
10836
10865
|
const commonHeader = getCommonHeader();
|
|
10837
|
-
logger.
|
|
10866
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10838
10867
|
const { status, data: jsonStr } = yield this._runtime.httpReq({
|
|
10839
10868
|
url,
|
|
10840
10869
|
headers: Object.assign(Object.assign({}, commonHeader), headers),
|
|
@@ -10842,10 +10871,11 @@ class RCMediaService {
|
|
|
10842
10871
|
method: HttpMethod.POST
|
|
10843
10872
|
});
|
|
10844
10873
|
if (status === 200) {
|
|
10845
|
-
logger.
|
|
10874
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10846
10875
|
const data = JSON.parse(jsonStr);
|
|
10847
10876
|
return { code: data.resultCode, res: data };
|
|
10848
10877
|
}
|
|
10878
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10849
10879
|
return { code: RCRTCCode.REQUEST_FAILED };
|
|
10850
10880
|
});
|
|
10851
10881
|
}
|
|
@@ -12704,7 +12734,7 @@ const installer = {
|
|
|
12704
12734
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12705
12735
|
return false;
|
|
12706
12736
|
}
|
|
12707
|
-
VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12737
|
+
VersionManage.add('plugin-rtc', "5.2.4-beem.4");
|
|
12708
12738
|
if (!VersionManage.validEngine("4.6.0-beem.5")) {
|
|
12709
12739
|
logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
|
|
12710
12740
|
return false;
|
|
@@ -12714,7 +12744,7 @@ const installer = {
|
|
|
12714
12744
|
setup(context, runtime, options = {}) {
|
|
12715
12745
|
logger.setLogLevel(options.logLevel);
|
|
12716
12746
|
logger.setLogStdout(options.logStdout);
|
|
12717
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12747
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.4"}, Commit: ${"a3cdebb13c1c9a8f31555277f185522a69f7e42f"}`);
|
|
12718
12748
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12719
12749
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12720
12750
|
logger.warn(`browserInfo.version -> ${browserInfo.version}`);
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.2.4-beem.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.2.4-beem.4
|
|
3
|
+
* CommitId - a3cdebb13c1c9a8f31555277f185522a69f7e42f
|
|
4
|
+
* Fri May 20 2022 19:05:14 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -140,6 +140,7 @@ class AsyncTaskQueue {
|
|
|
140
140
|
}
|
|
141
141
|
this.locked = true;
|
|
142
142
|
const { resolve, task, reject } = this.queue.shift();
|
|
143
|
+
logger.info(`async task queue waiting length -> ${this.queue.length}`);
|
|
143
144
|
let result;
|
|
144
145
|
try {
|
|
145
146
|
result = yield task();
|
|
@@ -155,7 +156,8 @@ class AsyncTaskQueue {
|
|
|
155
156
|
}
|
|
156
157
|
push(task) {
|
|
157
158
|
const promise = new Promise((resolve, reject) => {
|
|
158
|
-
this.queue.push({ resolve, task, reject });
|
|
159
|
+
const length = this.queue.push({ resolve, task, reject });
|
|
160
|
+
logger.info(`async task queue length -> ${length}`);
|
|
159
161
|
});
|
|
160
162
|
this.checkToStart();
|
|
161
163
|
return promise;
|
|
@@ -6592,54 +6594,66 @@ class Pinger {
|
|
|
6592
6594
|
* 记录最近一次成功的 Ping 时间戳
|
|
6593
6595
|
*/
|
|
6594
6596
|
this._latestTimestamp = Date.now();
|
|
6597
|
+
this._started = false;
|
|
6595
6598
|
this._timer = null;
|
|
6596
6599
|
}
|
|
6597
6600
|
/**
|
|
6598
6601
|
* 启动 Ping
|
|
6599
6602
|
*/
|
|
6600
6603
|
start() {
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6604
|
+
if (this._started) {
|
|
6605
|
+
return;
|
|
6606
|
+
}
|
|
6607
|
+
logger.info('rtcping start ->');
|
|
6608
|
+
this._started = true;
|
|
6609
|
+
this._checkAlive();
|
|
6610
|
+
}
|
|
6611
|
+
_sendPing() {
|
|
6612
|
+
return new Promise(resolve => {
|
|
6613
|
+
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6614
|
+
.then(resolve)
|
|
6615
|
+
.catch(error => {
|
|
6616
|
+
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6617
|
+
resolve(engine.ErrorCode.UNKNOWN);
|
|
6618
|
+
});
|
|
6619
|
+
setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
|
|
6607
6620
|
});
|
|
6608
6621
|
}
|
|
6609
|
-
|
|
6622
|
+
_checkAlive() {
|
|
6610
6623
|
var _a, _b, _c;
|
|
6611
6624
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6612
|
-
|
|
6613
|
-
const code = yield
|
|
6614
|
-
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6615
|
-
.then(resolve)
|
|
6616
|
-
.catch(error => {
|
|
6617
|
-
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6618
|
-
resolve(engine.ErrorCode.UNKNOWN);
|
|
6619
|
-
});
|
|
6620
|
-
setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
|
|
6621
|
-
});
|
|
6625
|
+
logger.info('rtcping ->');
|
|
6626
|
+
const code = yield this._sendPing();
|
|
6622
6627
|
const now = Date.now();
|
|
6623
|
-
// ping
|
|
6628
|
+
// ping 成功
|
|
6624
6629
|
if (code === engine.ErrorCode.SUCCESS) {
|
|
6625
|
-
|
|
6630
|
+
logger.info('rtcping success ->');
|
|
6626
6631
|
this._latestTimestamp = now;
|
|
6627
6632
|
(_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, exports.RCRTCPingResult.SUCCESS);
|
|
6633
|
+
// 延迟递归
|
|
6634
|
+
this._timer = setTimeout(() => this._checkAlive(), this._gap);
|
|
6628
6635
|
return;
|
|
6629
6636
|
}
|
|
6630
|
-
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
|
|
6631
6637
|
logger.warn(`rtcping failed -> code: ${code}`);
|
|
6638
|
+
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
|
|
6632
6639
|
// 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
|
|
6633
6640
|
if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
|
|
6634
6641
|
this.stop();
|
|
6635
6642
|
(_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
|
|
6643
|
+
return;
|
|
6636
6644
|
}
|
|
6645
|
+
// 延迟发 rtcping,避免调用栈递归阻塞
|
|
6646
|
+
this._timer = setTimeout(() => this._checkAlive(), 500);
|
|
6637
6647
|
});
|
|
6638
6648
|
}
|
|
6639
6649
|
stop() {
|
|
6650
|
+
if (!this._started) {
|
|
6651
|
+
return;
|
|
6652
|
+
}
|
|
6653
|
+
logger.info('rtcping stop ->');
|
|
6654
|
+
this._started = false;
|
|
6640
6655
|
if (this._timer) {
|
|
6641
|
-
|
|
6642
|
-
clearInterval(this._timer);
|
|
6656
|
+
clearTimeout(this._timer);
|
|
6643
6657
|
this._timer = null;
|
|
6644
6658
|
}
|
|
6645
6659
|
}
|
|
@@ -7647,6 +7661,7 @@ class ASdpStrategy {
|
|
|
7647
7661
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7648
7662
|
// 过滤行末的空格,服务可能产生空格数据
|
|
7649
7663
|
sdp = sdp.replace(/\s+\r\n/g, '\r\n');
|
|
7664
|
+
logger.info(`set remote answer -> ${sdp}`);
|
|
7650
7665
|
try {
|
|
7651
7666
|
yield this._peer.setRemoteDescription({ type: 'answer', sdp });
|
|
7652
7667
|
}
|
|
@@ -8055,14 +8070,12 @@ class RCRTCPeerConnection extends engine.EventEmitter {
|
|
|
8055
8070
|
createOffer(iceRestart) {
|
|
8056
8071
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8057
8072
|
const offer = yield this._sdpStrategy.createOffer(iceRestart);
|
|
8058
|
-
|
|
8059
|
-
logger.debug(`offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8073
|
+
logger.info(`create offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8060
8074
|
return offer;
|
|
8061
8075
|
});
|
|
8062
8076
|
}
|
|
8063
8077
|
setRemoteAnswer(answer) {
|
|
8064
8078
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8065
|
-
logger.debug(`answer -> ${JSON.stringify(answer)}`);
|
|
8066
8079
|
return this._sdpStrategy.setRemoteAnswer(answer);
|
|
8067
8080
|
});
|
|
8068
8081
|
}
|
|
@@ -8437,7 +8450,7 @@ class PolarisReporter {
|
|
|
8437
8450
|
* 加入房间
|
|
8438
8451
|
*/
|
|
8439
8452
|
sendR1() {
|
|
8440
|
-
const rtcVersion = "5.2.4-beem.
|
|
8453
|
+
const rtcVersion = "5.2.4-beem.4";
|
|
8441
8454
|
const imVersion = this._context.getCoreVersion();
|
|
8442
8455
|
const platform = 'web';
|
|
8443
8456
|
const pcName = navigator.platform;
|
|
@@ -8601,7 +8614,7 @@ class RCAbstractRoom {
|
|
|
8601
8614
|
this._initRemoteTracks();
|
|
8602
8615
|
const crtUserId = this._context.getCurrentId();
|
|
8603
8616
|
const selfRes = this._roomResources[crtUserId] = this._roomResources[crtUserId] || [];
|
|
8604
|
-
logger.
|
|
8617
|
+
logger.info(`room data -> ${JSON.stringify(this._roomResources)}`);
|
|
8605
8618
|
/*
|
|
8606
8619
|
* 加入房间后,若房间中已存在己方发布的资源,表示之前未能完成正常退出流程
|
|
8607
8620
|
* 需先清除房间内的己方资源,通知房间内其他人己方已取消当前资源的发布
|
|
@@ -8679,6 +8692,7 @@ class RCAbstractRoom {
|
|
|
8679
8692
|
}
|
|
8680
8693
|
_callAppListener(eventType, ...attrs) {
|
|
8681
8694
|
var _a;
|
|
8695
|
+
eventType !== 'onPing' && logger.info(`${eventType} callback ->`, ...attrs);
|
|
8682
8696
|
const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
|
|
8683
8697
|
if (!handle) {
|
|
8684
8698
|
return;
|
|
@@ -8716,7 +8730,7 @@ class RCAbstractRoom {
|
|
|
8716
8730
|
logger.error(`unpublish prev uris failed -> code: ${code}`);
|
|
8717
8731
|
}
|
|
8718
8732
|
else {
|
|
8719
|
-
logger.
|
|
8733
|
+
logger.info('unpublish uris prev login succeed');
|
|
8720
8734
|
}
|
|
8721
8735
|
});
|
|
8722
8736
|
}
|
|
@@ -8764,7 +8778,10 @@ class RCAbstractRoom {
|
|
|
8764
8778
|
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
8765
8779
|
*/
|
|
8766
8780
|
_kickoff(byServer, content) {
|
|
8767
|
-
|
|
8781
|
+
if (this._destroyed) {
|
|
8782
|
+
return;
|
|
8783
|
+
}
|
|
8784
|
+
// logger.warn(`onKickOff -> byServer: ${byServer}`)
|
|
8768
8785
|
this._ntfClearRoomItem();
|
|
8769
8786
|
this._leaveHandle(!byServer);
|
|
8770
8787
|
// 扩展字段,备注用户为什么被踢出房间
|
|
@@ -8860,7 +8877,7 @@ class RCAbstractRoom {
|
|
|
8860
8877
|
// 重新订阅二次发布资源
|
|
8861
8878
|
if (subedTracks.length) {
|
|
8862
8879
|
const trackIds = subedTracks.map(item => item.getTrackId());
|
|
8863
|
-
logger.
|
|
8880
|
+
logger.info(`resub tracks -> ${JSON.stringify(trackIds)}`);
|
|
8864
8881
|
const { code } = yield push(() => this.__subscribe(subedTracks, true));
|
|
8865
8882
|
if (code !== exports.RCRTCCode.SUCCESS) {
|
|
8866
8883
|
logger.error(`resub tracks failed -> code: ${code}, ids: ${JSON.stringify(trackIds)}`);
|
|
@@ -8929,7 +8946,7 @@ class RCAbstractRoom {
|
|
|
8929
8946
|
const downgrade = [];
|
|
8930
8947
|
users.forEach(item => {
|
|
8931
8948
|
if (+item.state === 0) {
|
|
8932
|
-
logger.
|
|
8949
|
+
logger.info(`user joined -> ${item.userId}`);
|
|
8933
8950
|
// 对端 im 重连之后调加入房间信令获取最新数据,服务会给本端下发“对端加入房间”的消息,本端内存已包含对端人员,所以需过滤掉
|
|
8934
8951
|
if (!this._roomResources[item.userId]) {
|
|
8935
8952
|
item.switchRoleType ? upgrade.push(item.userId) : joined.push(item.userId);
|
|
@@ -8937,7 +8954,7 @@ class RCAbstractRoom {
|
|
|
8937
8954
|
this._roomResources[item.userId] = this._roomResources[item.userId] || [];
|
|
8938
8955
|
}
|
|
8939
8956
|
else {
|
|
8940
|
-
logger.
|
|
8957
|
+
logger.info(`user left -> ${item.userId}`);
|
|
8941
8958
|
item.switchRoleType ? downgrade.push(item.userId) : left.push(item.userId);
|
|
8942
8959
|
}
|
|
8943
8960
|
});
|
|
@@ -9142,6 +9159,17 @@ class RCAbstractRoom {
|
|
|
9142
9159
|
__destroy(quitRoom) {
|
|
9143
9160
|
return this._leaveHandle(quitRoom);
|
|
9144
9161
|
}
|
|
9162
|
+
/**
|
|
9163
|
+
* 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
|
|
9164
|
+
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
9165
|
+
*/
|
|
9166
|
+
_muteRemoteTracksBeforeQuit() {
|
|
9167
|
+
const remoteTracks = Object.values(this._remoteTracks);
|
|
9168
|
+
if (!remoteTracks.length) {
|
|
9169
|
+
return;
|
|
9170
|
+
}
|
|
9171
|
+
remoteTracks.forEach((track) => track.mute());
|
|
9172
|
+
}
|
|
9145
9173
|
_leaveHandle(quitRoom) {
|
|
9146
9174
|
var _a;
|
|
9147
9175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9149,6 +9177,7 @@ class RCAbstractRoom {
|
|
|
9149
9177
|
return;
|
|
9150
9178
|
}
|
|
9151
9179
|
this._destroyed = true;
|
|
9180
|
+
this._muteRemoteTracksBeforeQuit();
|
|
9152
9181
|
// 清除音量上报定时器
|
|
9153
9182
|
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
9154
9183
|
if (quitRoom) {
|
|
@@ -9220,7 +9249,7 @@ class RCAbstractRoom {
|
|
|
9220
9249
|
_removePubFailedTracks(tracks) {
|
|
9221
9250
|
tracks.forEach(item => {
|
|
9222
9251
|
const track = item instanceof RCLocalTrack ? item : item.track;
|
|
9223
|
-
logger.
|
|
9252
|
+
logger.info(`remove pub failed track from peerconnection -> trackId: ${track.getTrackId()}`);
|
|
9224
9253
|
this._pc.removeLocalTrackById(track.getTrackId());
|
|
9225
9254
|
});
|
|
9226
9255
|
}
|
|
@@ -9253,7 +9282,7 @@ class RCAbstractRoom {
|
|
|
9253
9282
|
logger.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`);
|
|
9254
9283
|
return { code: exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED };
|
|
9255
9284
|
}
|
|
9256
|
-
logger.
|
|
9285
|
+
logger.info(`publish tracks -> roomId: ${this._roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
|
|
9257
9286
|
/*
|
|
9258
9287
|
* 资源发布应先与 mediaserver 交换资源,建 PeerConnection 通道,后通知房间
|
|
9259
9288
|
* 资源取消发布则应先通知取消发布,后与 mediaServer 协商取消资源发布
|
|
@@ -9334,7 +9363,7 @@ class RCAbstractRoom {
|
|
|
9334
9363
|
const { track: localTrack } = item instanceof RCLocalTrack ? { track: item } : item;
|
|
9335
9364
|
localTrack.__innerSetPublished(true);
|
|
9336
9365
|
});
|
|
9337
|
-
logger.
|
|
9366
|
+
logger.info(`publish success -> ${publishTrackIds.join(',')}`);
|
|
9338
9367
|
if (this._roomMode === engine.RTCMode.LIVE) {
|
|
9339
9368
|
return { code: exports.RCRTCCode.SUCCESS, liveUrl: urls === null || urls === void 0 ? void 0 : urls.liveUrl };
|
|
9340
9369
|
}
|
|
@@ -9480,7 +9509,7 @@ class RCAbstractRoom {
|
|
|
9480
9509
|
logger.error('send unpublish notification failed:', singalCode);
|
|
9481
9510
|
return { code: exports.RCRTCCode.SIGNAL_ERROR };
|
|
9482
9511
|
}
|
|
9483
|
-
logger.
|
|
9512
|
+
logger.info(`unpublish success -> tracks: ${resourceIds.join(',')}`);
|
|
9484
9513
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9485
9514
|
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9486
9515
|
return { code: resCode };
|
|
@@ -9705,7 +9734,7 @@ class RCAbstractRoom {
|
|
|
9705
9734
|
logger.error(`change subscribe list failed: ${resultCode}`);
|
|
9706
9735
|
return { code: resultCode };
|
|
9707
9736
|
}
|
|
9708
|
-
logger.
|
|
9737
|
+
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9709
9738
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9710
9739
|
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9711
9740
|
return { code: resCode };
|
|
@@ -9767,10 +9796,10 @@ class RCAbstractRoom {
|
|
|
9767
9796
|
}
|
|
9768
9797
|
const { code, data } = yield this._context.joinRTCRoom(this._roomId, this._roomMode, livingType);
|
|
9769
9798
|
if (code !== engine.ErrorCode.SUCCESS) {
|
|
9770
|
-
logger.
|
|
9799
|
+
logger.warn(`RTC __onReconnected getRTCRoomInfo failed: ${code}`);
|
|
9771
9800
|
return;
|
|
9772
9801
|
}
|
|
9773
|
-
logger.
|
|
9802
|
+
logger.info(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(data)}`);
|
|
9774
9803
|
// 查找新加入人员
|
|
9775
9804
|
const joinedUserIds = [];
|
|
9776
9805
|
// 新发布资源
|
|
@@ -10679,7 +10708,7 @@ const getCommonHeader = () => ({
|
|
|
10679
10708
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10680
10709
|
'Cache-Control': 'no-cache',
|
|
10681
10710
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10682
|
-
ClientVersion: "5.2.4-beem.
|
|
10711
|
+
ClientVersion: "5.2.4-beem.4",
|
|
10683
10712
|
'Client-Session-Id': getUUID(),
|
|
10684
10713
|
'Request-Id': Date.now().toString()
|
|
10685
10714
|
});
|
|
@@ -10754,7 +10783,7 @@ class RCMediaService {
|
|
|
10754
10783
|
for (let i = 0; i < urls.length; i += 1) {
|
|
10755
10784
|
const url = `${urls[i]}${path}`;
|
|
10756
10785
|
const commonHeader = getCommonHeader();
|
|
10757
|
-
logger.
|
|
10786
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10758
10787
|
const { status, data } = yield this._runtime.httpReq({
|
|
10759
10788
|
url,
|
|
10760
10789
|
body: JSON.stringify(body),
|
|
@@ -10770,11 +10799,11 @@ class RCMediaService {
|
|
|
10770
10799
|
if (resp.clusterId) {
|
|
10771
10800
|
this._clusterId = resp.clusterId;
|
|
10772
10801
|
}
|
|
10773
|
-
logger.
|
|
10802
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10774
10803
|
return { code: exports.RCRTCCode.SUCCESS, data: resp };
|
|
10775
10804
|
}
|
|
10776
10805
|
else {
|
|
10777
|
-
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}
|
|
10806
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}`);
|
|
10778
10807
|
// 失败的请求需记录,避免多配置时总是请求无效的地址
|
|
10779
10808
|
this._failedMs.push(...this._msInNavi.splice(i, 1));
|
|
10780
10809
|
}
|
|
@@ -10837,7 +10866,7 @@ class RCMediaService {
|
|
|
10837
10866
|
// mcu 地址默认使用 https 协议
|
|
10838
10867
|
const url = `${this._configUrl.replace(/^(https?:\/\/)?/, 'https://')}/server/mcu/config`;
|
|
10839
10868
|
const commonHeader = getCommonHeader();
|
|
10840
|
-
logger.
|
|
10869
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10841
10870
|
const { status, data: jsonStr } = yield this._runtime.httpReq({
|
|
10842
10871
|
url,
|
|
10843
10872
|
headers: Object.assign(Object.assign({}, commonHeader), headers),
|
|
@@ -10845,10 +10874,11 @@ class RCMediaService {
|
|
|
10845
10874
|
method: engine.HttpMethod.POST
|
|
10846
10875
|
});
|
|
10847
10876
|
if (status === 200) {
|
|
10848
|
-
logger.
|
|
10877
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10849
10878
|
const data = JSON.parse(jsonStr);
|
|
10850
10879
|
return { code: data.resultCode, res: data };
|
|
10851
10880
|
}
|
|
10881
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10852
10882
|
return { code: exports.RCRTCCode.REQUEST_FAILED };
|
|
10853
10883
|
});
|
|
10854
10884
|
}
|
|
@@ -12707,7 +12737,7 @@ const installer = {
|
|
|
12707
12737
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12708
12738
|
return false;
|
|
12709
12739
|
}
|
|
12710
|
-
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12740
|
+
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.4");
|
|
12711
12741
|
if (!engine.VersionManage.validEngine("4.6.0-beem.5")) {
|
|
12712
12742
|
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
|
|
12713
12743
|
return false;
|
|
@@ -12717,7 +12747,7 @@ const installer = {
|
|
|
12717
12747
|
setup(context, runtime, options = {}) {
|
|
12718
12748
|
logger.setLogLevel(options.logLevel);
|
|
12719
12749
|
logger.setLogStdout(options.logStdout);
|
|
12720
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12750
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.4"}, Commit: ${"a3cdebb13c1c9a8f31555277f185522a69f7e42f"}`);
|
|
12721
12751
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12722
12752
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12723
12753
|
logger.warn(`browserInfo.version -> ${browserInfo.version}`);
|
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.2.4-beem.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.2.4-beem.4
|
|
3
|
+
* CommitId - a3cdebb13c1c9a8f31555277f185522a69f7e42f
|
|
4
|
+
* Fri May 20 2022 19:05:14 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
this.locked = true;
|
|
142
142
|
const { resolve, task, reject } = this.queue.shift();
|
|
143
|
+
logger.info(`async task queue waiting length -> ${this.queue.length}`);
|
|
143
144
|
let result;
|
|
144
145
|
try {
|
|
145
146
|
result = yield task();
|
|
@@ -155,7 +156,8 @@
|
|
|
155
156
|
}
|
|
156
157
|
push(task) {
|
|
157
158
|
const promise = new Promise((resolve, reject) => {
|
|
158
|
-
this.queue.push({ resolve, task, reject });
|
|
159
|
+
const length = this.queue.push({ resolve, task, reject });
|
|
160
|
+
logger.info(`async task queue length -> ${length}`);
|
|
159
161
|
});
|
|
160
162
|
this.checkToStart();
|
|
161
163
|
return promise;
|
|
@@ -6592,54 +6594,66 @@
|
|
|
6592
6594
|
* 记录最近一次成功的 Ping 时间戳
|
|
6593
6595
|
*/
|
|
6594
6596
|
this._latestTimestamp = Date.now();
|
|
6597
|
+
this._started = false;
|
|
6595
6598
|
this._timer = null;
|
|
6596
6599
|
}
|
|
6597
6600
|
/**
|
|
6598
6601
|
* 启动 Ping
|
|
6599
6602
|
*/
|
|
6600
6603
|
start() {
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6604
|
+
if (this._started) {
|
|
6605
|
+
return;
|
|
6606
|
+
}
|
|
6607
|
+
logger.info('rtcping start ->');
|
|
6608
|
+
this._started = true;
|
|
6609
|
+
this._checkAlive();
|
|
6610
|
+
}
|
|
6611
|
+
_sendPing() {
|
|
6612
|
+
return new Promise(resolve => {
|
|
6613
|
+
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6614
|
+
.then(resolve)
|
|
6615
|
+
.catch(error => {
|
|
6616
|
+
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6617
|
+
resolve(engine.ErrorCode.UNKNOWN);
|
|
6618
|
+
});
|
|
6619
|
+
setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
|
|
6607
6620
|
});
|
|
6608
6621
|
}
|
|
6609
|
-
|
|
6622
|
+
_checkAlive() {
|
|
6610
6623
|
var _a, _b, _c;
|
|
6611
6624
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6612
|
-
|
|
6613
|
-
const code = yield
|
|
6614
|
-
this._context.rtcPing(this._roomId, this._roomMode)
|
|
6615
|
-
.then(resolve)
|
|
6616
|
-
.catch(error => {
|
|
6617
|
-
logger.error(`rtcping receive unknown error -> ${error}`);
|
|
6618
|
-
resolve(engine.ErrorCode.UNKNOWN);
|
|
6619
|
-
});
|
|
6620
|
-
setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
|
|
6621
|
-
});
|
|
6625
|
+
logger.info('rtcping ->');
|
|
6626
|
+
const code = yield this._sendPing();
|
|
6622
6627
|
const now = Date.now();
|
|
6623
|
-
// ping
|
|
6628
|
+
// ping 成功
|
|
6624
6629
|
if (code === engine.ErrorCode.SUCCESS) {
|
|
6625
|
-
|
|
6630
|
+
logger.info('rtcping success ->');
|
|
6626
6631
|
this._latestTimestamp = now;
|
|
6627
6632
|
(_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, exports.RCRTCPingResult.SUCCESS);
|
|
6633
|
+
// 延迟递归
|
|
6634
|
+
this._timer = setTimeout(() => this._checkAlive(), this._gap);
|
|
6628
6635
|
return;
|
|
6629
6636
|
}
|
|
6630
|
-
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
|
|
6631
6637
|
logger.warn(`rtcping failed -> code: ${code}`);
|
|
6638
|
+
(_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
|
|
6632
6639
|
// 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
|
|
6633
6640
|
if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
|
|
6634
6641
|
this.stop();
|
|
6635
6642
|
(_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
|
|
6643
|
+
return;
|
|
6636
6644
|
}
|
|
6645
|
+
// 延迟发 rtcping,避免调用栈递归阻塞
|
|
6646
|
+
this._timer = setTimeout(() => this._checkAlive(), 500);
|
|
6637
6647
|
});
|
|
6638
6648
|
}
|
|
6639
6649
|
stop() {
|
|
6650
|
+
if (!this._started) {
|
|
6651
|
+
return;
|
|
6652
|
+
}
|
|
6653
|
+
logger.info('rtcping stop ->');
|
|
6654
|
+
this._started = false;
|
|
6640
6655
|
if (this._timer) {
|
|
6641
|
-
|
|
6642
|
-
clearInterval(this._timer);
|
|
6656
|
+
clearTimeout(this._timer);
|
|
6643
6657
|
this._timer = null;
|
|
6644
6658
|
}
|
|
6645
6659
|
}
|
|
@@ -7647,6 +7661,7 @@
|
|
|
7647
7661
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7648
7662
|
// 过滤行末的空格,服务可能产生空格数据
|
|
7649
7663
|
sdp = sdp.replace(/\s+\r\n/g, '\r\n');
|
|
7664
|
+
logger.info(`set remote answer -> ${sdp}`);
|
|
7650
7665
|
try {
|
|
7651
7666
|
yield this._peer.setRemoteDescription({ type: 'answer', sdp });
|
|
7652
7667
|
}
|
|
@@ -8055,14 +8070,12 @@
|
|
|
8055
8070
|
createOffer(iceRestart) {
|
|
8056
8071
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8057
8072
|
const offer = yield this._sdpStrategy.createOffer(iceRestart);
|
|
8058
|
-
|
|
8059
|
-
logger.debug(`offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8073
|
+
logger.info(`create offer -> ${JSON.stringify(offer.sdp)}`);
|
|
8060
8074
|
return offer;
|
|
8061
8075
|
});
|
|
8062
8076
|
}
|
|
8063
8077
|
setRemoteAnswer(answer) {
|
|
8064
8078
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8065
|
-
logger.debug(`answer -> ${JSON.stringify(answer)}`);
|
|
8066
8079
|
return this._sdpStrategy.setRemoteAnswer(answer);
|
|
8067
8080
|
});
|
|
8068
8081
|
}
|
|
@@ -8437,7 +8450,7 @@
|
|
|
8437
8450
|
* 加入房间
|
|
8438
8451
|
*/
|
|
8439
8452
|
sendR1() {
|
|
8440
|
-
const rtcVersion = "5.2.4-beem.
|
|
8453
|
+
const rtcVersion = "5.2.4-beem.4";
|
|
8441
8454
|
const imVersion = this._context.getCoreVersion();
|
|
8442
8455
|
const platform = 'web';
|
|
8443
8456
|
const pcName = navigator.platform;
|
|
@@ -8601,7 +8614,7 @@
|
|
|
8601
8614
|
this._initRemoteTracks();
|
|
8602
8615
|
const crtUserId = this._context.getCurrentId();
|
|
8603
8616
|
const selfRes = this._roomResources[crtUserId] = this._roomResources[crtUserId] || [];
|
|
8604
|
-
logger.
|
|
8617
|
+
logger.info(`room data -> ${JSON.stringify(this._roomResources)}`);
|
|
8605
8618
|
/*
|
|
8606
8619
|
* 加入房间后,若房间中已存在己方发布的资源,表示之前未能完成正常退出流程
|
|
8607
8620
|
* 需先清除房间内的己方资源,通知房间内其他人己方已取消当前资源的发布
|
|
@@ -8679,6 +8692,7 @@
|
|
|
8679
8692
|
}
|
|
8680
8693
|
_callAppListener(eventType, ...attrs) {
|
|
8681
8694
|
var _a;
|
|
8695
|
+
eventType !== 'onPing' && logger.info(`${eventType} callback ->`, ...attrs);
|
|
8682
8696
|
const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
|
|
8683
8697
|
if (!handle) {
|
|
8684
8698
|
return;
|
|
@@ -8716,7 +8730,7 @@
|
|
|
8716
8730
|
logger.error(`unpublish prev uris failed -> code: ${code}`);
|
|
8717
8731
|
}
|
|
8718
8732
|
else {
|
|
8719
|
-
logger.
|
|
8733
|
+
logger.info('unpublish uris prev login succeed');
|
|
8720
8734
|
}
|
|
8721
8735
|
});
|
|
8722
8736
|
}
|
|
@@ -8764,7 +8778,10 @@
|
|
|
8764
8778
|
* * 当值为 true 时,说明本端收到被踢出房间通知
|
|
8765
8779
|
*/
|
|
8766
8780
|
_kickoff(byServer, content) {
|
|
8767
|
-
|
|
8781
|
+
if (this._destroyed) {
|
|
8782
|
+
return;
|
|
8783
|
+
}
|
|
8784
|
+
// logger.warn(`onKickOff -> byServer: ${byServer}`)
|
|
8768
8785
|
this._ntfClearRoomItem();
|
|
8769
8786
|
this._leaveHandle(!byServer);
|
|
8770
8787
|
// 扩展字段,备注用户为什么被踢出房间
|
|
@@ -8860,7 +8877,7 @@
|
|
|
8860
8877
|
// 重新订阅二次发布资源
|
|
8861
8878
|
if (subedTracks.length) {
|
|
8862
8879
|
const trackIds = subedTracks.map(item => item.getTrackId());
|
|
8863
|
-
logger.
|
|
8880
|
+
logger.info(`resub tracks -> ${JSON.stringify(trackIds)}`);
|
|
8864
8881
|
const { code } = yield push(() => this.__subscribe(subedTracks, true));
|
|
8865
8882
|
if (code !== exports.RCRTCCode.SUCCESS) {
|
|
8866
8883
|
logger.error(`resub tracks failed -> code: ${code}, ids: ${JSON.stringify(trackIds)}`);
|
|
@@ -8929,7 +8946,7 @@
|
|
|
8929
8946
|
const downgrade = [];
|
|
8930
8947
|
users.forEach(item => {
|
|
8931
8948
|
if (+item.state === 0) {
|
|
8932
|
-
logger.
|
|
8949
|
+
logger.info(`user joined -> ${item.userId}`);
|
|
8933
8950
|
// 对端 im 重连之后调加入房间信令获取最新数据,服务会给本端下发“对端加入房间”的消息,本端内存已包含对端人员,所以需过滤掉
|
|
8934
8951
|
if (!this._roomResources[item.userId]) {
|
|
8935
8952
|
item.switchRoleType ? upgrade.push(item.userId) : joined.push(item.userId);
|
|
@@ -8937,7 +8954,7 @@
|
|
|
8937
8954
|
this._roomResources[item.userId] = this._roomResources[item.userId] || [];
|
|
8938
8955
|
}
|
|
8939
8956
|
else {
|
|
8940
|
-
logger.
|
|
8957
|
+
logger.info(`user left -> ${item.userId}`);
|
|
8941
8958
|
item.switchRoleType ? downgrade.push(item.userId) : left.push(item.userId);
|
|
8942
8959
|
}
|
|
8943
8960
|
});
|
|
@@ -9142,6 +9159,17 @@
|
|
|
9142
9159
|
__destroy(quitRoom) {
|
|
9143
9160
|
return this._leaveHandle(quitRoom);
|
|
9144
9161
|
}
|
|
9162
|
+
/**
|
|
9163
|
+
* 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
|
|
9164
|
+
* 导致在未完全退出的过程中仍能听到房间内的声音问题
|
|
9165
|
+
*/
|
|
9166
|
+
_muteRemoteTracksBeforeQuit() {
|
|
9167
|
+
const remoteTracks = Object.values(this._remoteTracks);
|
|
9168
|
+
if (!remoteTracks.length) {
|
|
9169
|
+
return;
|
|
9170
|
+
}
|
|
9171
|
+
remoteTracks.forEach((track) => track.mute());
|
|
9172
|
+
}
|
|
9145
9173
|
_leaveHandle(quitRoom) {
|
|
9146
9174
|
var _a;
|
|
9147
9175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9149,6 +9177,7 @@
|
|
|
9149
9177
|
return;
|
|
9150
9178
|
}
|
|
9151
9179
|
this._destroyed = true;
|
|
9180
|
+
this._muteRemoteTracksBeforeQuit();
|
|
9152
9181
|
// 清除音量上报定时器
|
|
9153
9182
|
(_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
|
|
9154
9183
|
if (quitRoom) {
|
|
@@ -9220,7 +9249,7 @@
|
|
|
9220
9249
|
_removePubFailedTracks(tracks) {
|
|
9221
9250
|
tracks.forEach(item => {
|
|
9222
9251
|
const track = item instanceof RCLocalTrack ? item : item.track;
|
|
9223
|
-
logger.
|
|
9252
|
+
logger.info(`remove pub failed track from peerconnection -> trackId: ${track.getTrackId()}`);
|
|
9224
9253
|
this._pc.removeLocalTrackById(track.getTrackId());
|
|
9225
9254
|
});
|
|
9226
9255
|
}
|
|
@@ -9253,7 +9282,7 @@
|
|
|
9253
9282
|
logger.error(`publish failed, tracks limit exceeded -> roomId: ${this._roomId}`);
|
|
9254
9283
|
return { code: exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED };
|
|
9255
9284
|
}
|
|
9256
|
-
logger.
|
|
9285
|
+
logger.info(`publish tracks -> roomId: ${this._roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
|
|
9257
9286
|
/*
|
|
9258
9287
|
* 资源发布应先与 mediaserver 交换资源,建 PeerConnection 通道,后通知房间
|
|
9259
9288
|
* 资源取消发布则应先通知取消发布,后与 mediaServer 协商取消资源发布
|
|
@@ -9334,7 +9363,7 @@
|
|
|
9334
9363
|
const { track: localTrack } = item instanceof RCLocalTrack ? { track: item } : item;
|
|
9335
9364
|
localTrack.__innerSetPublished(true);
|
|
9336
9365
|
});
|
|
9337
|
-
logger.
|
|
9366
|
+
logger.info(`publish success -> ${publishTrackIds.join(',')}`);
|
|
9338
9367
|
if (this._roomMode === engine.RTCMode.LIVE) {
|
|
9339
9368
|
return { code: exports.RCRTCCode.SUCCESS, liveUrl: urls === null || urls === void 0 ? void 0 : urls.liveUrl };
|
|
9340
9369
|
}
|
|
@@ -9480,7 +9509,7 @@
|
|
|
9480
9509
|
logger.error('send unpublish notification failed:', singalCode);
|
|
9481
9510
|
return { code: exports.RCRTCCode.SIGNAL_ERROR };
|
|
9482
9511
|
}
|
|
9483
|
-
logger.
|
|
9512
|
+
logger.info(`unpublish success -> tracks: ${resourceIds.join(',')}`);
|
|
9484
9513
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9485
9514
|
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9486
9515
|
return { code: resCode };
|
|
@@ -9705,7 +9734,7 @@
|
|
|
9705
9734
|
logger.error(`change subscribe list failed: ${resultCode}`);
|
|
9706
9735
|
return { code: resultCode };
|
|
9707
9736
|
}
|
|
9708
|
-
logger.
|
|
9737
|
+
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9709
9738
|
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9710
9739
|
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9711
9740
|
return { code: resCode };
|
|
@@ -9767,10 +9796,10 @@
|
|
|
9767
9796
|
}
|
|
9768
9797
|
const { code, data } = yield this._context.joinRTCRoom(this._roomId, this._roomMode, livingType);
|
|
9769
9798
|
if (code !== engine.ErrorCode.SUCCESS) {
|
|
9770
|
-
logger.
|
|
9799
|
+
logger.warn(`RTC __onReconnected getRTCRoomInfo failed: ${code}`);
|
|
9771
9800
|
return;
|
|
9772
9801
|
}
|
|
9773
|
-
logger.
|
|
9802
|
+
logger.info(`RTC __onReconnected getRTCRoomInfo success: ${JSON.stringify(data)}`);
|
|
9774
9803
|
// 查找新加入人员
|
|
9775
9804
|
const joinedUserIds = [];
|
|
9776
9805
|
// 新发布资源
|
|
@@ -10679,7 +10708,7 @@
|
|
|
10679
10708
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10680
10709
|
'Cache-Control': 'no-cache',
|
|
10681
10710
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10682
|
-
ClientVersion: "5.2.4-beem.
|
|
10711
|
+
ClientVersion: "5.2.4-beem.4",
|
|
10683
10712
|
'Client-Session-Id': getUUID(),
|
|
10684
10713
|
'Request-Id': Date.now().toString()
|
|
10685
10714
|
});
|
|
@@ -10754,7 +10783,7 @@
|
|
|
10754
10783
|
for (let i = 0; i < urls.length; i += 1) {
|
|
10755
10784
|
const url = `${urls[i]}${path}`;
|
|
10756
10785
|
const commonHeader = getCommonHeader();
|
|
10757
|
-
logger.
|
|
10786
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10758
10787
|
const { status, data } = yield this._runtime.httpReq({
|
|
10759
10788
|
url,
|
|
10760
10789
|
body: JSON.stringify(body),
|
|
@@ -10770,11 +10799,11 @@
|
|
|
10770
10799
|
if (resp.clusterId) {
|
|
10771
10800
|
this._clusterId = resp.clusterId;
|
|
10772
10801
|
}
|
|
10773
|
-
logger.
|
|
10802
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10774
10803
|
return { code: exports.RCRTCCode.SUCCESS, data: resp };
|
|
10775
10804
|
}
|
|
10776
10805
|
else {
|
|
10777
|
-
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}
|
|
10806
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}`);
|
|
10778
10807
|
// 失败的请求需记录,避免多配置时总是请求无效的地址
|
|
10779
10808
|
this._failedMs.push(...this._msInNavi.splice(i, 1));
|
|
10780
10809
|
}
|
|
@@ -10837,7 +10866,7 @@
|
|
|
10837
10866
|
// mcu 地址默认使用 https 协议
|
|
10838
10867
|
const url = `${this._configUrl.replace(/^(https?:\/\/)?/, 'https://')}/server/mcu/config`;
|
|
10839
10868
|
const commonHeader = getCommonHeader();
|
|
10840
|
-
logger.
|
|
10869
|
+
logger.info(`request -> Request-Id: ${commonHeader['Request-Id']}, url: ${url}`);
|
|
10841
10870
|
const { status, data: jsonStr } = yield this._runtime.httpReq({
|
|
10842
10871
|
url,
|
|
10843
10872
|
headers: Object.assign(Object.assign({}, commonHeader), headers),
|
|
@@ -10845,10 +10874,11 @@
|
|
|
10845
10874
|
method: engine.HttpMethod.POST
|
|
10846
10875
|
});
|
|
10847
10876
|
if (status === 200) {
|
|
10848
|
-
logger.
|
|
10877
|
+
logger.info(`request success -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10849
10878
|
const data = JSON.parse(jsonStr);
|
|
10850
10879
|
return { code: data.resultCode, res: data };
|
|
10851
10880
|
}
|
|
10881
|
+
logger.warn(`request failed -> Request-Id: ${commonHeader['Request-Id']}`);
|
|
10852
10882
|
return { code: exports.RCRTCCode.REQUEST_FAILED };
|
|
10853
10883
|
});
|
|
10854
10884
|
}
|
|
@@ -12707,7 +12737,7 @@
|
|
|
12707
12737
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12708
12738
|
return false;
|
|
12709
12739
|
}
|
|
12710
|
-
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12740
|
+
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.4");
|
|
12711
12741
|
if (!engine.VersionManage.validEngine("4.6.0-beem.5")) {
|
|
12712
12742
|
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
|
|
12713
12743
|
return false;
|
|
@@ -12717,7 +12747,7 @@
|
|
|
12717
12747
|
setup(context, runtime, options = {}) {
|
|
12718
12748
|
logger.setLogLevel(options.logLevel);
|
|
12719
12749
|
logger.setLogStdout(options.logStdout);
|
|
12720
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12750
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.4"}, Commit: ${"a3cdebb13c1c9a8f31555277f185522a69f7e42f"}`);
|
|
12721
12751
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12722
12752
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12723
12753
|
logger.warn(`browserInfo.version -> ${browserInfo.version}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rongcloud/plugin-rtc",
|
|
3
|
-
"version": "5.2.4-beem.
|
|
3
|
+
"version": "5.2.4-beem.4",
|
|
4
4
|
"description": "@rongcloud/plugin-rtc",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"__attrs__": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@rongcloud/engine": "4.6.0-beem.5"
|
|
35
35
|
},
|
|
36
|
-
"__commit__": "
|
|
36
|
+
"__commit__": "a3cdebb13c1c9a8f31555277f185522a69f7e42f"
|
|
37
37
|
}
|