@rongcloud/plugin-rtc 5.2.4-beem.1 → 5.2.4-beem.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.2.4-beem.1
3
- * CommitId - d026964c6715be7805a3e5c8addd64d4008d17bd
4
- * Thu May 12 2022 18:57:27 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.2.4-beem.2
3
+ * CommitId - 51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c
4
+ * Mon May 16 2022 17:37:30 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.1
3
- * CommitId - d026964c6715be7805a3e5c8addd64d4008d17bd
4
- * Thu May 12 2022 18:57:27 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.2.4-beem.2
3
+ * CommitId - 51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c
4
+ * Mon May 16 2022 17:37:30 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';
@@ -6589,54 +6589,66 @@ class Pinger {
6589
6589
  * 记录最近一次成功的 Ping 时间戳
6590
6590
  */
6591
6591
  this._latestTimestamp = Date.now();
6592
+ this._started = false;
6592
6593
  this._timer = null;
6593
6594
  }
6594
6595
  /**
6595
6596
  * 启动 Ping
6596
6597
  */
6597
6598
  start() {
6598
- return __awaiter(this, void 0, void 0, function* () {
6599
- if (this._timer) {
6600
- return;
6601
- }
6602
- // logger.debug('rtcping timer start ->')
6603
- this._timer = setInterval(this._loop.bind(this), this._gap);
6599
+ if (this._started) {
6600
+ return;
6601
+ }
6602
+ logger.info('rtcping start ->');
6603
+ this._started = true;
6604
+ this._checkAlive();
6605
+ }
6606
+ _sendPing() {
6607
+ return new Promise(resolve => {
6608
+ this._context.rtcPing(this._roomId, this._roomMode)
6609
+ .then(resolve)
6610
+ .catch(error => {
6611
+ logger.error(`rtcping receive unknown error -> ${error}`);
6612
+ resolve(ErrorCode.UNKNOWN);
6613
+ });
6614
+ setTimeout(resolve, PING_TIMEOUT, ErrorCode.TIMEOUT);
6604
6615
  });
6605
6616
  }
6606
- _loop() {
6617
+ _checkAlive() {
6607
6618
  var _a, _b, _c;
6608
6619
  return __awaiter(this, void 0, void 0, function* () {
6609
- // logger.debug('rtcping send ->')
6610
- const code = yield new Promise(resolve => {
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
- });
6620
+ logger.info('rtcping ->');
6621
+ const code = yield this._sendPing();
6619
6622
  const now = Date.now();
6620
- // ping 成功,记录时间戳,延时递归
6623
+ // ping 成功
6621
6624
  if (code === ErrorCode.SUCCESS) {
6622
- // logger.debug('rtcping success <-')
6625
+ logger.info('rtcping success ->');
6623
6626
  this._latestTimestamp = now;
6624
6627
  (_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, RCRTCPingResult.SUCCESS);
6628
+ // 延迟递归
6629
+ this._timer = setTimeout(() => this._checkAlive(), this._gap);
6625
6630
  return;
6626
6631
  }
6627
- (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, RCRTCPingResult.FAIL);
6628
6632
  logger.warn(`rtcping failed -> code: ${code}`);
6633
+ (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, RCRTCPingResult.FAIL);
6629
6634
  // 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
6630
6635
  if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
6631
6636
  this.stop();
6632
6637
  (_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
6638
+ return;
6633
6639
  }
6640
+ // 延迟发 rtcping,避免调用栈递归阻塞
6641
+ this._timer = setTimeout(() => this._checkAlive(), 500);
6634
6642
  });
6635
6643
  }
6636
6644
  stop() {
6645
+ if (!this._started) {
6646
+ return;
6647
+ }
6648
+ logger.info('rtcping stop ->');
6649
+ this._started = false;
6637
6650
  if (this._timer) {
6638
- // logger.warn('rtcping timer stop <-')
6639
- clearInterval(this._timer);
6651
+ clearTimeout(this._timer);
6640
6652
  this._timer = null;
6641
6653
  }
6642
6654
  }
@@ -8434,7 +8446,7 @@ class PolarisReporter {
8434
8446
  * 加入房间
8435
8447
  */
8436
8448
  sendR1() {
8437
- const rtcVersion = "5.2.4-beem.1";
8449
+ const rtcVersion = "5.2.4-beem.2";
8438
8450
  const imVersion = this._context.getCoreVersion();
8439
8451
  const platform = 'web';
8440
8452
  const pcName = navigator.platform;
@@ -8761,6 +8773,9 @@ class RCAbstractRoom {
8761
8773
  * * 当值为 true 时,说明本端收到被踢出房间通知
8762
8774
  */
8763
8775
  _kickoff(byServer, content) {
8776
+ if (this._destroyed) {
8777
+ return;
8778
+ }
8764
8779
  logger.warn(`onKickOff -> byServer: ${byServer}`);
8765
8780
  this._ntfClearRoomItem();
8766
8781
  this._leaveHandle(!byServer);
@@ -9139,6 +9154,17 @@ class RCAbstractRoom {
9139
9154
  __destroy(quitRoom) {
9140
9155
  return this._leaveHandle(quitRoom);
9141
9156
  }
9157
+ /**
9158
+ * 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
9159
+ * 导致在未完全退出的过程中仍能听到房间内的声音问题
9160
+ */
9161
+ _muteRemoteTracksBeforeQuit() {
9162
+ const remoteTracks = Object.values(this._remoteTracks);
9163
+ if (!remoteTracks.length) {
9164
+ return;
9165
+ }
9166
+ remoteTracks.forEach((track) => track.mute());
9167
+ }
9142
9168
  _leaveHandle(quitRoom) {
9143
9169
  var _a;
9144
9170
  return __awaiter(this, void 0, void 0, function* () {
@@ -9146,6 +9172,7 @@ class RCAbstractRoom {
9146
9172
  return;
9147
9173
  }
9148
9174
  this._destroyed = true;
9175
+ this._muteRemoteTracksBeforeQuit();
9149
9176
  // 清除音量上报定时器
9150
9177
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
9151
9178
  if (quitRoom) {
@@ -10676,7 +10703,7 @@ const getCommonHeader = () => ({
10676
10703
  'Content-Type': 'application/json;charset=UTF-8',
10677
10704
  'Cache-Control': 'no-cache',
10678
10705
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
10679
- ClientVersion: "5.2.4-beem.1",
10706
+ ClientVersion: "5.2.4-beem.2",
10680
10707
  'Client-Session-Id': getUUID(),
10681
10708
  'Request-Id': Date.now().toString()
10682
10709
  });
@@ -12704,7 +12731,7 @@ const installer = {
12704
12731
  logger.error('Please use the https protocol or use `http://localhost` to open the page!');
12705
12732
  return false;
12706
12733
  }
12707
- VersionManage.add('plugin-rtc', "5.2.4-beem.1");
12734
+ VersionManage.add('plugin-rtc', "5.2.4-beem.2");
12708
12735
  if (!VersionManage.validEngine("4.6.0-beem.5")) {
12709
12736
  logger.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
12710
12737
  return false;
@@ -12714,7 +12741,7 @@ const installer = {
12714
12741
  setup(context, runtime, options = {}) {
12715
12742
  logger.setLogLevel(options.logLevel);
12716
12743
  logger.setLogStdout(options.logStdout);
12717
- logger.warn(`RCRTC Version: ${"5.2.4-beem.1"}, Commit: ${"d026964c6715be7805a3e5c8addd64d4008d17bd"}`);
12744
+ logger.warn(`RCRTC Version: ${"5.2.4-beem.2"}, Commit: ${"51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c"}`);
12718
12745
  logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
12719
12746
  logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
12720
12747
  logger.warn(`browserInfo.version -> ${browserInfo.version}`);
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.2.4-beem.1
3
- * CommitId - d026964c6715be7805a3e5c8addd64d4008d17bd
4
- * Thu May 12 2022 18:57:27 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.2.4-beem.2
3
+ * CommitId - 51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c
4
+ * Mon May 16 2022 17:37:30 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  'use strict';
@@ -6592,54 +6592,66 @@ class Pinger {
6592
6592
  * 记录最近一次成功的 Ping 时间戳
6593
6593
  */
6594
6594
  this._latestTimestamp = Date.now();
6595
+ this._started = false;
6595
6596
  this._timer = null;
6596
6597
  }
6597
6598
  /**
6598
6599
  * 启动 Ping
6599
6600
  */
6600
6601
  start() {
6601
- return __awaiter(this, void 0, void 0, function* () {
6602
- if (this._timer) {
6603
- return;
6604
- }
6605
- // logger.debug('rtcping timer start ->')
6606
- this._timer = setInterval(this._loop.bind(this), this._gap);
6602
+ if (this._started) {
6603
+ return;
6604
+ }
6605
+ logger.info('rtcping start ->');
6606
+ this._started = true;
6607
+ this._checkAlive();
6608
+ }
6609
+ _sendPing() {
6610
+ return new Promise(resolve => {
6611
+ this._context.rtcPing(this._roomId, this._roomMode)
6612
+ .then(resolve)
6613
+ .catch(error => {
6614
+ logger.error(`rtcping receive unknown error -> ${error}`);
6615
+ resolve(engine.ErrorCode.UNKNOWN);
6616
+ });
6617
+ setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
6607
6618
  });
6608
6619
  }
6609
- _loop() {
6620
+ _checkAlive() {
6610
6621
  var _a, _b, _c;
6611
6622
  return __awaiter(this, void 0, void 0, function* () {
6612
- // logger.debug('rtcping send ->')
6613
- const code = yield new Promise(resolve => {
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
- });
6623
+ logger.info('rtcping ->');
6624
+ const code = yield this._sendPing();
6622
6625
  const now = Date.now();
6623
- // ping 成功,记录时间戳,延时递归
6626
+ // ping 成功
6624
6627
  if (code === engine.ErrorCode.SUCCESS) {
6625
- // logger.debug('rtcping success <-')
6628
+ logger.info('rtcping success ->');
6626
6629
  this._latestTimestamp = now;
6627
6630
  (_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, exports.RCRTCPingResult.SUCCESS);
6631
+ // 延迟递归
6632
+ this._timer = setTimeout(() => this._checkAlive(), this._gap);
6628
6633
  return;
6629
6634
  }
6630
- (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
6631
6635
  logger.warn(`rtcping failed -> code: ${code}`);
6636
+ (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
6632
6637
  // 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
6633
6638
  if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
6634
6639
  this.stop();
6635
6640
  (_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
6641
+ return;
6636
6642
  }
6643
+ // 延迟发 rtcping,避免调用栈递归阻塞
6644
+ this._timer = setTimeout(() => this._checkAlive(), 500);
6637
6645
  });
6638
6646
  }
6639
6647
  stop() {
6648
+ if (!this._started) {
6649
+ return;
6650
+ }
6651
+ logger.info('rtcping stop ->');
6652
+ this._started = false;
6640
6653
  if (this._timer) {
6641
- // logger.warn('rtcping timer stop <-')
6642
- clearInterval(this._timer);
6654
+ clearTimeout(this._timer);
6643
6655
  this._timer = null;
6644
6656
  }
6645
6657
  }
@@ -8437,7 +8449,7 @@ class PolarisReporter {
8437
8449
  * 加入房间
8438
8450
  */
8439
8451
  sendR1() {
8440
- const rtcVersion = "5.2.4-beem.1";
8452
+ const rtcVersion = "5.2.4-beem.2";
8441
8453
  const imVersion = this._context.getCoreVersion();
8442
8454
  const platform = 'web';
8443
8455
  const pcName = navigator.platform;
@@ -8764,6 +8776,9 @@ class RCAbstractRoom {
8764
8776
  * * 当值为 true 时,说明本端收到被踢出房间通知
8765
8777
  */
8766
8778
  _kickoff(byServer, content) {
8779
+ if (this._destroyed) {
8780
+ return;
8781
+ }
8767
8782
  logger.warn(`onKickOff -> byServer: ${byServer}`);
8768
8783
  this._ntfClearRoomItem();
8769
8784
  this._leaveHandle(!byServer);
@@ -9142,6 +9157,17 @@ class RCAbstractRoom {
9142
9157
  __destroy(quitRoom) {
9143
9158
  return this._leaveHandle(quitRoom);
9144
9159
  }
9160
+ /**
9161
+ * 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
9162
+ * 导致在未完全退出的过程中仍能听到房间内的声音问题
9163
+ */
9164
+ _muteRemoteTracksBeforeQuit() {
9165
+ const remoteTracks = Object.values(this._remoteTracks);
9166
+ if (!remoteTracks.length) {
9167
+ return;
9168
+ }
9169
+ remoteTracks.forEach((track) => track.mute());
9170
+ }
9145
9171
  _leaveHandle(quitRoom) {
9146
9172
  var _a;
9147
9173
  return __awaiter(this, void 0, void 0, function* () {
@@ -9149,6 +9175,7 @@ class RCAbstractRoom {
9149
9175
  return;
9150
9176
  }
9151
9177
  this._destroyed = true;
9178
+ this._muteRemoteTracksBeforeQuit();
9152
9179
  // 清除音量上报定时器
9153
9180
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
9154
9181
  if (quitRoom) {
@@ -10679,7 +10706,7 @@ const getCommonHeader = () => ({
10679
10706
  'Content-Type': 'application/json;charset=UTF-8',
10680
10707
  'Cache-Control': 'no-cache',
10681
10708
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
10682
- ClientVersion: "5.2.4-beem.1",
10709
+ ClientVersion: "5.2.4-beem.2",
10683
10710
  'Client-Session-Id': getUUID(),
10684
10711
  'Request-Id': Date.now().toString()
10685
10712
  });
@@ -12707,7 +12734,7 @@ const installer = {
12707
12734
  logger.error('Please use the https protocol or use `http://localhost` to open the page!');
12708
12735
  return false;
12709
12736
  }
12710
- engine.VersionManage.add('plugin-rtc', "5.2.4-beem.1");
12737
+ engine.VersionManage.add('plugin-rtc', "5.2.4-beem.2");
12711
12738
  if (!engine.VersionManage.validEngine("4.6.0-beem.5")) {
12712
12739
  logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
12713
12740
  return false;
@@ -12717,7 +12744,7 @@ const installer = {
12717
12744
  setup(context, runtime, options = {}) {
12718
12745
  logger.setLogLevel(options.logLevel);
12719
12746
  logger.setLogStdout(options.logStdout);
12720
- logger.warn(`RCRTC Version: ${"5.2.4-beem.1"}, Commit: ${"d026964c6715be7805a3e5c8addd64d4008d17bd"}`);
12747
+ logger.warn(`RCRTC Version: ${"5.2.4-beem.2"}, Commit: ${"51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c"}`);
12721
12748
  logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
12722
12749
  logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
12723
12750
  logger.warn(`browserInfo.version -> ${browserInfo.version}`);
package/dist/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.2.4-beem.1
3
- * CommitId - d026964c6715be7805a3e5c8addd64d4008d17bd
4
- * Thu May 12 2022 18:57:27 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.2.4-beem.2
3
+ * CommitId - 51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c
4
+ * Mon May 16 2022 17:37:30 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  (function (global, factory) {
@@ -6592,54 +6592,66 @@
6592
6592
  * 记录最近一次成功的 Ping 时间戳
6593
6593
  */
6594
6594
  this._latestTimestamp = Date.now();
6595
+ this._started = false;
6595
6596
  this._timer = null;
6596
6597
  }
6597
6598
  /**
6598
6599
  * 启动 Ping
6599
6600
  */
6600
6601
  start() {
6601
- return __awaiter(this, void 0, void 0, function* () {
6602
- if (this._timer) {
6603
- return;
6604
- }
6605
- // logger.debug('rtcping timer start ->')
6606
- this._timer = setInterval(this._loop.bind(this), this._gap);
6602
+ if (this._started) {
6603
+ return;
6604
+ }
6605
+ logger.info('rtcping start ->');
6606
+ this._started = true;
6607
+ this._checkAlive();
6608
+ }
6609
+ _sendPing() {
6610
+ return new Promise(resolve => {
6611
+ this._context.rtcPing(this._roomId, this._roomMode)
6612
+ .then(resolve)
6613
+ .catch(error => {
6614
+ logger.error(`rtcping receive unknown error -> ${error}`);
6615
+ resolve(engine.ErrorCode.UNKNOWN);
6616
+ });
6617
+ setTimeout(resolve, PING_TIMEOUT, engine.ErrorCode.TIMEOUT);
6607
6618
  });
6608
6619
  }
6609
- _loop() {
6620
+ _checkAlive() {
6610
6621
  var _a, _b, _c;
6611
6622
  return __awaiter(this, void 0, void 0, function* () {
6612
- // logger.debug('rtcping send ->')
6613
- const code = yield new Promise(resolve => {
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
- });
6623
+ logger.info('rtcping ->');
6624
+ const code = yield this._sendPing();
6622
6625
  const now = Date.now();
6623
- // ping 成功,记录时间戳,延时递归
6626
+ // ping 成功
6624
6627
  if (code === engine.ErrorCode.SUCCESS) {
6625
- // logger.debug('rtcping success <-')
6628
+ logger.info('rtcping success ->');
6626
6629
  this._latestTimestamp = now;
6627
6630
  (_a = this.onPingResult) === null || _a === void 0 ? void 0 : _a.call(this, exports.RCRTCPingResult.SUCCESS);
6631
+ // 延迟递归
6632
+ this._timer = setTimeout(() => this._checkAlive(), this._gap);
6628
6633
  return;
6629
6634
  }
6630
- (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
6631
6635
  logger.warn(`rtcping failed -> code: ${code}`);
6636
+ (_b = this.onPingResult) === null || _b === void 0 ? void 0 : _b.call(this, exports.RCRTCPingResult.FAIL);
6632
6637
  // 超出 1 分钟未成功进行 rtcping 操作,或用户已不存在于房间内时,通知客户离线
6633
6638
  if (code === 40003 || now - this._latestTimestamp > 60 * 1000) {
6634
6639
  this.stop();
6635
6640
  (_c = this.onFailed) === null || _c === void 0 ? void 0 : _c.call(this, code === 40003);
6641
+ return;
6636
6642
  }
6643
+ // 延迟发 rtcping,避免调用栈递归阻塞
6644
+ this._timer = setTimeout(() => this._checkAlive(), 500);
6637
6645
  });
6638
6646
  }
6639
6647
  stop() {
6648
+ if (!this._started) {
6649
+ return;
6650
+ }
6651
+ logger.info('rtcping stop ->');
6652
+ this._started = false;
6640
6653
  if (this._timer) {
6641
- // logger.warn('rtcping timer stop <-')
6642
- clearInterval(this._timer);
6654
+ clearTimeout(this._timer);
6643
6655
  this._timer = null;
6644
6656
  }
6645
6657
  }
@@ -8437,7 +8449,7 @@
8437
8449
  * 加入房间
8438
8450
  */
8439
8451
  sendR1() {
8440
- const rtcVersion = "5.2.4-beem.1";
8452
+ const rtcVersion = "5.2.4-beem.2";
8441
8453
  const imVersion = this._context.getCoreVersion();
8442
8454
  const platform = 'web';
8443
8455
  const pcName = navigator.platform;
@@ -8764,6 +8776,9 @@
8764
8776
  * * 当值为 true 时,说明本端收到被踢出房间通知
8765
8777
  */
8766
8778
  _kickoff(byServer, content) {
8779
+ if (this._destroyed) {
8780
+ return;
8781
+ }
8767
8782
  logger.warn(`onKickOff -> byServer: ${byServer}`);
8768
8783
  this._ntfClearRoomItem();
8769
8784
  this._leaveHandle(!byServer);
@@ -9142,6 +9157,17 @@
9142
9157
  __destroy(quitRoom) {
9143
9158
  return this._leaveHandle(quitRoom);
9144
9159
  }
9160
+ /**
9161
+ * 退出房间之前禁用所有远端资源,避免退出动作耗时过长,
9162
+ * 导致在未完全退出的过程中仍能听到房间内的声音问题
9163
+ */
9164
+ _muteRemoteTracksBeforeQuit() {
9165
+ const remoteTracks = Object.values(this._remoteTracks);
9166
+ if (!remoteTracks.length) {
9167
+ return;
9168
+ }
9169
+ remoteTracks.forEach((track) => track.mute());
9170
+ }
9145
9171
  _leaveHandle(quitRoom) {
9146
9172
  var _a;
9147
9173
  return __awaiter(this, void 0, void 0, function* () {
@@ -9149,6 +9175,7 @@
9149
9175
  return;
9150
9176
  }
9151
9177
  this._destroyed = true;
9178
+ this._muteRemoteTracksBeforeQuit();
9152
9179
  // 清除音量上报定时器
9153
9180
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
9154
9181
  if (quitRoom) {
@@ -10679,7 +10706,7 @@
10679
10706
  'Content-Type': 'application/json;charset=UTF-8',
10680
10707
  'Cache-Control': 'no-cache',
10681
10708
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
10682
- ClientVersion: "5.2.4-beem.1",
10709
+ ClientVersion: "5.2.4-beem.2",
10683
10710
  'Client-Session-Id': getUUID(),
10684
10711
  'Request-Id': Date.now().toString()
10685
10712
  });
@@ -12707,7 +12734,7 @@
12707
12734
  logger.error('Please use the https protocol or use `http://localhost` to open the page!');
12708
12735
  return false;
12709
12736
  }
12710
- engine.VersionManage.add('plugin-rtc', "5.2.4-beem.1");
12737
+ engine.VersionManage.add('plugin-rtc', "5.2.4-beem.2");
12711
12738
  if (!engine.VersionManage.validEngine("4.6.0-beem.5")) {
12712
12739
  logger.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"4.6.0-beem.5"}'.`);
12713
12740
  return false;
@@ -12717,7 +12744,7 @@
12717
12744
  setup(context, runtime, options = {}) {
12718
12745
  logger.setLogLevel(options.logLevel);
12719
12746
  logger.setLogStdout(options.logStdout);
12720
- logger.warn(`RCRTC Version: ${"5.2.4-beem.1"}, Commit: ${"d026964c6715be7805a3e5c8addd64d4008d17bd"}`);
12747
+ logger.warn(`RCRTC Version: ${"5.2.4-beem.2"}, Commit: ${"51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c"}`);
12721
12748
  logger.warn(`browserInfo.browser -> ${browserInfo.browser}`);
12722
12749
  logger.warn(`browserInfo.supportsUnifiedPlan -> ${browserInfo.supportsUnifiedPlan}`);
12723
12750
  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.1",
3
+ "version": "5.2.4-beem.2",
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__": "d026964c6715be7805a3e5c8addd64d4008d17bd"
36
+ "__commit__": "51c7e1de9a288f3456394ed2bc6ee9e09c4afa8c"
37
37
  }