@rongcloud/plugin-rtc 5.5.5-beem-alpha.1 → 5.5.5-beem-alpha.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.5.5-beem-alpha.1
3
- * CommitId - 4807d9272db7b224e762a75df11762453a730f9e
4
- * Thu Oct 13 2022 21:01:14 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.5.5-beem-alpha.2
3
+ * CommitId - 53292a559174278ff032c3811be232015e47f007
4
+ * Fri Oct 14 2022 11:08:06 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  import { EventEmitter, BasicLogger, INaviInfo, RTCPluginContext, AbsCodec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, ConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, EnableLogL, IPluginGenerator } from '@rongcloud/engine';
@@ -1764,6 +1764,7 @@ declare class RCRTCPeerCManager {
1764
1764
  * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
1765
1765
  */
1766
1766
  private _mutilPeerC;
1767
+ onTrackTrouble?: Function;
1767
1768
  constructor(
1768
1769
  /**
1769
1770
  * 是否使用多 peerConnection
@@ -2970,6 +2971,12 @@ declare class PolarisHttpReporter {
2970
2971
  sendR2(action: string, status: string, trackIds: string[]): Promise<void>;
2971
2972
  }
2972
2973
 
2974
+ declare enum RCEncoder {
2975
+ VP8 = "VP8",
2976
+ VP9 = "VP9",
2977
+ H264 = "H264"
2978
+ }
2979
+
2973
2980
  /**
2974
2981
  * PC 实例管理类
2975
2982
  */
@@ -2990,6 +2997,7 @@ declare class RCRTCPeerConnection extends EventEmitter {
2990
2997
  * 北极星上传实例
2991
2998
  */
2992
2999
  private readonly _polarisReport?;
3000
+ private readonly onTrackTrouble?;
2993
3001
  static __INNER_EVENT_TRACK_READY__: string;
2994
3002
  private readonly _rtcPeerConn;
2995
3003
  private readonly _sdpStrategy;
@@ -3018,7 +3026,7 @@ declare class RCRTCPeerConnection extends EventEmitter {
3018
3026
  /**
3019
3027
  * 北极星上传实例
3020
3028
  */
3021
- _polarisReport?: PolarisHttpReporter | undefined);
3029
+ _polarisReport?: PolarisHttpReporter | undefined, onTrackTrouble?: Function | undefined);
3022
3030
  getName(): string;
3023
3031
  getLocalTracks(): RCLocalTrack[];
3024
3032
  private _onConnectionStateChange;
@@ -3080,9 +3088,25 @@ declare class RCRTCPeerConnection extends EventEmitter {
3080
3088
  */
3081
3089
  __reportR3R4ToPolaris(): Promise<void>;
3082
3090
  getRTCPeerConn(): RTCPeerConnection;
3091
+ /**
3092
+ * 它返回一个 RTCRtpCodecCapability 对象数组,第一个元素是与传入的编码器类型匹配的元素
3093
+ * @param {RCEncoder} encoder - RCEncoder.H264
3094
+ * @returns 正在返回 RTCRtpCodecCapability[] 数组。
3095
+ */
3096
+ private getCapabilitiesCodes;
3097
+ /**
3098
+ * 它为视频流设置编码器首选项。
3099
+ * @param {RCEncoder} [encoder] - RC编码器
3100
+ */
3101
+ setEncoderPreferences(encoder?: RCEncoder): Promise<void>;
3083
3102
  destroy(): void;
3084
3103
  clearReTryExchangeTimer(): void;
3085
3104
  isDestroyed(): boolean;
3105
+ /**
3106
+ * 视频不可使用的收集器
3107
+ */
3108
+ private troubleTracksCollection;
3109
+ private setTroubleTrack;
3086
3110
  }
3087
3111
 
3088
3112
  /**
@@ -3721,6 +3745,11 @@ interface IRoomEventListener extends IRCRTCTrackEventListener {
3721
3745
  * @param failedList 订阅失败的列表
3722
3746
  */
3723
3747
  onTaskCompleted?(code: RCRTCCode, subscribe: ISubscribeAttr[], unsubscribe: ISubscribeAttr[], failedList: ISubscribeAttr[]): void;
3748
+ /**
3749
+ * 当房间内资源(音频视频)异常时给出处理
3750
+ *
3751
+ */
3752
+ onTrackTrouble?(tracks: RCLocalTrack[]): void;
3724
3753
  }
3725
3754
  /**
3726
3755
  * RTCClient 初始化配置
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.5.5-beem-alpha.1
3
- * CommitId - 4807d9272db7b224e762a75df11762453a730f9e
4
- * Thu Oct 13 2022 21:01:14 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.5.5-beem-alpha.2
3
+ * CommitId - 53292a559174278ff032c3811be232015e47f007
4
+ * Fri Oct 14 2022 11:08:06 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  import { Logger, EventEmitter, isNumber, validate, isObject as isObject$1, ErrorCode, HttpMethod, isArray, ConnectionStatus, notEmptyObject, notEmptyArray, notEmptyString, isString, RTCMode as RTCMode$1, assert, ConversationType, isHttpUrl, isBoolean, isUndefined, forEach, VersionManage, LogL } from '@rongcloud/engine';
@@ -833,6 +833,10 @@ var RCLoggerTag;
833
833
  * 连通率相关日志-对端接收首次发布资源
834
834
  */
835
835
  RCLoggerTag["L_QS_RECV_PUB_MSG_S"] = "RTC-recvPubMsg-S";
836
+ /**
837
+ * 设置编码器默认值
838
+ */
839
+ RCLoggerTag["L_SET_ENCODER_PREFERENCES_S"] = "RTC-set_Encoder_Preferences-S";
836
840
  /**
837
841
  * 下消息通知拉取房间状态
838
842
  */
@@ -14647,7 +14651,7 @@ const getCommonHeader$1 = () => ({
14647
14651
  'Content-Type': 'application/json;charset=UTF-8',
14648
14652
  'Cache-Control': 'no-cache',
14649
14653
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14650
- ClientVersion: "5.5.5-beem-alpha.1",
14654
+ ClientVersion: "5.5.5-beem-alpha.2",
14651
14655
  'Client-Session-Id': getUUID(),
14652
14656
  'Request-Id': Date.now().toString(),
14653
14657
  });
@@ -14787,7 +14791,7 @@ const getCommonHeader = () => ({
14787
14791
  'Content-Type': 'application/json;charset=UTF-8',
14788
14792
  'Cache-Control': 'no-cache',
14789
14793
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14790
- ClientVersion: "5.5.5-beem-alpha.1",
14794
+ ClientVersion: "5.5.5-beem-alpha.2",
14791
14795
  'Client-Session-Id': getUUID(),
14792
14796
  'Request-Id': Date.now().toString(),
14793
14797
  });
@@ -15250,6 +15254,60 @@ const senderHasRemoteData = (sender) => {
15250
15254
  return true;
15251
15255
  };
15252
15256
 
15257
+ class SdpResource {
15258
+ constructor() {
15259
+ /* 一个私有变量,它是字符串到资源的映射。 */
15260
+ this.__streams = new Map();
15261
+ }
15262
+ /**
15263
+ * 如果实例不存在,则创建它。如果存在,则返回
15264
+ * @returns SdpResource 类的实例。
15265
+ */
15266
+ static getInstance() {
15267
+ if (!SdpResource.instance) {
15268
+ SdpResource.instance = new SdpResource();
15269
+ }
15270
+ return SdpResource.instance;
15271
+ }
15272
+ /**
15273
+ * 它将资源添加到流中。
15274
+ * @param {string} streamId - 流的 ID。
15275
+ * @param {resource} resource - 要推送到流的资源。
15276
+ * @returns 被推送到流中的资源。
15277
+ */
15278
+ push(streamId, resource) {
15279
+ this.__streams.set(streamId, resource);
15280
+ return resource;
15281
+ }
15282
+ /**
15283
+ * 它返回与给定 streamId 关联的资源
15284
+ * @param {string} streamId - 您要提取的流的 streamId。
15285
+ * @returns 与 streamId 关联的资源对象。
15286
+ */
15287
+ pickup(streamId) {
15288
+ return this.__streams.get(streamId);
15289
+ }
15290
+ /**
15291
+ * 它从流映射中删除流。
15292
+ * @param {string} streamId - 要删除的流的 ID。
15293
+ * @returns 一个布尔值,指示 streamId 是否已成功删除。
15294
+ */
15295
+ delete(streamId) {
15296
+ return this.__streams.delete(streamId);
15297
+ }
15298
+ /**
15299
+ * 它返回房间中所有流的地图。
15300
+ * @returns 房间内所有溪流的地图。
15301
+ */
15302
+ get streams() {
15303
+ const streams = new Map();
15304
+ for (const streamId of this.__streams.keys()) {
15305
+ streams.set(streamId, this.pickup(streamId));
15306
+ }
15307
+ return streams;
15308
+ }
15309
+ }
15310
+
15253
15311
  class AbstractStatParser {
15254
15312
  constructor(_rtcPeerConn, _sdpSemantics, _currentUserId) {
15255
15313
  this._rtcPeerConn = _rtcPeerConn;
@@ -15409,8 +15467,15 @@ class AbstractStatParser {
15409
15467
  }
15410
15468
  parseRTCStatsReport(reports) {
15411
15469
  const stats = {};
15470
+ let flag = 0;
15471
+ for (let name of reports.keys()) {
15472
+ if (/RTCInbound/.test(name)) {
15473
+ flag++;
15474
+ }
15475
+ }
15412
15476
  for (const key of reports.keys()) {
15413
- if (!key.includes('RTCCodec_')) {
15477
+ // 过滤下行数据上报
15478
+ if (!key.includes('RTCCodec_') && !(flag > 9 && key.includes('RTCInbound'))) {
15414
15479
  stats[key] = reports.get(key);
15415
15480
  }
15416
15481
  }
@@ -15524,6 +15589,7 @@ class RTCReportParser$2 extends AbstractStatParser {
15524
15589
  // 解析上行媒体流数据: RTCOutboundRTPVideoStream | RTCOutboundRTPAudioStream
15525
15590
  const outboundKeys = keys.filter((key) => /^RTCOutboundRTP(Video|Audio)Stream_/.test(key));
15526
15591
  outboundKeys.forEach((key) => {
15592
+ var _a;
15527
15593
  // 本端输出数据
15528
15594
  const outboundInfo = stats[key];
15529
15595
  if (this._sdpSemantics === 'unified-plan' && !this.isValidSender(outboundInfo)) {
@@ -15554,7 +15620,21 @@ class RTCReportParser$2 extends AbstractStatParser {
15554
15620
  packetsLost = remoteStreamInfo.packetsLost;
15555
15621
  }
15556
15622
  totalPacketsLost += packetsLost;
15557
- const resourceId = this.getResourceIdByParseSdp(outboundInfo);
15623
+ const SingleInstance = SdpResource.getInstance();
15624
+ const resourceIds = SingleInstance.streams;
15625
+ let resourceId = '';
15626
+ for (const streamId of resourceIds.keys()) {
15627
+ const value = resourceIds.get(streamId);
15628
+ if (value) {
15629
+ const tracks = (_a = stats[`RTCMediaStream_${value.msid}`]) === null || _a === void 0 ? void 0 : _a.trackIds;
15630
+ if (tracks && tracks.includes(outboundInfo.trackId) && kind === value.kind) {
15631
+ resourceId = streamId;
15632
+ }
15633
+ }
15634
+ }
15635
+ if (!resourceId) {
15636
+ resourceId = this.getResourceIdByParseSdp(outboundInfo);
15637
+ }
15558
15638
  if (!resourceId) {
15559
15639
  return;
15560
15640
  }
@@ -15708,15 +15788,27 @@ class RTCReportParser$2 extends AbstractStatParser {
15708
15788
  // 解析上行媒体流数据: RTCOutboundRTPVideoStream | RTCOutboundRTPAudioStream
15709
15789
  const outboundKeys = keys.filter((key) => /^RTCOutboundRTPAudioStream_/.test(key));
15710
15790
  outboundKeys.forEach((key) => {
15711
- var _a;
15791
+ var _a, _b;
15712
15792
  // 本端输出数据
15713
15793
  const outboundInfo = stats[key];
15714
15794
  if (this._sdpSemantics === 'unified-plan' && !this.isValidSender(outboundInfo)) {
15715
15795
  return;
15716
15796
  }
15717
- const { mediaSourceId, trackId } = outboundInfo;
15718
- const resourceId = this.getResourceIdByParseSdp(outboundInfo);
15719
- const audioLevel = mediaSourceId && stats[mediaSourceId] ? stats[mediaSourceId].audioLevel : (((_a = stats[trackId]) === null || _a === void 0 ? void 0 : _a.audioLevel) || null);
15797
+ const { mediaSourceId, trackId, kind } = outboundInfo;
15798
+ const SingleInstance = SdpResource.getInstance();
15799
+ const resourceIds = SingleInstance.streams;
15800
+ let resourceId = '';
15801
+ for (const streamId of resourceIds.keys()) {
15802
+ const value = resourceIds.get(streamId);
15803
+ if (value) {
15804
+ const tracks = (_a = stats[`RTCMediaStream_${value.msid}`]) === null || _a === void 0 ? void 0 : _a.trackIds;
15805
+ if (tracks && tracks.includes(outboundInfo.trackId) && kind === value.kind) {
15806
+ resourceId = streamId;
15807
+ }
15808
+ }
15809
+ }
15810
+ // const resourceId = this.getResourceIdByParseSdp(outboundInfo);
15811
+ const audioLevel = mediaSourceId && stats[mediaSourceId] ? stats[mediaSourceId].audioLevel : (((_b = stats[trackId]) === null || _b === void 0 ? void 0 : _b.audioLevel) || null);
15720
15812
  audioLevelList.push({
15721
15813
  trackId: resourceId,
15722
15814
  audioLevel: (audioLevel || audioLevel === 0) ? handleAudioLevel(audioLevel) : null,
@@ -16897,6 +16989,7 @@ class UnifiedPlanStrategy extends ASdpStrategy {
16897
16989
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`');
16898
16990
  }
16899
16991
  addLocalTrack(track) {
16992
+ var _a;
16900
16993
  const trackId = track.getTrackId();
16901
16994
  const msid = track.getStreamId();
16902
16995
  const msTrack = track.__innerGetMediaStreamTrack();
@@ -16916,6 +17009,8 @@ class UnifiedPlanStrategy extends ASdpStrategy {
16916
17009
  else {
16917
17010
  this._sendTransceiver[trackId] = this._peer.addTransceiver(msTrack, { direction: 'sendonly', streams: [stream] });
16918
17011
  }
17012
+ const SingleInstance = SdpResource.getInstance();
17013
+ SingleInstance.push(trackId, { msid, id: this._outboundStreams[msid].id, kind: (_a = track.streamTrack) === null || _a === void 0 ? void 0 : _a.kind });
16919
17014
  }
16920
17015
  removeLocalTrack(track) {
16921
17016
  const trackId = track.getTrackId();
@@ -16935,6 +17030,9 @@ class UnifiedPlanStrategy extends ASdpStrategy {
16935
17030
  const stream = this._outboundStreams[msid];
16936
17031
  const msTracks = track.isAudioTrack() ? stream.getAudioTracks() : stream.getVideoTracks();
16937
17032
  msTracks.forEach((item) => stream.removeTrack(item));
17033
+ // TODO: 删除已经取消的流
17034
+ // const SingleInstance = SdpResource.getInstance();
17035
+ // SingleInstance.shift(trackId);
16938
17036
  // 尝试移除小流并销毁
16939
17037
  const tinyTransceiver = this._sendTransceiver[`${trackId}_tiny`];
16940
17038
  if (!tinyTransceiver || (tinyTransceiver.direction === 'inactive')) {
@@ -17012,6 +17110,8 @@ class UnifiedPlanStrategy extends ASdpStrategy {
17012
17110
  createOffer(iceRestart) {
17013
17111
  var _a;
17014
17112
  return __awaiter(this, void 0, void 0, function* () {
17113
+ const SingleInstance = SdpResource.getInstance();
17114
+ console.log('SingleInstance', SingleInstance);
17015
17115
  const offer = yield this._peer.createOffer({ iceRestart });
17016
17116
  let sdp = offer.sdp;
17017
17117
  for (const msid in this._outboundStreams) {
@@ -17168,6 +17268,14 @@ var ICEConnectionState;
17168
17268
  ICEConnectionState[ICEConnectionState["closed"] = 6] = "closed";
17169
17269
  })(ICEConnectionState || (ICEConnectionState = {}));
17170
17270
 
17271
+ /* 视频编译器的枚举。 */
17272
+ var RCEncoder;
17273
+ (function (RCEncoder) {
17274
+ RCEncoder["VP8"] = "VP8";
17275
+ RCEncoder["VP9"] = "VP9";
17276
+ RCEncoder["H264"] = "H264";
17277
+ })(RCEncoder || (RCEncoder = {}));
17278
+
17171
17279
  /**
17172
17280
  * PC 实例管理类
17173
17281
  */
@@ -17188,12 +17296,13 @@ class RCRTCPeerConnection extends EventEmitter {
17188
17296
  /**
17189
17297
  * 北极星上传实例
17190
17298
  */
17191
- _polarisReport) {
17299
+ _polarisReport, onTrackTrouble) {
17192
17300
  super();
17193
17301
  this._pcName = _pcName;
17194
17302
  this._reTryExchange = _reTryExchange;
17195
17303
  this._currentUserId = _currentUserId;
17196
17304
  this._polarisReport = _polarisReport;
17305
+ this.onTrackTrouble = onTrackTrouble;
17197
17306
  this.pubLocalTracks = {};
17198
17307
  this._reTryExchangeTimer = null;
17199
17308
  // peerConnection stats 计时器
@@ -17208,6 +17317,10 @@ class RCRTCPeerConnection extends EventEmitter {
17208
17317
  // 日志上传实例
17209
17318
  this._logger = null;
17210
17319
  this._reportListener = null;
17320
+ /**
17321
+ * 视频不可使用的收集器
17322
+ */
17323
+ this.troubleTracksCollection = new Map();
17211
17324
  const sdpSemantics = ASdpStrategy.getSdpSemantics();
17212
17325
  const peer = this._rtcPeerConn = new RTCPeerConnection({ sdpSemantics });
17213
17326
  this._sdpStrategy = sdpSemantics === 'plan-b' ? new PlanBStrategy(peer) : new UnifiedPlanStrategy(peer);
@@ -17665,6 +17778,16 @@ class RCRTCPeerConnection extends EventEmitter {
17665
17778
  * 组装北极星上报 R3、R4 数据并发送
17666
17779
  */
17667
17780
  const res = yield ((_a = this._polarisReport) === null || _a === void 0 ? void 0 : _a.sendR3R4Data(formatData));
17781
+ if (formatData.senders.length > 0) {
17782
+ formatData.senders.forEach((item) => {
17783
+ const { encoderImplementation, frameRate, frameWidth, frameHeight, } = item;
17784
+ let flag = 0;
17785
+ if ((encoderImplementation === null || encoderImplementation === void 0 ? void 0 : encoderImplementation.toLowerCase()) === 'unknown' || !frameRate || !frameWidth || !frameHeight) {
17786
+ flag = 1;
17787
+ }
17788
+ this.setTroubleTrack(item.trackId, flag);
17789
+ });
17790
+ }
17668
17791
  return res;
17669
17792
  }
17670
17793
  });
@@ -17684,6 +17807,49 @@ class RCRTCPeerConnection extends EventEmitter {
17684
17807
  getRTCPeerConn() {
17685
17808
  return this._rtcPeerConn;
17686
17809
  }
17810
+ /**
17811
+ * 它返回一个 RTCRtpCodecCapability 对象数组,第一个元素是与传入的编码器类型匹配的元素
17812
+ * @param {RCEncoder} encoder - RCEncoder.H264
17813
+ * @returns 正在返回 RTCRtpCodecCapability[] 数组。
17814
+ */
17815
+ getCapabilitiesCodes(encoder = RCEncoder.H264) {
17816
+ var _a;
17817
+ let capCodes = (_a = RTCRtpSender.getCapabilities('video')) === null || _a === void 0 ? void 0 : _a.codecs;
17818
+ let cap = null;
17819
+ switch (encoder) {
17820
+ case RCEncoder.VP8:
17821
+ case RCEncoder.VP9:
17822
+ cap = capCodes.find((item) => item.mimeType.match(encoder));
17823
+ break;
17824
+ case RCEncoder.H264:
17825
+ cap = capCodes.find((item) => { var _a; return item.mimeType.match(encoder) && ((_a = item.sdpFmtpLine) === null || _a === void 0 ? void 0 : _a.match('42e01f')); });
17826
+ break;
17827
+ }
17828
+ capCodes = capCodes.filter((item) => item !== cap);
17829
+ capCodes = [cap, ...capCodes];
17830
+ return capCodes;
17831
+ }
17832
+ /**
17833
+ * 它为视频流设置编码器首选项。
17834
+ * @param {RCEncoder} [encoder] - RC编码器
17835
+ */
17836
+ setEncoderPreferences(encoder) {
17837
+ var _a;
17838
+ return __awaiter(this, void 0, void 0, function* () {
17839
+ const pc = this.getRTCPeerConn();
17840
+ const codecCap = this.getCapabilitiesCodes(encoder);
17841
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_SET_ENCODER_PREFERENCES_S, JSON.stringify({
17842
+ status: RCLoggerStatus.SUCCESSED,
17843
+ codecCap,
17844
+ }));
17845
+ pc.getTransceivers().forEach((t) => {
17846
+ var _a;
17847
+ if (((_a = t.sender.track) === null || _a === void 0 ? void 0 : _a.kind) !== 'video')
17848
+ return;
17849
+ t.setCodecPreferences(codecCap);
17850
+ });
17851
+ });
17852
+ }
17687
17853
  destroy() {
17688
17854
  var _a;
17689
17855
  this.clear();
@@ -17708,6 +17874,25 @@ class RCRTCPeerConnection extends EventEmitter {
17708
17874
  isDestroyed() {
17709
17875
  return this._isDestroyed;
17710
17876
  }
17877
+ setTroubleTrack(track, count = 0) {
17878
+ const flag = 5;
17879
+ let counter = this.troubleTracksCollection.get(track);
17880
+ if (count === 0 || !counter) {
17881
+ this.troubleTracksCollection.set(track, 0);
17882
+ return;
17883
+ }
17884
+ this.troubleTracksCollection.set(track, counter + 1);
17885
+ if (counter + 1 > flag && this.onTrackTrouble) {
17886
+ let tracks = [];
17887
+ for (const trackId of this.troubleTracksCollection.keys()) {
17888
+ const counter = this.troubleTracksCollection.get(trackId);
17889
+ if (counter && counter > flag && this.pubLocalTracks[trackId]) {
17890
+ tracks.push(this.pubLocalTracks[trackId]);
17891
+ }
17892
+ }
17893
+ tracks.length > 0 && this.onTrackTrouble(tracks);
17894
+ }
17895
+ }
17711
17896
  }
17712
17897
  RCRTCPeerConnection.__INNER_EVENT_TRACK_READY__ = 'inner-track-ready';
17713
17898
 
@@ -17779,8 +17964,10 @@ class PolarisReporter {
17779
17964
  if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
17780
17965
  return RCSendCode.NOT_REPORT;
17781
17966
  }
17967
+ console.log('回落 CMP 通道');
17782
17968
  const rCSendCode = yield this._context.setRTCState(this._roomId, report);
17783
17969
  if (rCSendCode === ErrorCode.SUCCESS) {
17970
+ console.log('CMP 通道发送成功');
17784
17971
  return RCSendCode.REPORT_SUCCESS;
17785
17972
  }
17786
17973
  return RCSendCode.REPORT_FAIL;
@@ -17912,11 +18099,13 @@ class PolarisReporter {
17912
18099
  r3 += R3TrackData.map((item) => `${item.trackId}\t${item.googCodecName}\t${item.audioLevel}\t${item.samplingRate}\t${item.bitrate}\t${item.packetsLostRate}\t${item.frameRate}\t${item.resolution}\t${item.googRenderDelayMs}\t${item.jitter}\t${item.nackCount}\t${item.pliCount}\t${item.rtt}\t${item.googFirsSent}\t${item.encoderImplementation}\t${item.trackState}`).join('\n');
17913
18100
  if (data.senders.length) {
17914
18101
  senderCode = yield this._send(`${r3}\r${this._userRole}`);
18102
+ console.log('回落R3发送成功 ->', `${r3}\r${this._userRole}`);
17915
18103
  }
17916
18104
  let receiverCode = RCSendCode.REPORT_FAIL;
17917
18105
  r4 += R4TrackData.map((item) => `${item.trackId}\t${item.googCodecName}\t${item.audioLevel}\t${item.samplingRate}\t${item.bitrate}\t${item.packetsLostRate}\t${item.frameRate}\t${item.resolution}\t${item.googRenderDelayMs}\t${item.jitter}\t${item.nackCount}\t${item.pliCount}\t${item.rtt}\t${item.googFirsReceived}\t${item.codecImplementationName}\t${item.trackState}`).join('\n');
17918
18106
  if (data.receivers.length) {
17919
18107
  receiverCode = yield this._send(`${r4}\r${this._userRole}`);
18108
+ console.log('回落R4发送成功 ->', `${r4}\r${this._userRole}`);
17920
18109
  }
17921
18110
  if (senderCode !== RCSendCode.REPORT_SUCCESS && receiverCode !== RCSendCode.REPORT_SUCCESS) {
17922
18111
  return RCSendCode.REPORT_FAIL;
@@ -17928,7 +18117,7 @@ class PolarisReporter {
17928
18117
  * 加入房间
17929
18118
  */
17930
18119
  sendR1() {
17931
- const rtcVersion = "5.5.5-beem-alpha.1";
18120
+ const rtcVersion = "5.5.5-beem-alpha.2";
17932
18121
  const imVersion = this._context.getCoreVersion();
17933
18122
  const platform = 'web';
17934
18123
  const pcName = navigator.platform;
@@ -17938,6 +18127,7 @@ class PolarisReporter {
17938
18127
  const deviceId = this._getClientID();
17939
18128
  const r1 = `R1\t${rtcVersion}\t${imVersion}\t${platform}\t${pcName}\t${pcVersion}\t${browserName}\t${browserVersion}\t${deviceId}\t${this._userRole}`;
17940
18129
  this._send(r1);
18130
+ console.log('回落R1发送成功 ->', r1);
17941
18131
  }
17942
18132
  /**
17943
18133
  * RTC 和 LIVE 发布、取消发布
@@ -17947,6 +18137,7 @@ class PolarisReporter {
17947
18137
  const deviceId = this._getClientID();
17948
18138
  const r2 = `R2\t${action}\t${status}\t${deviceId}\r${trackIds.join('\t')}\r${this._userRole}`;
17949
18139
  this._send(r2);
18140
+ console.log('回落R2发送成功 ->', r2);
17950
18141
  }
17951
18142
  }
17952
18143
 
@@ -17977,10 +18168,12 @@ class PolarisHttpReporter {
17977
18168
  }
17978
18169
  const code = yield this._context.setRTCStateByHttp(logServer, this._runtime, report, reportType);
17979
18170
  if (code === RCSendCode.REPORT_SUCCESS) {
18171
+ console.log('http 通道发送成功');
17980
18172
  return RCSendCode.REPORT_SUCCESS;
17981
18173
  }
17982
18174
  // jwt 失效,重新请求 naviInfo
17983
18175
  if (code === RCRTCCode.JWT_TIME_OUT) {
18176
+ console.log('jwt 失效');
17984
18177
  this._refetchNaviInfo();
17985
18178
  return RCSendCode.REPORT_FAIL;
17986
18179
  }
@@ -18073,7 +18266,7 @@ class PolarisHttpReporter {
18073
18266
  _formatR1Data() {
18074
18267
  return {
18075
18268
  joinTime: this._context.userJoinTime || 0,
18076
- rtcVersion: "5.5.5-beem-alpha.1",
18269
+ rtcVersion: "5.5.5-beem-alpha.2",
18077
18270
  imVersion: this._context.getCoreVersion(),
18078
18271
  platform: 'web',
18079
18272
  device: navigator.platform,
@@ -18176,6 +18369,7 @@ class PolarisHttpReporter {
18176
18369
  let senderCode = RCSendCode.REPORT_FAIL;
18177
18370
  if (data.senders.length) {
18178
18371
  const r3Info = this._formatReportData(RCReportType.R3, data);
18372
+ console.log('发送r3Info ->', r3Info);
18179
18373
  senderCode = yield this._send(r3Info, RCReportType.R3);
18180
18374
  // 回落 R3
18181
18375
  if (senderCode === RCSendCode.REPORT_FAIL) {
@@ -18185,6 +18379,7 @@ class PolarisHttpReporter {
18185
18379
  let receiverCode = RCSendCode.REPORT_FAIL;
18186
18380
  if (data.receivers.length) {
18187
18381
  const r4Info = this._formatReportData(RCReportType.R4, data);
18382
+ console.log('发送r4Info ->', r4Info);
18188
18383
  receiverCode = yield this._send(r4Info, RCReportType.R4);
18189
18384
  // 回落 R4
18190
18385
  if (receiverCode === RCSendCode.REPORT_FAIL) {
@@ -18204,6 +18399,7 @@ class PolarisHttpReporter {
18204
18399
  var _a;
18205
18400
  return __awaiter(this, void 0, void 0, function* () {
18206
18401
  const r1Info = this._formatReportData(RCReportType.R1);
18402
+ console.log('发送r1Info ->', r1Info);
18207
18403
  const sendCode = yield this._send(r1Info, RCReportType.R1);
18208
18404
  // 回落 R1
18209
18405
  if (sendCode === RCSendCode.REPORT_FAIL) {
@@ -18219,6 +18415,7 @@ class PolarisHttpReporter {
18219
18415
  var _a;
18220
18416
  return __awaiter(this, void 0, void 0, function* () {
18221
18417
  const r2Info = this._formatReportData(RCReportType.R2, { action, status, trackIds });
18418
+ console.log('发送r2Info ->', r2Info);
18222
18419
  const sendCode = yield this._send(r2Info, RCReportType.R2);
18223
18420
  // 回落 R2
18224
18421
  if (sendCode === RCSendCode.REPORT_FAIL) {
@@ -18404,7 +18601,7 @@ class RCRTCPeerCManager {
18404
18601
  * 创建一个新 peerC
18405
18602
  */
18406
18603
  const isPub = this._isPub(tracks);
18407
- const newPeerC = new RCRTCPeerConnection(pcName, () => this._reTryExchange(pcName, isPub), this._currentUserId, this._polarisReport);
18604
+ const newPeerC = new RCRTCPeerConnection(pcName, () => this._reTryExchange(pcName, isPub), this._currentUserId, this._polarisReport, this.onTrackTrouble);
18408
18605
  this._mutilPeerC[pcName] = {
18409
18606
  pc: newPeerC,
18410
18607
  tracks,
@@ -22435,6 +22632,9 @@ class RCAbstractRoom extends EventEmitter {
22435
22632
  listener: listener && Object.keys(listener),
22436
22633
  }));
22437
22634
  this._appListener = listener;
22635
+ if ((listener === null || listener === void 0 ? void 0 : listener.onTrackTrouble) && this._peerCManager) {
22636
+ this._peerCManager.onTrackTrouble = listener === null || listener === void 0 ? void 0 : listener.onTrackTrouble.bind(this);
22637
+ }
22438
22638
  }
22439
22639
  /**
22440
22640
  * 注册房间数据监控
@@ -27603,7 +27803,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27603
27803
  }
27604
27804
  reportSDKInfo() {
27605
27805
  this._context.reportSDKInfo({
27606
- 'plugin-rtc': "5.5.5-beem-alpha.1",
27806
+ 'plugin-rtc': "5.5.5-beem-alpha.2",
27607
27807
  });
27608
27808
  }
27609
27809
  }
@@ -28594,9 +28794,9 @@ const installer = {
28594
28794
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28595
28795
  return false;
28596
28796
  }
28597
- VersionManage.add('plugin-rtc', "5.5.5-beem-alpha.1");
28598
- if (!VersionManage.validEngine("^5.6.0-beem-alpha.6")) {
28599
- console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0-beem-alpha.6"}'.`);
28797
+ VersionManage.add('plugin-rtc', "5.5.5-beem-alpha.2");
28798
+ if (!VersionManage.validEngine("^5.6.0-beem-alpha.5")) {
28799
+ console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0-beem-alpha.5"}'.`);
28600
28800
  return false;
28601
28801
  }
28602
28802
  return true;
@@ -28607,8 +28807,8 @@ const installer = {
28607
28807
  logger.setOutputLevel(options.logLevel || LogL.DEBUG);
28608
28808
  RTCLogger.setLogger(logger);
28609
28809
  logger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28610
- 'RCRTC Version': "5.5.5-beem-alpha.1",
28611
- Commit: "4807d9272db7b224e762a75df11762453a730f9e",
28810
+ 'RCRTC Version': "5.5.5-beem-alpha.2",
28811
+ Commit: "53292a559174278ff032c3811be232015e47f007",
28612
28812
  'browserInfo.browser': browserInfo.browser,
28613
28813
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28614
28814
  'browserInfo.version': browserInfo.version,