@rongcloud/plugin-rtc 5.2.4-beem.10 → 5.2.4-beem.11
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 +3 -3
- package/dist/index.esm.js +44 -15
- package/dist/index.js +44 -15
- package/dist/index.umd.js +44 -15
- package/package.json +3 -3
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.11
|
|
3
|
+
* CommitId - dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb
|
|
4
|
+
* Wed Jun 29 2022 19:23:04 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';
|
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.11
|
|
3
|
+
* CommitId - dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb
|
|
4
|
+
* Wed Jun 29 2022 19:23:04 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';
|
|
@@ -6540,6 +6540,24 @@ const parseAudienceRoomData = (roomId, kvEntries) => {
|
|
|
6540
6540
|
CDNUris: CDNUris || {}
|
|
6541
6541
|
};
|
|
6542
6542
|
};
|
|
6543
|
+
/**
|
|
6544
|
+
* 修改订阅失败的资源通道方向为 inactive,返回修改后的 answer sdp
|
|
6545
|
+
*/
|
|
6546
|
+
const setAnswerSdpDirection = (failedList, answerSdp) => {
|
|
6547
|
+
const answerMArr = answerSdp.split('\r\nm=');
|
|
6548
|
+
failedList.forEach((item) => {
|
|
6549
|
+
const mediaType = parseInt(item.track.getTrackId().split('_').pop());
|
|
6550
|
+
const kind = (mediaType === RCMediaType.AUDIO_ONLY) ? 'audio' : 'video';
|
|
6551
|
+
const msid = `${item.track.getUserId()}_${item.track.getTag()}`;
|
|
6552
|
+
answerMArr.forEach((sdpM, i) => {
|
|
6553
|
+
if (sdpM.includes(`${kind}`) && sdpM.includes(`a=msid:${msid}`)) {
|
|
6554
|
+
const newSdpM = sdpM.replace('a=sendonly', 'a=inactive');
|
|
6555
|
+
answerMArr.splice(i, 1, newSdpM);
|
|
6556
|
+
}
|
|
6557
|
+
});
|
|
6558
|
+
});
|
|
6559
|
+
return answerMArr.join('\r\nm=');
|
|
6560
|
+
};
|
|
6543
6561
|
|
|
6544
6562
|
/**
|
|
6545
6563
|
* RTC 消息类型常量
|
|
@@ -8517,7 +8535,7 @@ class PolarisReporter {
|
|
|
8517
8535
|
* 加入房间
|
|
8518
8536
|
*/
|
|
8519
8537
|
sendR1() {
|
|
8520
|
-
const rtcVersion = "5.2.4-beem.
|
|
8538
|
+
const rtcVersion = "5.2.4-beem.11";
|
|
8521
8539
|
const imVersion = this._context.getCoreVersion();
|
|
8522
8540
|
const platform = 'web';
|
|
8523
8541
|
const pcName = navigator.platform;
|
|
@@ -8778,7 +8796,7 @@ class RCAbstractRoom {
|
|
|
8778
8796
|
_onUserUnpublish(tracks) {
|
|
8779
8797
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8780
8798
|
// 需要替业务层取消订阅,业务层只需关注 UI 变化
|
|
8781
|
-
yield this.
|
|
8799
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
8782
8800
|
tracks.forEach(item => {
|
|
8783
8801
|
item.__innerDestroy();
|
|
8784
8802
|
delete this._remoteTracks[item.getTrackId()];
|
|
@@ -9033,7 +9051,7 @@ class RCAbstractRoom {
|
|
|
9033
9051
|
userIds.push(userId);
|
|
9034
9052
|
});
|
|
9035
9053
|
if (tracks.length) {
|
|
9036
|
-
yield this.
|
|
9054
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
9037
9055
|
tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
|
|
9038
9056
|
}
|
|
9039
9057
|
// 等待队列执行完成后清除内存数据
|
|
@@ -9797,14 +9815,19 @@ class RCAbstractRoom {
|
|
|
9797
9815
|
return { code: resultCode };
|
|
9798
9816
|
}
|
|
9799
9817
|
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9800
|
-
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9801
|
-
if (resCode !== RCRTCCode.SUCCESS) {
|
|
9802
|
-
return { code: resCode };
|
|
9803
|
-
}
|
|
9804
9818
|
// 获取真正订阅成功的资源
|
|
9805
9819
|
const subSuccessTrackIds = subscribedList === null || subscribedList === void 0 ? void 0 : subscribedList.map(item => `${item.msid}_${item.mediaType}`);
|
|
9806
9820
|
const subSuccessList = attrs.filter(item => subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId()));
|
|
9807
9821
|
const failedList = attrs.filter(item => !(subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId())));
|
|
9822
|
+
/**
|
|
9823
|
+
* 订阅失败的资源,需把 sdp 中对应的通道方向改为 inactive
|
|
9824
|
+
* 否则下次复用通道时,浏览器 peerConnection 的 ontrack 事件不会被触发
|
|
9825
|
+
*/
|
|
9826
|
+
const answerSdp = failedList.length ? setAnswerSdpDirection(failedList, answer.sdp) : answer.sdp;
|
|
9827
|
+
const resCode = yield this._pc.setRemoteAnswer(answerSdp);
|
|
9828
|
+
if (resCode !== RCRTCCode.SUCCESS) {
|
|
9829
|
+
return { code: resCode };
|
|
9830
|
+
}
|
|
9808
9831
|
// 更新 remoteTrack.isSubscribed
|
|
9809
9832
|
for (const trackId in this._remoteTracks) {
|
|
9810
9833
|
const subed = subSuccessList.some(item => item.track.getTrackId() === trackId);
|
|
@@ -10770,7 +10793,7 @@ const getCommonHeader = () => ({
|
|
|
10770
10793
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10771
10794
|
'Cache-Control': 'no-cache',
|
|
10772
10795
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10773
|
-
ClientVersion: "5.2.4-beem.
|
|
10796
|
+
ClientVersion: "5.2.4-beem.11",
|
|
10774
10797
|
'Client-Session-Id': getUUID(),
|
|
10775
10798
|
'Request-Id': Date.now().toString()
|
|
10776
10799
|
});
|
|
@@ -12230,6 +12253,12 @@ class RCRTCClient {
|
|
|
12230
12253
|
}
|
|
12231
12254
|
_joinRTCRoom(roomId, joinType, outerUserDatas, useMutilPeerC, roomType = RTCMode.RTC) {
|
|
12232
12255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12256
|
+
if (this._crtRoom) {
|
|
12257
|
+
return { code: RCRTCCode.REPERT_JOIN_ROOM };
|
|
12258
|
+
}
|
|
12259
|
+
if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
|
|
12260
|
+
return { code: RCRTCCode.SIGNAL_DISCONNECTED };
|
|
12261
|
+
}
|
|
12233
12262
|
if (isIllegalConnection(this._context.getNaviInfo())) {
|
|
12234
12263
|
return { code: RCRTCCode.PACKAGE_ENVIRONMENT_ERROR };
|
|
12235
12264
|
}
|
|
@@ -12812,9 +12841,9 @@ const installer = {
|
|
|
12812
12841
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12813
12842
|
return false;
|
|
12814
12843
|
}
|
|
12815
|
-
VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12816
|
-
if (!VersionManage.validEngine("4.6.0-beem.
|
|
12817
|
-
logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.
|
|
12844
|
+
VersionManage.add('plugin-rtc', "5.2.4-beem.11");
|
|
12845
|
+
if (!VersionManage.validEngine(">=4.6.0-beem.11")) {
|
|
12846
|
+
logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=4.6.0-beem.11"}'.`);
|
|
12818
12847
|
return false;
|
|
12819
12848
|
}
|
|
12820
12849
|
return true;
|
|
@@ -12822,7 +12851,7 @@ const installer = {
|
|
|
12822
12851
|
setup(context, runtime, options = {}) {
|
|
12823
12852
|
logger.setLogLevel(options.logLevel);
|
|
12824
12853
|
logger.setLogStdout(options.logStdout);
|
|
12825
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12854
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.11"}, Commit: ${"dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb"}`);
|
|
12826
12855
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12827
12856
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12828
12857
|
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.11
|
|
3
|
+
* CommitId - dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb
|
|
4
|
+
* Wed Jun 29 2022 19:23:04 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -6543,6 +6543,24 @@ const parseAudienceRoomData = (roomId, kvEntries) => {
|
|
|
6543
6543
|
CDNUris: CDNUris || {}
|
|
6544
6544
|
};
|
|
6545
6545
|
};
|
|
6546
|
+
/**
|
|
6547
|
+
* 修改订阅失败的资源通道方向为 inactive,返回修改后的 answer sdp
|
|
6548
|
+
*/
|
|
6549
|
+
const setAnswerSdpDirection = (failedList, answerSdp) => {
|
|
6550
|
+
const answerMArr = answerSdp.split('\r\nm=');
|
|
6551
|
+
failedList.forEach((item) => {
|
|
6552
|
+
const mediaType = parseInt(item.track.getTrackId().split('_').pop());
|
|
6553
|
+
const kind = (mediaType === exports.RCMediaType.AUDIO_ONLY) ? 'audio' : 'video';
|
|
6554
|
+
const msid = `${item.track.getUserId()}_${item.track.getTag()}`;
|
|
6555
|
+
answerMArr.forEach((sdpM, i) => {
|
|
6556
|
+
if (sdpM.includes(`${kind}`) && sdpM.includes(`a=msid:${msid}`)) {
|
|
6557
|
+
const newSdpM = sdpM.replace('a=sendonly', 'a=inactive');
|
|
6558
|
+
answerMArr.splice(i, 1, newSdpM);
|
|
6559
|
+
}
|
|
6560
|
+
});
|
|
6561
|
+
});
|
|
6562
|
+
return answerMArr.join('\r\nm=');
|
|
6563
|
+
};
|
|
6546
6564
|
|
|
6547
6565
|
/**
|
|
6548
6566
|
* RTC 消息类型常量
|
|
@@ -8520,7 +8538,7 @@ class PolarisReporter {
|
|
|
8520
8538
|
* 加入房间
|
|
8521
8539
|
*/
|
|
8522
8540
|
sendR1() {
|
|
8523
|
-
const rtcVersion = "5.2.4-beem.
|
|
8541
|
+
const rtcVersion = "5.2.4-beem.11";
|
|
8524
8542
|
const imVersion = this._context.getCoreVersion();
|
|
8525
8543
|
const platform = 'web';
|
|
8526
8544
|
const pcName = navigator.platform;
|
|
@@ -8781,7 +8799,7 @@ class RCAbstractRoom {
|
|
|
8781
8799
|
_onUserUnpublish(tracks) {
|
|
8782
8800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8783
8801
|
// 需要替业务层取消订阅,业务层只需关注 UI 变化
|
|
8784
|
-
yield this.
|
|
8802
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
8785
8803
|
tracks.forEach(item => {
|
|
8786
8804
|
item.__innerDestroy();
|
|
8787
8805
|
delete this._remoteTracks[item.getTrackId()];
|
|
@@ -9036,7 +9054,7 @@ class RCAbstractRoom {
|
|
|
9036
9054
|
userIds.push(userId);
|
|
9037
9055
|
});
|
|
9038
9056
|
if (tracks.length) {
|
|
9039
|
-
yield this.
|
|
9057
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
9040
9058
|
tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
|
|
9041
9059
|
}
|
|
9042
9060
|
// 等待队列执行完成后清除内存数据
|
|
@@ -9800,14 +9818,19 @@ class RCAbstractRoom {
|
|
|
9800
9818
|
return { code: resultCode };
|
|
9801
9819
|
}
|
|
9802
9820
|
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9803
|
-
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9804
|
-
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9805
|
-
return { code: resCode };
|
|
9806
|
-
}
|
|
9807
9821
|
// 获取真正订阅成功的资源
|
|
9808
9822
|
const subSuccessTrackIds = subscribedList === null || subscribedList === void 0 ? void 0 : subscribedList.map(item => `${item.msid}_${item.mediaType}`);
|
|
9809
9823
|
const subSuccessList = attrs.filter(item => subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId()));
|
|
9810
9824
|
const failedList = attrs.filter(item => !(subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId())));
|
|
9825
|
+
/**
|
|
9826
|
+
* 订阅失败的资源,需把 sdp 中对应的通道方向改为 inactive
|
|
9827
|
+
* 否则下次复用通道时,浏览器 peerConnection 的 ontrack 事件不会被触发
|
|
9828
|
+
*/
|
|
9829
|
+
const answerSdp = failedList.length ? setAnswerSdpDirection(failedList, answer.sdp) : answer.sdp;
|
|
9830
|
+
const resCode = yield this._pc.setRemoteAnswer(answerSdp);
|
|
9831
|
+
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9832
|
+
return { code: resCode };
|
|
9833
|
+
}
|
|
9811
9834
|
// 更新 remoteTrack.isSubscribed
|
|
9812
9835
|
for (const trackId in this._remoteTracks) {
|
|
9813
9836
|
const subed = subSuccessList.some(item => item.track.getTrackId() === trackId);
|
|
@@ -10773,7 +10796,7 @@ const getCommonHeader = () => ({
|
|
|
10773
10796
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10774
10797
|
'Cache-Control': 'no-cache',
|
|
10775
10798
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10776
|
-
ClientVersion: "5.2.4-beem.
|
|
10799
|
+
ClientVersion: "5.2.4-beem.11",
|
|
10777
10800
|
'Client-Session-Id': getUUID(),
|
|
10778
10801
|
'Request-Id': Date.now().toString()
|
|
10779
10802
|
});
|
|
@@ -12233,6 +12256,12 @@ class RCRTCClient {
|
|
|
12233
12256
|
}
|
|
12234
12257
|
_joinRTCRoom(roomId, joinType, outerUserDatas, useMutilPeerC, roomType = engine.RTCMode.RTC) {
|
|
12235
12258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12259
|
+
if (this._crtRoom) {
|
|
12260
|
+
return { code: exports.RCRTCCode.REPERT_JOIN_ROOM };
|
|
12261
|
+
}
|
|
12262
|
+
if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
|
|
12263
|
+
return { code: exports.RCRTCCode.SIGNAL_DISCONNECTED };
|
|
12264
|
+
}
|
|
12236
12265
|
if (isIllegalConnection(this._context.getNaviInfo())) {
|
|
12237
12266
|
return { code: exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR };
|
|
12238
12267
|
}
|
|
@@ -12815,9 +12844,9 @@ const installer = {
|
|
|
12815
12844
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12816
12845
|
return false;
|
|
12817
12846
|
}
|
|
12818
|
-
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12819
|
-
if (!engine.VersionManage.validEngine("4.6.0-beem.
|
|
12820
|
-
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.
|
|
12847
|
+
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.11");
|
|
12848
|
+
if (!engine.VersionManage.validEngine(">=4.6.0-beem.11")) {
|
|
12849
|
+
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=4.6.0-beem.11"}'.`);
|
|
12821
12850
|
return false;
|
|
12822
12851
|
}
|
|
12823
12852
|
return true;
|
|
@@ -12825,7 +12854,7 @@ const installer = {
|
|
|
12825
12854
|
setup(context, runtime, options = {}) {
|
|
12826
12855
|
logger.setLogLevel(options.logLevel);
|
|
12827
12856
|
logger.setLogStdout(options.logStdout);
|
|
12828
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12857
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.11"}, Commit: ${"dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb"}`);
|
|
12829
12858
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12830
12859
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12831
12860
|
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.11
|
|
3
|
+
* CommitId - dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb
|
|
4
|
+
* Wed Jun 29 2022 19:23:04 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
@@ -6543,6 +6543,24 @@
|
|
|
6543
6543
|
CDNUris: CDNUris || {}
|
|
6544
6544
|
};
|
|
6545
6545
|
};
|
|
6546
|
+
/**
|
|
6547
|
+
* 修改订阅失败的资源通道方向为 inactive,返回修改后的 answer sdp
|
|
6548
|
+
*/
|
|
6549
|
+
const setAnswerSdpDirection = (failedList, answerSdp) => {
|
|
6550
|
+
const answerMArr = answerSdp.split('\r\nm=');
|
|
6551
|
+
failedList.forEach((item) => {
|
|
6552
|
+
const mediaType = parseInt(item.track.getTrackId().split('_').pop());
|
|
6553
|
+
const kind = (mediaType === exports.RCMediaType.AUDIO_ONLY) ? 'audio' : 'video';
|
|
6554
|
+
const msid = `${item.track.getUserId()}_${item.track.getTag()}`;
|
|
6555
|
+
answerMArr.forEach((sdpM, i) => {
|
|
6556
|
+
if (sdpM.includes(`${kind}`) && sdpM.includes(`a=msid:${msid}`)) {
|
|
6557
|
+
const newSdpM = sdpM.replace('a=sendonly', 'a=inactive');
|
|
6558
|
+
answerMArr.splice(i, 1, newSdpM);
|
|
6559
|
+
}
|
|
6560
|
+
});
|
|
6561
|
+
});
|
|
6562
|
+
return answerMArr.join('\r\nm=');
|
|
6563
|
+
};
|
|
6546
6564
|
|
|
6547
6565
|
/**
|
|
6548
6566
|
* RTC 消息类型常量
|
|
@@ -8520,7 +8538,7 @@
|
|
|
8520
8538
|
* 加入房间
|
|
8521
8539
|
*/
|
|
8522
8540
|
sendR1() {
|
|
8523
|
-
const rtcVersion = "5.2.4-beem.
|
|
8541
|
+
const rtcVersion = "5.2.4-beem.11";
|
|
8524
8542
|
const imVersion = this._context.getCoreVersion();
|
|
8525
8543
|
const platform = 'web';
|
|
8526
8544
|
const pcName = navigator.platform;
|
|
@@ -8781,7 +8799,7 @@
|
|
|
8781
8799
|
_onUserUnpublish(tracks) {
|
|
8782
8800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8783
8801
|
// 需要替业务层取消订阅,业务层只需关注 UI 变化
|
|
8784
|
-
yield this.
|
|
8802
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
8785
8803
|
tracks.forEach(item => {
|
|
8786
8804
|
item.__innerDestroy();
|
|
8787
8805
|
delete this._remoteTracks[item.getTrackId()];
|
|
@@ -9036,7 +9054,7 @@
|
|
|
9036
9054
|
userIds.push(userId);
|
|
9037
9055
|
});
|
|
9038
9056
|
if (tracks.length) {
|
|
9039
|
-
yield this.
|
|
9057
|
+
yield push(() => this.__unsubscribe(tracks));
|
|
9040
9058
|
tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
|
|
9041
9059
|
}
|
|
9042
9060
|
// 等待队列执行完成后清除内存数据
|
|
@@ -9800,14 +9818,19 @@
|
|
|
9800
9818
|
return { code: resultCode };
|
|
9801
9819
|
}
|
|
9802
9820
|
logger.info(`subscribe success: ${subTrackIds.join(',')}`);
|
|
9803
|
-
const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
|
|
9804
|
-
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9805
|
-
return { code: resCode };
|
|
9806
|
-
}
|
|
9807
9821
|
// 获取真正订阅成功的资源
|
|
9808
9822
|
const subSuccessTrackIds = subscribedList === null || subscribedList === void 0 ? void 0 : subscribedList.map(item => `${item.msid}_${item.mediaType}`);
|
|
9809
9823
|
const subSuccessList = attrs.filter(item => subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId()));
|
|
9810
9824
|
const failedList = attrs.filter(item => !(subSuccessTrackIds === null || subSuccessTrackIds === void 0 ? void 0 : subSuccessTrackIds.includes(item.track.getTrackId())));
|
|
9825
|
+
/**
|
|
9826
|
+
* 订阅失败的资源,需把 sdp 中对应的通道方向改为 inactive
|
|
9827
|
+
* 否则下次复用通道时,浏览器 peerConnection 的 ontrack 事件不会被触发
|
|
9828
|
+
*/
|
|
9829
|
+
const answerSdp = failedList.length ? setAnswerSdpDirection(failedList, answer.sdp) : answer.sdp;
|
|
9830
|
+
const resCode = yield this._pc.setRemoteAnswer(answerSdp);
|
|
9831
|
+
if (resCode !== exports.RCRTCCode.SUCCESS) {
|
|
9832
|
+
return { code: resCode };
|
|
9833
|
+
}
|
|
9811
9834
|
// 更新 remoteTrack.isSubscribed
|
|
9812
9835
|
for (const trackId in this._remoteTracks) {
|
|
9813
9836
|
const subed = subSuccessList.some(item => item.track.getTrackId() === trackId);
|
|
@@ -10773,7 +10796,7 @@
|
|
|
10773
10796
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
10774
10797
|
'Cache-Control': 'no-cache',
|
|
10775
10798
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
10776
|
-
ClientVersion: "5.2.4-beem.
|
|
10799
|
+
ClientVersion: "5.2.4-beem.11",
|
|
10777
10800
|
'Client-Session-Id': getUUID(),
|
|
10778
10801
|
'Request-Id': Date.now().toString()
|
|
10779
10802
|
});
|
|
@@ -12233,6 +12256,12 @@
|
|
|
12233
12256
|
}
|
|
12234
12257
|
_joinRTCRoom(roomId, joinType, outerUserDatas, useMutilPeerC, roomType = engine.RTCMode.RTC) {
|
|
12235
12258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12259
|
+
if (this._crtRoom) {
|
|
12260
|
+
return { code: exports.RCRTCCode.REPERT_JOIN_ROOM };
|
|
12261
|
+
}
|
|
12262
|
+
if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
|
|
12263
|
+
return { code: exports.RCRTCCode.SIGNAL_DISCONNECTED };
|
|
12264
|
+
}
|
|
12236
12265
|
if (isIllegalConnection(this._context.getNaviInfo())) {
|
|
12237
12266
|
return { code: exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR };
|
|
12238
12267
|
}
|
|
@@ -12815,9 +12844,9 @@
|
|
|
12815
12844
|
logger.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
12816
12845
|
return false;
|
|
12817
12846
|
}
|
|
12818
|
-
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.
|
|
12819
|
-
if (!engine.VersionManage.validEngine("4.6.0-beem.
|
|
12820
|
-
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.
|
|
12847
|
+
engine.VersionManage.add('plugin-rtc', "5.2.4-beem.11");
|
|
12848
|
+
if (!engine.VersionManage.validEngine(">=4.6.0-beem.11")) {
|
|
12849
|
+
logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=4.6.0-beem.11"}'.`);
|
|
12821
12850
|
return false;
|
|
12822
12851
|
}
|
|
12823
12852
|
return true;
|
|
@@ -12825,7 +12854,7 @@
|
|
|
12825
12854
|
setup(context, runtime, options = {}) {
|
|
12826
12855
|
logger.setLogLevel(options.logLevel);
|
|
12827
12856
|
logger.setLogStdout(options.logStdout);
|
|
12828
|
-
logger.warn(`RCRTC Version: ${"5.2.4-beem.
|
|
12857
|
+
logger.warn(`RCRTC Version: ${"5.2.4-beem.11"}, Commit: ${"dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb"}`);
|
|
12829
12858
|
logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
|
|
12830
12859
|
logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
|
|
12831
12860
|
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.11",
|
|
4
4
|
"description": "@rongcloud/plugin-rtc",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"__attrs__": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"node": ">=10.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@rongcloud/engine": "4.6.0-beem.
|
|
34
|
+
"@rongcloud/engine": ">=4.6.0-beem.11"
|
|
35
35
|
},
|
|
36
|
-
"__commit__": "
|
|
36
|
+
"__commit__": "dbfe1dbe0b6627aa62beb6c3d31f6b2894ccadcb"
|
|
37
37
|
}
|