@rongcloud/plugin-rtc 5.6.8-enterprise.1 → 5.6.9-enterprise.1

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,10 +1,10 @@
1
1
  /*
2
- * RCRTC - v5.6.8-enterprise.1
3
- * CommitId - 34e11acac78e5f1e18596830b8c0796659fb015a
4
- * Fri Jan 06 2023 15:47:48 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.9-enterprise.1
3
+ * CommitId - d8e8805bcf8f7e6302273f3fee5efba569e78d73
4
+ * Mon Feb 13 2023 19:00:46 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
- import { EventEmitter, BasicLogger, INaviInfo, RTCPluginContext, AbsCodec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, ConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, EnableLogL, IPluginGenerator } from '@rongcloud/engine';
7
+ import { EventEmitter, BasicLogger, INaviInfo, RTCPluginContext, AbsCodec, IPromiseResult, ErrorCode, KVString, IRuntime, IAsyncRes, RCConnectionStatus, ConversationType, ISendMsgOptions, IReceivedMessage, EnableLogL, IPluginGenerator } from '@rongcloud/engine';
8
8
 
9
9
  /**
10
10
  * 错误码,与移动端对齐
@@ -98,7 +98,9 @@ declare enum RCRTCCode {
98
98
  /** 获取媒体资源时,无系统权限 */
99
99
  SYSTEM_PERMISSION_DENIED = 53033,
100
100
  /** 发布时无有效资源,如 track 已被销毁 */
101
- PUBLISH_TRACKS_IS_INVALID = 53034
101
+ PUBLISH_TRACKS_IS_INVALID = 53034,
102
+ /** 流状态为 ended */
103
+ TRACK_READYSTATE_IS_ENDED = 53035
102
104
  }
103
105
 
104
106
  /**
@@ -1526,7 +1528,7 @@ declare class RTCContext {
1526
1528
  };
1527
1529
  getCurrentId(): string;
1528
1530
  getNaviInfo(): IRTCNaviInfo | null;
1529
- getConnectionStatus(): ConnectionStatus;
1531
+ getConnectionStatus(): RCConnectionStatus;
1530
1532
  getAppkey(): string;
1531
1533
  /** web 端发 rtcPing */
1532
1534
  webRtcPing(roomId: string, roomMode: RTCMode, broadcastType?: number): Promise<{
@@ -1547,7 +1549,7 @@ declare class RTCContext {
1547
1549
  }> | Promise<IAsyncRes<any>>;
1548
1550
  sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions): IPromiseResult<IReceivedMessage>;
1549
1551
  registerRTCSignalListener(listener?: ((buffer: Uint8Array) => void) | undefined): void;
1550
- registerConnectionStateChangeListener(listener: (status: ConnectionStatus) => void): void;
1552
+ registerConnectionStateChangeListener(listener: (status: RCConnectionStatus) => void): void;
1551
1553
  registerDisconnectListener(listener: () => void): void;
1552
1554
  registerDestroyListener(listener: () => void): void;
1553
1555
  registerMessageListener(listener: (message: IReceivedMessage) => boolean): void;
@@ -4024,7 +4026,8 @@ interface IRCRTCInitOptions {
4024
4026
  */
4025
4027
  pingGap?: number;
4026
4028
  /**
4027
- * 优化使用的 SDP 协议版本,仅当运行时浏览器支持相应 SDP 协议版本时生效
4029
+ * 目前该参数仅在 Chrome 浏览器 72 - 92 之间版本有效,其他浏览器或版本将优先尝试使用 `unified-plan`,
4030
+ * 在不支持 `unified-plan` 的情况下使用 `plan-b` 协议。
4028
4031
  */
4029
4032
  sdpSemantics?: ISdpSemantics;
4030
4033
  /**
@@ -4466,6 +4469,13 @@ declare class RCMCUConfigBuilder {
4466
4469
  clearCustomizeInputAudio(): RCMCUConfigBuilder;
4467
4470
  /**
4468
4471
  * 给单道流添加水印
4472
+ * @param trackId 资源 Id
4473
+ * @param uri 水印图片的地址,需注意图片需要是 png 格式
4474
+ * @param x 相对于整体画布的起始位置 x 坐标(百分比),有效值 `0.0` - `1.0`
4475
+ * @param y 相对于整体画布的起始位置 y 坐标(百分比),有效值 `0.0` - `1.0`
4476
+ * @param width 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
4477
+ * @param height 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
4478
+ * @description 注意,参数中 x + width 不得大于 1,y + height 不得大于 1,否则调用 flush() 时会提示 46020 错误
4469
4479
  */
4470
4480
  addPictureWaterMark(trackId: string, uri: string, x: number, y: number, w: number, h: number): RCMCUConfigBuilder;
4471
4481
  /**
@@ -5040,4 +5050,4 @@ declare const helper: {
5040
5050
  ifSupportScreenShare: typeof ifSupportScreenShare;
5041
5051
  };
5042
5052
 
5043
- export { BackgroundPictureFillMode, IAudienceRoomEventListener, ICameraVideoProfile, ILiveAudioState, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPubSuccessRes, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IReqResPKOptions, IRoomEventListener, IRoomPKEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCAudioBitrate, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaStreamCapture, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenAudioTrack, RCScreenVideoTrack, RCTag, RCTrack, RCVideoBitrate, RTCJoinType, device, helper, installer };
5053
+ export { BackgroundPictureFillMode, IAudienceRoomEventListener, ICameraVideoProfile, ICreateLocalTrackOptions, IJoinResCDNInfo, ILiveAudioState, IMCUOutputConfig, IMCUOutputVideoConfig, IMicphoneAudioProfile, IPKEndInfo, IPKInviteAnswerInfo, IPKInviteInfo, IPubSuccessRes, IPublishAttrs, IPublishedResource, IRCCandidatePairStat, IRCRTCInitOptions, IRCRTCReportListener, IRCRTCStateReport, IRCTrackStat, IRTCUserData, IReqResPKOptions, IRoomEventListener, IRoomPKEventListener, ISubscribeAttr, IVideoProfile, MixLayoutMode, MixVideoRenderMode, RCAbstractRoom, RCAudienceClient, RCAudienceLivingRoom, RCAudioBitrate, RCCameraVideoTrack, RCFrameRate, RCInnerCDNPullIsHttps, RCInnerCDNPullKind, RCKickReason, RCLivingRoom, RCLivingType, RCLocalAudioTrack, RCLocalFileAudioTrack, RCLocalFileTrack, RCLocalFileVideoTrack, RCLocalTrack, RCLocalVideoTrack, RCMCUConfigBuilder, RCMediaStreamCapture, RCMediaType, RCMicphoneAudioTrack, RCRTCClient, RCRTCCode, RCRTCLiveRole, RCRTCPingResult, RCRTCRoom, RCRemoteAudioTrack, RCRemoteTrack, RCRemoteVideoTrack, RCResolution, RCScreenAudioTrack, RCScreenVideoTrack, RCTag, RCTrack, RCVideoBitrate, RTCJoinType, device, helper, installer };
package/dist/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /*
2
- * RCRTC - v5.6.8-enterprise.1
3
- * CommitId - 34e11acac78e5f1e18596830b8c0796659fb015a
4
- * Fri Jan 06 2023 15:47:48 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.9-enterprise.1
3
+ * CommitId - d8e8805bcf8f7e6302273f3fee5efba569e78d73
4
+ * Mon Feb 13 2023 19:00:46 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
- import { 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';
7
+ import { EventEmitter, isNumber, validate, isObject as isObject$1, ErrorCode, HttpMethod, isArray, RCConnectionStatus, notEmptyObject, notEmptyArray, notEmptyString, isString, RTCMode as RTCMode$1, assert, ConversationType, isHttpUrl, isBoolean, isUndefined, forEach, VersionManage, LogL } from '@rongcloud/engine';
8
8
 
9
9
  /*! *****************************************************************************
10
10
  Copyright (c) Microsoft Corporation.
@@ -125,6 +125,8 @@ var RCRTCCode;
125
125
  RCRTCCode[RCRTCCode["SYSTEM_PERMISSION_DENIED"] = 53033] = "SYSTEM_PERMISSION_DENIED";
126
126
  /** 发布时无有效资源,如 track 已被销毁 */
127
127
  RCRTCCode[RCRTCCode["PUBLISH_TRACKS_IS_INVALID"] = 53034] = "PUBLISH_TRACKS_IS_INVALID";
128
+ /** 流状态为 ended */
129
+ RCRTCCode[RCRTCCode["TRACK_READYSTATE_IS_ENDED"] = 53035] = "TRACK_READYSTATE_IS_ENDED";
128
130
  })(RCRTCCode || (RCRTCCode = {}));
129
131
 
130
132
  var RCLoggerTag;
@@ -6875,6 +6877,7 @@ class RCTrack extends EventEmitter {
6875
6877
  kind: (_f = this._kind) !== null && _f !== void 0 ? _f : '',
6876
6878
  msg: `the track's readyState is ended -> id: ${this._id}`,
6877
6879
  }));
6880
+ return { code: RCRTCCode.TRACK_READYSTATE_IS_ENDED };
6878
6881
  }
6879
6882
  if (options === null || options === void 0 ? void 0 : options.volume) {
6880
6883
  if (!isNumber(options === null || options === void 0 ? void 0 : options.volume)) {
@@ -14864,12 +14867,16 @@ const getCommonHeader$1 = () => ({
14864
14867
  'Content-Type': 'application/json;charset=UTF-8',
14865
14868
  'Cache-Control': 'no-cache',
14866
14869
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14867
- ClientVersion: "5.6.8-enterprise.1",
14870
+ ClientVersion: "5.6.9-enterprise.1",
14868
14871
  'Client-Session-Id': getUUID(),
14869
14872
  'Request-Id': Date.now().toString(),
14870
14873
  });
14871
14874
  /**
14872
14875
  * 根据探测地址 list 发 ping 拿到返回最快的 Media 地址
14876
+ * 执行时机:RTC 初始化时
14877
+ * pingRes 使用时机:加房间时
14878
+ * 为不阻塞初始化代码执行,有一个 host 地址请求完就 resolve
14879
+ * 其他 host 地址后续继续排序进入 pingRes 数组(引用类型保证使用时为更新后的 host 列表)
14873
14880
  * @param hosts 探测地址 list
14874
14881
  * @param runtime
14875
14882
  * @returns
@@ -14877,26 +14884,25 @@ const getCommonHeader$1 = () => ({
14877
14884
  const getFastMediaUrl = (hosts, runtime, jwt) => __awaiter(void 0, void 0, void 0, function* () {
14878
14885
  // 根据 /ping 的响应速度对 hosts 进行排序响应速度排序
14879
14886
  const pingRes = [];
14880
- yield Promise.any(hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14881
- const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14882
- const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14883
- // 临时测试测试使用
14884
- // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14885
- const body = { jwt };
14886
- const res = yield runtime.httpReq({
14887
- url,
14888
- body: JSON.stringify(body),
14889
- timeout: PING_REQ_TIMEOUT,
14890
- method: HttpMethod.POST,
14891
- });
14892
- if (res.status === 200) {
14893
- pingRes.push(host.clusterId);
14894
- }
14895
- else {
14896
- return Promise.reject();
14897
- }
14898
- })));
14899
- return pingRes;
14887
+ return new Promise((resolve, reject) => {
14888
+ hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14889
+ const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14890
+ const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14891
+ // 临时测试测试使用
14892
+ // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14893
+ const body = { jwt };
14894
+ const res = yield runtime.httpReq({
14895
+ url,
14896
+ body: JSON.stringify(body),
14897
+ timeout: PING_REQ_TIMEOUT,
14898
+ method: HttpMethod.POST,
14899
+ });
14900
+ if (res.status === 200) {
14901
+ pingRes.push(host.clusterId);
14902
+ }
14903
+ resolve(pingRes);
14904
+ }));
14905
+ });
14900
14906
  });
14901
14907
  /**
14902
14908
  * @param info navi 信息
@@ -14987,7 +14993,7 @@ const getCommonHeader = () => ({
14987
14993
  'Content-Type': 'application/json;charset=UTF-8',
14988
14994
  'Cache-Control': 'no-cache',
14989
14995
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14990
- ClientVersion: "5.6.8-enterprise.1",
14996
+ ClientVersion: "5.6.9-enterprise.1",
14991
14997
  'Client-Session-Id': getUUID(),
14992
14998
  'Request-Id': Date.now().toString(),
14993
14999
  });
@@ -15028,7 +15034,7 @@ class RCMediaService {
15028
15034
  this._msList = [];
15029
15035
  this._qualityMsList = [];
15030
15036
  // 初始化时判断当前 IM 是否已经处于链接状态,已连接切没有执行过嗅探或嗅探结果无效,主动触发一次嗅探逻辑
15031
- if (!RCMediaService.isDetector && _context.getConnectionStatus() === ConnectionStatus.CONNECTED) {
15037
+ if (!RCMediaService.isDetector && _context.getConnectionStatus() === RCConnectionStatus.CONNECTED) {
15032
15038
  this.detectorMediaSever();
15033
15039
  }
15034
15040
  }
@@ -15258,7 +15264,7 @@ class RCMediaService {
15258
15264
  * 直播推流、自定义布局配置
15259
15265
  */
15260
15266
  setMcuConfig(headers, body) {
15261
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15267
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15262
15268
  return __awaiter(this, void 0, void 0, function* () {
15263
15269
  const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
15264
15270
  (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_T, JSON.stringify({
@@ -15286,13 +15292,22 @@ class RCMediaService {
15286
15292
  });
15287
15293
  if (status === 200) {
15288
15294
  const data = JSON.parse(jsonStr);
15289
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15290
- status: RCLoggerStatus.SUCCESSED,
15291
- 'Request-Id': reqId,
15292
- }), traceId);
15293
- return { code: data.resultCode, res: data };
15295
+ const code = data.resultCode;
15296
+ if (code === RCRTCCode.SUCCESS) {
15297
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15298
+ status: RCLoggerStatus.SUCCESSED,
15299
+ 'Request-Id': reqId,
15300
+ }), traceId);
15301
+ }
15302
+ else {
15303
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.warn(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15304
+ code,
15305
+ 'Request-Id': reqId,
15306
+ }), traceId);
15307
+ }
15308
+ return { code, res: data };
15294
15309
  }
15295
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15310
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15296
15311
  status: RCLoggerStatus.FAILED,
15297
15312
  code: RCRTCCode.REQUEST_FAILED,
15298
15313
  msg: `request error -> Request-Id: ${reqId}, status: ${status}, url: ${url}`,
@@ -16733,7 +16748,15 @@ class ASdpStrategy {
16733
16748
  this._sdpSemantics = 'plan-b';
16734
16749
  return;
16735
16750
  }
16751
+ // 明确支持 unified-plan 的版本中,保留 chrome 浏览器 72-92 版本之间的调试能力
16736
16752
  if (/chrome/i.test(browser)) {
16753
+ /**
16754
+ * 浏览器模拟移动端时,version 为 null
16755
+ */
16756
+ if (!version) {
16757
+ this._sdpSemantics = 'unified-plan';
16758
+ return;
16759
+ }
16737
16760
  // chrome 72 - 92 之间的版本可以通过传参的方式定义使用的 SDP 协议版本以便于测试
16738
16761
  // this._sdpSemantics = version! > 92 ? 'unified-plan' : (version! < 72 ? 'plan-b' : sdpSemantics);
16739
16762
  if (version > 92) {
@@ -17866,7 +17889,7 @@ class RCRTCPeerConnection extends EventEmitter {
17866
17889
  * @todo
17867
17890
  */
17868
17891
  _reportHandle() {
17869
- var _a, _b, _c, _d;
17892
+ var _a, _b, _c, _d, _e, _f, _g;
17870
17893
  return __awaiter(this, void 0, void 0, function* () {
17871
17894
  const formatData = yield this._getStatsData();
17872
17895
  if (!formatData) {
@@ -17876,7 +17899,12 @@ class RCRTCPeerConnection extends EventEmitter {
17876
17899
  * 组装质量数据,给业务层上报
17877
17900
  */
17878
17901
  const reportData = this._createRCRTCStateReport(formatData);
17879
- (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17902
+ try {
17903
+ (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17904
+ }
17905
+ catch (error) {
17906
+ (_c = this._logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17907
+ }
17880
17908
  /**
17881
17909
  * 获取音量数据,给业务层上报
17882
17910
  */
@@ -17888,9 +17916,14 @@ class RCRTCPeerConnection extends EventEmitter {
17888
17916
  /**
17889
17917
  * 仅观众加房间上报合流音源信息
17890
17918
  */
17891
- if (this._isRoomAudience) {
17919
+ if (this._isRoomAudience && ((_d = this._reportListener) === null || _d === void 0 ? void 0 : _d.onReportLiveAudioStates)) {
17892
17920
  const audioStateList = this._getLiveAudioState();
17893
- audioStateList.length && ((_d = (_c = this._reportListener) === null || _c === void 0 ? void 0 : _c.onReportLiveAudioStates) === null || _d === void 0 ? void 0 : _d.call(_c, audioStateList));
17921
+ try {
17922
+ audioStateList.length && ((_f = (_e = this._reportListener) === null || _e === void 0 ? void 0 : _e.onReportLiveAudioStates) === null || _f === void 0 ? void 0 : _f.call(_e, audioStateList));
17923
+ }
17924
+ catch (error) {
17925
+ (_g = this._logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17926
+ }
17894
17927
  }
17895
17928
  });
17896
17929
  }
@@ -17907,6 +17940,9 @@ class RCRTCPeerConnection extends EventEmitter {
17907
17940
  var _a;
17908
17941
  const { source: ssrc, audioLevel } = audioState;
17909
17942
  const trackId = (_a = this._store) === null || _a === void 0 ? void 0 : _a.getTrackIdBySSRC(ssrc);
17943
+ if (!trackId) {
17944
+ return {};
17945
+ }
17910
17946
  const { userId } = parseTrackId(trackId);
17911
17947
  return {
17912
17948
  audioLevel: handleAudioLevel(audioLevel),
@@ -18128,7 +18164,7 @@ class PolarisReporter {
18128
18164
  }
18129
18165
  _send(report) {
18130
18166
  return __awaiter(this, void 0, void 0, function* () {
18131
- if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
18167
+ if (this._context.getConnectionStatus() !== RCConnectionStatus.CONNECTED) {
18132
18168
  return RCSendCode.NOT_REPORT;
18133
18169
  }
18134
18170
  const rCSendCode = yield this._context.setRTCState(this._roomId, report);
@@ -18280,7 +18316,7 @@ class PolarisReporter {
18280
18316
  * 加入房间
18281
18317
  */
18282
18318
  sendR1() {
18283
- const rtcVersion = "5.6.8-enterprise.1";
18319
+ const rtcVersion = "5.6.9-enterprise.1";
18284
18320
  const imVersion = this._context.getCoreVersion();
18285
18321
  const platform = 'web';
18286
18322
  const pcName = navigator.platform;
@@ -18320,7 +18356,7 @@ class PolarisHttpReporter {
18320
18356
  _send(report, reportType) {
18321
18357
  var _a, _b;
18322
18358
  return __awaiter(this, void 0, void 0, function* () {
18323
- if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
18359
+ if (this._context.getConnectionStatus() !== RCConnectionStatus.CONNECTED) {
18324
18360
  return RCSendCode.NOT_REPORT;
18325
18361
  }
18326
18362
  const { logServer } = PolarisHttpReporter;
@@ -18430,7 +18466,7 @@ class PolarisHttpReporter {
18430
18466
  _formatR1Data() {
18431
18467
  return {
18432
18468
  joinTime: this._context.userJoinTime || 0,
18433
- rtcVersion: "5.6.8-enterprise.1",
18469
+ rtcVersion: "5.6.9-enterprise.1",
18434
18470
  imVersion: this._context.getCoreVersion(),
18435
18471
  platform: 'web',
18436
18472
  device: navigator.platform,
@@ -19547,7 +19583,7 @@ class JoinRoomCommand extends BaseCommand {
19547
19583
  else if (this.roomType === RTCMode.CROSS_MUTI) {
19548
19584
  logTag = RCLoggerTag.L_RTC_CLIENT_JOIN_CROSS_RTC_ROOM_R;
19549
19585
  }
19550
- if (context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
19586
+ if (context.getConnectionStatus() !== RCConnectionStatus.CONNECTED) {
19551
19587
  (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(logTag, JSON.stringify({
19552
19588
  status: RCLoggerStatus.FAILED,
19553
19589
  code: RCRTCCode.SIGNAL_DISCONNECTED,
@@ -22712,7 +22748,7 @@ class RCAbstractRoom extends EventEmitter {
22712
22748
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22713
22749
  const { status, time, iceCandidatePair } = data;
22714
22750
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22715
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22751
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22716
22752
  });
22717
22753
  // 发送上下行数据至北极星
22718
22754
  pc.__reportR3R4ToPolaris();
@@ -22737,7 +22773,7 @@ class RCAbstractRoom extends EventEmitter {
22737
22773
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22738
22774
  const { status, time, iceCandidatePair } = data;
22739
22775
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22740
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22776
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22741
22777
  });
22742
22778
  pc.registerReportListener(this._reportListener);
22743
22779
  // 发送上下行数据至北极星
@@ -23766,6 +23802,13 @@ class RCMCUConfigBuilder {
23766
23802
  }
23767
23803
  /**
23768
23804
  * 给单道流添加水印
23805
+ * @param trackId 资源 Id
23806
+ * @param uri 水印图片的地址,需注意图片需要是 png 格式
23807
+ * @param x 相对于整体画布的起始位置 x 坐标(百分比),有效值 `0.0` - `1.0`
23808
+ * @param y 相对于整体画布的起始位置 y 坐标(百分比),有效值 `0.0` - `1.0`
23809
+ * @param width 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
23810
+ * @param height 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
23811
+ * @description 注意,参数中 x + width 不得大于 1,y + height 不得大于 1,否则调用 flush() 时会提示 46020 错误
23769
23812
  */
23770
23813
  addPictureWaterMark(trackId, uri, x, y, w, h) {
23771
23814
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -23781,7 +23824,7 @@ class RCMCUConfigBuilder {
23781
23824
  }));
23782
23825
  return this;
23783
23826
  }
23784
- if ([x, y, w, h].some((item) => !isNumber(item) || item < 0 || item > 1)) {
23827
+ if ([x, y, w, h].some((item) => !isNumber(item) || item < 0 || item > 1) || x + w > 1 || y + h > 1) {
23785
23828
  (_j = (_h = (_g = this._invoker.store) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23786
23829
  status: RCLoggerStatus.FAILED, msg: `some attrs of (x, y, w, h) is invalid -> x: ${x}, y: ${y}, w: ${w}, h: ${h}`,
23787
23830
  }));
@@ -23803,7 +23846,7 @@ class RCMCUConfigBuilder {
23803
23846
  }],
23804
23847
  });
23805
23848
  this._values.waterMark.singleScreen = singleScreen;
23806
- (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O, JSON.stringify({
23849
+ (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23807
23850
  status: RCLoggerStatus.SUCCESSED, trackId, uri, x, y, w, h, singleScreen,
23808
23851
  }));
23809
23852
  return this;
@@ -24536,7 +24579,7 @@ class RCLivingPKHandler {
24536
24579
  }), traceId);
24537
24580
  return { code: RCRTCCode.PARAMS_ERROR };
24538
24581
  }
24539
- if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
24582
+ if (this._context.getConnectionStatus() !== RCConnectionStatus.CONNECTED) {
24540
24583
  (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24541
24584
  status: RCLoggerStatus.FAILED,
24542
24585
  code: RCRTCCode.SIGNAL_DISCONNECTED,
@@ -25766,6 +25809,11 @@ class RCAudienceLivingRoom {
25766
25809
  const resId = getTrackId(item);
25767
25810
  const index = ids.indexOf(resId);
25768
25811
  const { userId, tag, mediaType } = parseTrackId(resId);
25812
+ /**
25813
+ * 设置房间 RTC 资源 ssrc 和 trackId map
25814
+ */
25815
+ const { ssrc } = JSON.parse(item.uri);
25816
+ this._store.setTrackIdSSRCMap(ssrc, resId);
25769
25817
  if (index > -1) {
25770
25818
  nowRes[index] = item;
25771
25819
  }
@@ -27308,7 +27356,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27308
27356
  this._audience = null;
27309
27357
  this._crtAudienceLivingRoom = null;
27310
27358
  // 用户不指定时,默认以 plan-b 优先选项
27311
- ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'plan-b');
27359
+ ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'unified-plan');
27312
27360
  this._service = new RCMediaService(this._runtime, this._context, this._options.mediaServer, this._options.timeout);
27313
27361
  // 监听 IM 连接状态变更
27314
27362
  this._context.registerConnectionStateChangeListener(this._onIMStatusChange.bind(this));
@@ -27524,7 +27572,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27524
27572
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RTC_CLIENT_IM_CONNECTION_STATE_S, JSON.stringify({
27525
27573
  status,
27526
27574
  }));
27527
- if (status !== ConnectionStatus.CONNECTED) {
27575
+ if (status !== RCConnectionStatus.CONNECTED) {
27528
27576
  return;
27529
27577
  }
27530
27578
  // 重连后执行探测逻辑
@@ -27849,7 +27897,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27849
27897
  }
27850
27898
  reportSDKInfo() {
27851
27899
  this._context.reportSDKInfo({
27852
- 'plugin-rtc': "5.6.8-enterprise.1",
27900
+ 'plugin-rtc': "5.6.9-enterprise.1",
27853
27901
  });
27854
27902
  }
27855
27903
  }
@@ -28838,9 +28886,9 @@ const installer = {
28838
28886
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28839
28887
  return false;
28840
28888
  }
28841
- VersionManage.add('plugin-rtc', "5.6.8-enterprise.1");
28842
- if (!VersionManage.validEngine(">=5.7.0-enterprise.2")) {
28843
- console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.0-enterprise.2"}'.`);
28889
+ VersionManage.add('plugin-rtc', "5.6.9-enterprise.1");
28890
+ if (!VersionManage.validEngine(">=5.7.2-enterprise.1")) {
28891
+ console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.2-enterprise.1"}'.`);
28844
28892
  return false;
28845
28893
  }
28846
28894
  return true;
@@ -28852,8 +28900,8 @@ const installer = {
28852
28900
  RTCLogger.setLogger(originLogger);
28853
28901
  logger.setLogger(originLogger);
28854
28902
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28855
- 'RCRTC Version': "5.6.8-enterprise.1",
28856
- Commit: "34e11acac78e5f1e18596830b8c0796659fb015a",
28903
+ 'RCRTC Version': "5.6.9-enterprise.1",
28904
+ Commit: "d8e8805bcf8f7e6302273f3fee5efba569e78d73",
28857
28905
  'browserInfo.browser': browserInfo.browser,
28858
28906
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28859
28907
  'browserInfo.version': browserInfo.version,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.6.8-enterprise.1
3
- * CommitId - 34e11acac78e5f1e18596830b8c0796659fb015a
4
- * Fri Jan 06 2023 15:47:48 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.9-enterprise.1
3
+ * CommitId - d8e8805bcf8f7e6302273f3fee5efba569e78d73
4
+ * Mon Feb 13 2023 19:00:46 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  'use strict';
@@ -129,6 +129,8 @@ exports.RCRTCCode = void 0;
129
129
  RCRTCCode[RCRTCCode["SYSTEM_PERMISSION_DENIED"] = 53033] = "SYSTEM_PERMISSION_DENIED";
130
130
  /** 发布时无有效资源,如 track 已被销毁 */
131
131
  RCRTCCode[RCRTCCode["PUBLISH_TRACKS_IS_INVALID"] = 53034] = "PUBLISH_TRACKS_IS_INVALID";
132
+ /** 流状态为 ended */
133
+ RCRTCCode[RCRTCCode["TRACK_READYSTATE_IS_ENDED"] = 53035] = "TRACK_READYSTATE_IS_ENDED";
132
134
  })(exports.RCRTCCode || (exports.RCRTCCode = {}));
133
135
 
134
136
  var RCLoggerTag;
@@ -6879,6 +6881,7 @@ class RCTrack extends engine.EventEmitter {
6879
6881
  kind: (_f = this._kind) !== null && _f !== void 0 ? _f : '',
6880
6882
  msg: `the track's readyState is ended -> id: ${this._id}`,
6881
6883
  }));
6884
+ return { code: exports.RCRTCCode.TRACK_READYSTATE_IS_ENDED };
6882
6885
  }
6883
6886
  if (options === null || options === void 0 ? void 0 : options.volume) {
6884
6887
  if (!engine.isNumber(options === null || options === void 0 ? void 0 : options.volume)) {
@@ -14868,12 +14871,16 @@ const getCommonHeader$1 = () => ({
14868
14871
  'Content-Type': 'application/json;charset=UTF-8',
14869
14872
  'Cache-Control': 'no-cache',
14870
14873
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14871
- ClientVersion: "5.6.8-enterprise.1",
14874
+ ClientVersion: "5.6.9-enterprise.1",
14872
14875
  'Client-Session-Id': getUUID(),
14873
14876
  'Request-Id': Date.now().toString(),
14874
14877
  });
14875
14878
  /**
14876
14879
  * 根据探测地址 list 发 ping 拿到返回最快的 Media 地址
14880
+ * 执行时机:RTC 初始化时
14881
+ * pingRes 使用时机:加房间时
14882
+ * 为不阻塞初始化代码执行,有一个 host 地址请求完就 resolve
14883
+ * 其他 host 地址后续继续排序进入 pingRes 数组(引用类型保证使用时为更新后的 host 列表)
14877
14884
  * @param hosts 探测地址 list
14878
14885
  * @param runtime
14879
14886
  * @returns
@@ -14881,26 +14888,25 @@ const getCommonHeader$1 = () => ({
14881
14888
  const getFastMediaUrl = (hosts, runtime, jwt) => __awaiter(void 0, void 0, void 0, function* () {
14882
14889
  // 根据 /ping 的响应速度对 hosts 进行排序响应速度排序
14883
14890
  const pingRes = [];
14884
- yield Promise.any(hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14885
- const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14886
- const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14887
- // 临时测试测试使用
14888
- // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14889
- const body = { jwt };
14890
- const res = yield runtime.httpReq({
14891
- url,
14892
- body: JSON.stringify(body),
14893
- timeout: PING_REQ_TIMEOUT,
14894
- method: engine.HttpMethod.POST,
14895
- });
14896
- if (res.status === 200) {
14897
- pingRes.push(host.clusterId);
14898
- }
14899
- else {
14900
- return Promise.reject();
14901
- }
14902
- })));
14903
- return pingRes;
14891
+ return new Promise((resolve, reject) => {
14892
+ hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14893
+ const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14894
+ const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14895
+ // 临时测试测试使用
14896
+ // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14897
+ const body = { jwt };
14898
+ const res = yield runtime.httpReq({
14899
+ url,
14900
+ body: JSON.stringify(body),
14901
+ timeout: PING_REQ_TIMEOUT,
14902
+ method: engine.HttpMethod.POST,
14903
+ });
14904
+ if (res.status === 200) {
14905
+ pingRes.push(host.clusterId);
14906
+ }
14907
+ resolve(pingRes);
14908
+ }));
14909
+ });
14904
14910
  });
14905
14911
  /**
14906
14912
  * @param info navi 信息
@@ -14991,7 +14997,7 @@ const getCommonHeader = () => ({
14991
14997
  'Content-Type': 'application/json;charset=UTF-8',
14992
14998
  'Cache-Control': 'no-cache',
14993
14999
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14994
- ClientVersion: "5.6.8-enterprise.1",
15000
+ ClientVersion: "5.6.9-enterprise.1",
14995
15001
  'Client-Session-Id': getUUID(),
14996
15002
  'Request-Id': Date.now().toString(),
14997
15003
  });
@@ -15032,7 +15038,7 @@ class RCMediaService {
15032
15038
  this._msList = [];
15033
15039
  this._qualityMsList = [];
15034
15040
  // 初始化时判断当前 IM 是否已经处于链接状态,已连接切没有执行过嗅探或嗅探结果无效,主动触发一次嗅探逻辑
15035
- if (!RCMediaService.isDetector && _context.getConnectionStatus() === engine.ConnectionStatus.CONNECTED) {
15041
+ if (!RCMediaService.isDetector && _context.getConnectionStatus() === engine.RCConnectionStatus.CONNECTED) {
15036
15042
  this.detectorMediaSever();
15037
15043
  }
15038
15044
  }
@@ -15262,7 +15268,7 @@ class RCMediaService {
15262
15268
  * 直播推流、自定义布局配置
15263
15269
  */
15264
15270
  setMcuConfig(headers, body) {
15265
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15271
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15266
15272
  return __awaiter(this, void 0, void 0, function* () {
15267
15273
  const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
15268
15274
  (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_T, JSON.stringify({
@@ -15290,13 +15296,22 @@ class RCMediaService {
15290
15296
  });
15291
15297
  if (status === 200) {
15292
15298
  const data = JSON.parse(jsonStr);
15293
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15294
- status: RCLoggerStatus.SUCCESSED,
15295
- 'Request-Id': reqId,
15296
- }), traceId);
15297
- return { code: data.resultCode, res: data };
15299
+ const code = data.resultCode;
15300
+ if (code === exports.RCRTCCode.SUCCESS) {
15301
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15302
+ status: RCLoggerStatus.SUCCESSED,
15303
+ 'Request-Id': reqId,
15304
+ }), traceId);
15305
+ }
15306
+ else {
15307
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.warn(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15308
+ code,
15309
+ 'Request-Id': reqId,
15310
+ }), traceId);
15311
+ }
15312
+ return { code, res: data };
15298
15313
  }
15299
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15314
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15300
15315
  status: RCLoggerStatus.FAILED,
15301
15316
  code: exports.RCRTCCode.REQUEST_FAILED,
15302
15317
  msg: `request error -> Request-Id: ${reqId}, status: ${status}, url: ${url}`,
@@ -16737,7 +16752,15 @@ class ASdpStrategy {
16737
16752
  this._sdpSemantics = 'plan-b';
16738
16753
  return;
16739
16754
  }
16755
+ // 明确支持 unified-plan 的版本中,保留 chrome 浏览器 72-92 版本之间的调试能力
16740
16756
  if (/chrome/i.test(browser)) {
16757
+ /**
16758
+ * 浏览器模拟移动端时,version 为 null
16759
+ */
16760
+ if (!version) {
16761
+ this._sdpSemantics = 'unified-plan';
16762
+ return;
16763
+ }
16741
16764
  // chrome 72 - 92 之间的版本可以通过传参的方式定义使用的 SDP 协议版本以便于测试
16742
16765
  // this._sdpSemantics = version! > 92 ? 'unified-plan' : (version! < 72 ? 'plan-b' : sdpSemantics);
16743
16766
  if (version > 92) {
@@ -17870,7 +17893,7 @@ class RCRTCPeerConnection extends engine.EventEmitter {
17870
17893
  * @todo
17871
17894
  */
17872
17895
  _reportHandle() {
17873
- var _a, _b, _c, _d;
17896
+ var _a, _b, _c, _d, _e, _f, _g;
17874
17897
  return __awaiter(this, void 0, void 0, function* () {
17875
17898
  const formatData = yield this._getStatsData();
17876
17899
  if (!formatData) {
@@ -17880,7 +17903,12 @@ class RCRTCPeerConnection extends engine.EventEmitter {
17880
17903
  * 组装质量数据,给业务层上报
17881
17904
  */
17882
17905
  const reportData = this._createRCRTCStateReport(formatData);
17883
- (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17906
+ try {
17907
+ (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17908
+ }
17909
+ catch (error) {
17910
+ (_c = this._logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17911
+ }
17884
17912
  /**
17885
17913
  * 获取音量数据,给业务层上报
17886
17914
  */
@@ -17892,9 +17920,14 @@ class RCRTCPeerConnection extends engine.EventEmitter {
17892
17920
  /**
17893
17921
  * 仅观众加房间上报合流音源信息
17894
17922
  */
17895
- if (this._isRoomAudience) {
17923
+ if (this._isRoomAudience && ((_d = this._reportListener) === null || _d === void 0 ? void 0 : _d.onReportLiveAudioStates)) {
17896
17924
  const audioStateList = this._getLiveAudioState();
17897
- audioStateList.length && ((_d = (_c = this._reportListener) === null || _c === void 0 ? void 0 : _c.onReportLiveAudioStates) === null || _d === void 0 ? void 0 : _d.call(_c, audioStateList));
17925
+ try {
17926
+ audioStateList.length && ((_f = (_e = this._reportListener) === null || _e === void 0 ? void 0 : _e.onReportLiveAudioStates) === null || _f === void 0 ? void 0 : _f.call(_e, audioStateList));
17927
+ }
17928
+ catch (error) {
17929
+ (_g = this._logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17930
+ }
17898
17931
  }
17899
17932
  });
17900
17933
  }
@@ -17911,6 +17944,9 @@ class RCRTCPeerConnection extends engine.EventEmitter {
17911
17944
  var _a;
17912
17945
  const { source: ssrc, audioLevel } = audioState;
17913
17946
  const trackId = (_a = this._store) === null || _a === void 0 ? void 0 : _a.getTrackIdBySSRC(ssrc);
17947
+ if (!trackId) {
17948
+ return {};
17949
+ }
17914
17950
  const { userId } = parseTrackId(trackId);
17915
17951
  return {
17916
17952
  audioLevel: handleAudioLevel(audioLevel),
@@ -18132,7 +18168,7 @@ class PolarisReporter {
18132
18168
  }
18133
18169
  _send(report) {
18134
18170
  return __awaiter(this, void 0, void 0, function* () {
18135
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
18171
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
18136
18172
  return RCSendCode.NOT_REPORT;
18137
18173
  }
18138
18174
  const rCSendCode = yield this._context.setRTCState(this._roomId, report);
@@ -18284,7 +18320,7 @@ class PolarisReporter {
18284
18320
  * 加入房间
18285
18321
  */
18286
18322
  sendR1() {
18287
- const rtcVersion = "5.6.8-enterprise.1";
18323
+ const rtcVersion = "5.6.9-enterprise.1";
18288
18324
  const imVersion = this._context.getCoreVersion();
18289
18325
  const platform = 'web';
18290
18326
  const pcName = navigator.platform;
@@ -18324,7 +18360,7 @@ class PolarisHttpReporter {
18324
18360
  _send(report, reportType) {
18325
18361
  var _a, _b;
18326
18362
  return __awaiter(this, void 0, void 0, function* () {
18327
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
18363
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
18328
18364
  return RCSendCode.NOT_REPORT;
18329
18365
  }
18330
18366
  const { logServer } = PolarisHttpReporter;
@@ -18434,7 +18470,7 @@ class PolarisHttpReporter {
18434
18470
  _formatR1Data() {
18435
18471
  return {
18436
18472
  joinTime: this._context.userJoinTime || 0,
18437
- rtcVersion: "5.6.8-enterprise.1",
18473
+ rtcVersion: "5.6.9-enterprise.1",
18438
18474
  imVersion: this._context.getCoreVersion(),
18439
18475
  platform: 'web',
18440
18476
  device: navigator.platform,
@@ -19551,7 +19587,7 @@ class JoinRoomCommand extends BaseCommand {
19551
19587
  else if (this.roomType === RTCMode.CROSS_MUTI) {
19552
19588
  logTag = RCLoggerTag.L_RTC_CLIENT_JOIN_CROSS_RTC_ROOM_R;
19553
19589
  }
19554
- if (context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
19590
+ if (context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
19555
19591
  (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(logTag, JSON.stringify({
19556
19592
  status: RCLoggerStatus.FAILED,
19557
19593
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
@@ -22716,7 +22752,7 @@ class RCAbstractRoom extends engine.EventEmitter {
22716
22752
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22717
22753
  const { status, time, iceCandidatePair } = data;
22718
22754
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22719
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22755
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22720
22756
  });
22721
22757
  // 发送上下行数据至北极星
22722
22758
  pc.__reportR3R4ToPolaris();
@@ -22741,7 +22777,7 @@ class RCAbstractRoom extends engine.EventEmitter {
22741
22777
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22742
22778
  const { status, time, iceCandidatePair } = data;
22743
22779
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22744
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22780
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22745
22781
  });
22746
22782
  pc.registerReportListener(this._reportListener);
22747
22783
  // 发送上下行数据至北极星
@@ -23770,6 +23806,13 @@ class RCMCUConfigBuilder {
23770
23806
  }
23771
23807
  /**
23772
23808
  * 给单道流添加水印
23809
+ * @param trackId 资源 Id
23810
+ * @param uri 水印图片的地址,需注意图片需要是 png 格式
23811
+ * @param x 相对于整体画布的起始位置 x 坐标(百分比),有效值 `0.0` - `1.0`
23812
+ * @param y 相对于整体画布的起始位置 y 坐标(百分比),有效值 `0.0` - `1.0`
23813
+ * @param width 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
23814
+ * @param height 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
23815
+ * @description 注意,参数中 x + width 不得大于 1,y + height 不得大于 1,否则调用 flush() 时会提示 46020 错误
23773
23816
  */
23774
23817
  addPictureWaterMark(trackId, uri, x, y, w, h) {
23775
23818
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -23785,7 +23828,7 @@ class RCMCUConfigBuilder {
23785
23828
  }));
23786
23829
  return this;
23787
23830
  }
23788
- if ([x, y, w, h].some((item) => !engine.isNumber(item) || item < 0 || item > 1)) {
23831
+ if ([x, y, w, h].some((item) => !engine.isNumber(item) || item < 0 || item > 1) || x + w > 1 || y + h > 1) {
23789
23832
  (_j = (_h = (_g = this._invoker.store) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23790
23833
  status: RCLoggerStatus.FAILED, msg: `some attrs of (x, y, w, h) is invalid -> x: ${x}, y: ${y}, w: ${w}, h: ${h}`,
23791
23834
  }));
@@ -23807,7 +23850,7 @@ class RCMCUConfigBuilder {
23807
23850
  }],
23808
23851
  });
23809
23852
  this._values.waterMark.singleScreen = singleScreen;
23810
- (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O, JSON.stringify({
23853
+ (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23811
23854
  status: RCLoggerStatus.SUCCESSED, trackId, uri, x, y, w, h, singleScreen,
23812
23855
  }));
23813
23856
  return this;
@@ -24540,7 +24583,7 @@ class RCLivingPKHandler {
24540
24583
  }), traceId);
24541
24584
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24542
24585
  }
24543
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
24586
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
24544
24587
  (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24545
24588
  status: RCLoggerStatus.FAILED,
24546
24589
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
@@ -25770,6 +25813,11 @@ class RCAudienceLivingRoom {
25770
25813
  const resId = getTrackId(item);
25771
25814
  const index = ids.indexOf(resId);
25772
25815
  const { userId, tag, mediaType } = parseTrackId(resId);
25816
+ /**
25817
+ * 设置房间 RTC 资源 ssrc 和 trackId map
25818
+ */
25819
+ const { ssrc } = JSON.parse(item.uri);
25820
+ this._store.setTrackIdSSRCMap(ssrc, resId);
25773
25821
  if (index > -1) {
25774
25822
  nowRes[index] = item;
25775
25823
  }
@@ -27312,7 +27360,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27312
27360
  this._audience = null;
27313
27361
  this._crtAudienceLivingRoom = null;
27314
27362
  // 用户不指定时,默认以 plan-b 优先选项
27315
- ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'plan-b');
27363
+ ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'unified-plan');
27316
27364
  this._service = new RCMediaService(this._runtime, this._context, this._options.mediaServer, this._options.timeout);
27317
27365
  // 监听 IM 连接状态变更
27318
27366
  this._context.registerConnectionStateChangeListener(this._onIMStatusChange.bind(this));
@@ -27528,7 +27576,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27528
27576
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RTC_CLIENT_IM_CONNECTION_STATE_S, JSON.stringify({
27529
27577
  status,
27530
27578
  }));
27531
- if (status !== engine.ConnectionStatus.CONNECTED) {
27579
+ if (status !== engine.RCConnectionStatus.CONNECTED) {
27532
27580
  return;
27533
27581
  }
27534
27582
  // 重连后执行探测逻辑
@@ -27853,7 +27901,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27853
27901
  }
27854
27902
  reportSDKInfo() {
27855
27903
  this._context.reportSDKInfo({
27856
- 'plugin-rtc': "5.6.8-enterprise.1",
27904
+ 'plugin-rtc': "5.6.9-enterprise.1",
27857
27905
  });
27858
27906
  }
27859
27907
  }
@@ -28842,9 +28890,9 @@ const installer = {
28842
28890
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28843
28891
  return false;
28844
28892
  }
28845
- engine.VersionManage.add('plugin-rtc', "5.6.8-enterprise.1");
28846
- if (!engine.VersionManage.validEngine(">=5.7.0-enterprise.2")) {
28847
- console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.0-enterprise.2"}'.`);
28893
+ engine.VersionManage.add('plugin-rtc', "5.6.9-enterprise.1");
28894
+ if (!engine.VersionManage.validEngine(">=5.7.2-enterprise.1")) {
28895
+ console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.2-enterprise.1"}'.`);
28848
28896
  return false;
28849
28897
  }
28850
28898
  return true;
@@ -28856,8 +28904,8 @@ const installer = {
28856
28904
  RTCLogger.setLogger(originLogger);
28857
28905
  logger.setLogger(originLogger);
28858
28906
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28859
- 'RCRTC Version': "5.6.8-enterprise.1",
28860
- Commit: "34e11acac78e5f1e18596830b8c0796659fb015a",
28907
+ 'RCRTC Version': "5.6.9-enterprise.1",
28908
+ Commit: "d8e8805bcf8f7e6302273f3fee5efba569e78d73",
28861
28909
  'browserInfo.browser': browserInfo.browser,
28862
28910
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28863
28911
  'browserInfo.version': browserInfo.version,
package/dist/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.6.8-enterprise.1
3
- * CommitId - 34e11acac78e5f1e18596830b8c0796659fb015a
4
- * Fri Jan 06 2023 15:47:48 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.9-enterprise.1
3
+ * CommitId - d8e8805bcf8f7e6302273f3fee5efba569e78d73
4
+ * Mon Feb 13 2023 19:00:46 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  (function (global, factory) {
@@ -129,6 +129,8 @@
129
129
  RCRTCCode[RCRTCCode["SYSTEM_PERMISSION_DENIED"] = 53033] = "SYSTEM_PERMISSION_DENIED";
130
130
  /** 发布时无有效资源,如 track 已被销毁 */
131
131
  RCRTCCode[RCRTCCode["PUBLISH_TRACKS_IS_INVALID"] = 53034] = "PUBLISH_TRACKS_IS_INVALID";
132
+ /** 流状态为 ended */
133
+ RCRTCCode[RCRTCCode["TRACK_READYSTATE_IS_ENDED"] = 53035] = "TRACK_READYSTATE_IS_ENDED";
132
134
  })(exports.RCRTCCode || (exports.RCRTCCode = {}));
133
135
 
134
136
  var RCLoggerTag;
@@ -6879,6 +6881,7 @@
6879
6881
  kind: (_f = this._kind) !== null && _f !== void 0 ? _f : '',
6880
6882
  msg: `the track's readyState is ended -> id: ${this._id}`,
6881
6883
  }));
6884
+ return { code: exports.RCRTCCode.TRACK_READYSTATE_IS_ENDED };
6882
6885
  }
6883
6886
  if (options === null || options === void 0 ? void 0 : options.volume) {
6884
6887
  if (!engine.isNumber(options === null || options === void 0 ? void 0 : options.volume)) {
@@ -14868,12 +14871,16 @@
14868
14871
  'Content-Type': 'application/json;charset=UTF-8',
14869
14872
  'Cache-Control': 'no-cache',
14870
14873
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14871
- ClientVersion: "5.6.8-enterprise.1",
14874
+ ClientVersion: "5.6.9-enterprise.1",
14872
14875
  'Client-Session-Id': getUUID(),
14873
14876
  'Request-Id': Date.now().toString(),
14874
14877
  });
14875
14878
  /**
14876
14879
  * 根据探测地址 list 发 ping 拿到返回最快的 Media 地址
14880
+ * 执行时机:RTC 初始化时
14881
+ * pingRes 使用时机:加房间时
14882
+ * 为不阻塞初始化代码执行,有一个 host 地址请求完就 resolve
14883
+ * 其他 host 地址后续继续排序进入 pingRes 数组(引用类型保证使用时为更新后的 host 列表)
14877
14884
  * @param hosts 探测地址 list
14878
14885
  * @param runtime
14879
14886
  * @returns
@@ -14881,26 +14888,25 @@
14881
14888
  const getFastMediaUrl = (hosts, runtime, jwt) => __awaiter(void 0, void 0, void 0, function* () {
14882
14889
  // 根据 /ping 的响应速度对 hosts 进行排序响应速度排序
14883
14890
  const pingRes = [];
14884
- yield Promise.any(hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14885
- const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14886
- const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14887
- // 临时测试测试使用
14888
- // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14889
- const body = { jwt };
14890
- const res = yield runtime.httpReq({
14891
- url,
14892
- body: JSON.stringify(body),
14893
- timeout: PING_REQ_TIMEOUT,
14894
- method: engine.HttpMethod.POST,
14895
- });
14896
- if (res.status === 200) {
14897
- pingRes.push(host.clusterId);
14898
- }
14899
- else {
14900
- return Promise.reject();
14901
- }
14902
- })));
14903
- return pingRes;
14891
+ return new Promise((resolve, reject) => {
14892
+ hosts.map((host) => __awaiter(void 0, void 0, void 0, function* () {
14893
+ const detectorAddr = host.detectorAddr.replace(/^(https?:\/\/)?/, 'https://');
14894
+ const url = `${detectorAddr}/rtc/detector/ping?t=${randomNum(1000, 9999)}`;
14895
+ // 临时测试测试使用
14896
+ // const url = `${detectorAddr}/state/server?t=${randomNum(1000, 9999)}`
14897
+ const body = { jwt };
14898
+ const res = yield runtime.httpReq({
14899
+ url,
14900
+ body: JSON.stringify(body),
14901
+ timeout: PING_REQ_TIMEOUT,
14902
+ method: engine.HttpMethod.POST,
14903
+ });
14904
+ if (res.status === 200) {
14905
+ pingRes.push(host.clusterId);
14906
+ }
14907
+ resolve(pingRes);
14908
+ }));
14909
+ });
14904
14910
  });
14905
14911
  /**
14906
14912
  * @param info navi 信息
@@ -14991,7 +14997,7 @@
14991
14997
  'Content-Type': 'application/json;charset=UTF-8',
14992
14998
  'Cache-Control': 'no-cache',
14993
14999
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14994
- ClientVersion: "5.6.8-enterprise.1",
15000
+ ClientVersion: "5.6.9-enterprise.1",
14995
15001
  'Client-Session-Id': getUUID(),
14996
15002
  'Request-Id': Date.now().toString(),
14997
15003
  });
@@ -15032,7 +15038,7 @@
15032
15038
  this._msList = [];
15033
15039
  this._qualityMsList = [];
15034
15040
  // 初始化时判断当前 IM 是否已经处于链接状态,已连接切没有执行过嗅探或嗅探结果无效,主动触发一次嗅探逻辑
15035
- if (!RCMediaService.isDetector && _context.getConnectionStatus() === engine.ConnectionStatus.CONNECTED) {
15041
+ if (!RCMediaService.isDetector && _context.getConnectionStatus() === engine.RCConnectionStatus.CONNECTED) {
15036
15042
  this.detectorMediaSever();
15037
15043
  }
15038
15044
  }
@@ -15262,7 +15268,7 @@
15262
15268
  * 直播推流、自定义布局配置
15263
15269
  */
15264
15270
  setMcuConfig(headers, body) {
15265
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
15271
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
15266
15272
  return __awaiter(this, void 0, void 0, function* () {
15267
15273
  const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
15268
15274
  (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_T, JSON.stringify({
@@ -15290,13 +15296,22 @@
15290
15296
  });
15291
15297
  if (status === 200) {
15292
15298
  const data = JSON.parse(jsonStr);
15293
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15294
- status: RCLoggerStatus.SUCCESSED,
15295
- 'Request-Id': reqId,
15296
- }), traceId);
15297
- return { code: data.resultCode, res: data };
15299
+ const code = data.resultCode;
15300
+ if (code === exports.RCRTCCode.SUCCESS) {
15301
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15302
+ status: RCLoggerStatus.SUCCESSED,
15303
+ 'Request-Id': reqId,
15304
+ }), traceId);
15305
+ }
15306
+ else {
15307
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.warn(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15308
+ code,
15309
+ 'Request-Id': reqId,
15310
+ }), traceId);
15311
+ }
15312
+ return { code, res: data };
15298
15313
  }
15299
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15314
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_MEDIA_SERVICE_SET_MCU_CONFIG_R, JSON.stringify({
15300
15315
  status: RCLoggerStatus.FAILED,
15301
15316
  code: exports.RCRTCCode.REQUEST_FAILED,
15302
15317
  msg: `request error -> Request-Id: ${reqId}, status: ${status}, url: ${url}`,
@@ -16737,7 +16752,15 @@
16737
16752
  this._sdpSemantics = 'plan-b';
16738
16753
  return;
16739
16754
  }
16755
+ // 明确支持 unified-plan 的版本中,保留 chrome 浏览器 72-92 版本之间的调试能力
16740
16756
  if (/chrome/i.test(browser)) {
16757
+ /**
16758
+ * 浏览器模拟移动端时,version 为 null
16759
+ */
16760
+ if (!version) {
16761
+ this._sdpSemantics = 'unified-plan';
16762
+ return;
16763
+ }
16741
16764
  // chrome 72 - 92 之间的版本可以通过传参的方式定义使用的 SDP 协议版本以便于测试
16742
16765
  // this._sdpSemantics = version! > 92 ? 'unified-plan' : (version! < 72 ? 'plan-b' : sdpSemantics);
16743
16766
  if (version > 92) {
@@ -17870,7 +17893,7 @@
17870
17893
  * @todo
17871
17894
  */
17872
17895
  _reportHandle() {
17873
- var _a, _b, _c, _d;
17896
+ var _a, _b, _c, _d, _e, _f, _g;
17874
17897
  return __awaiter(this, void 0, void 0, function* () {
17875
17898
  const formatData = yield this._getStatsData();
17876
17899
  if (!formatData) {
@@ -17880,7 +17903,12 @@
17880
17903
  * 组装质量数据,给业务层上报
17881
17904
  */
17882
17905
  const reportData = this._createRCRTCStateReport(formatData);
17883
- (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17906
+ try {
17907
+ (_b = (_a = this._reportListener) === null || _a === void 0 ? void 0 : _a.onStateReport) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(JSON.stringify(reportData)));
17908
+ }
17909
+ catch (error) {
17910
+ (_c = this._logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17911
+ }
17884
17912
  /**
17885
17913
  * 获取音量数据,给业务层上报
17886
17914
  */
@@ -17892,9 +17920,14 @@
17892
17920
  /**
17893
17921
  * 仅观众加房间上报合流音源信息
17894
17922
  */
17895
- if (this._isRoomAudience) {
17923
+ if (this._isRoomAudience && ((_d = this._reportListener) === null || _d === void 0 ? void 0 : _d.onReportLiveAudioStates)) {
17896
17924
  const audioStateList = this._getLiveAudioState();
17897
- audioStateList.length && ((_d = (_c = this._reportListener) === null || _c === void 0 ? void 0 : _c.onReportLiveAudioStates) === null || _d === void 0 ? void 0 : _d.call(_c, audioStateList));
17925
+ try {
17926
+ audioStateList.length && ((_f = (_e = this._reportListener) === null || _e === void 0 ? void 0 : _e.onReportLiveAudioStates) === null || _f === void 0 ? void 0 : _f.call(_e, audioStateList));
17927
+ }
17928
+ catch (error) {
17929
+ (_g = this._logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, error === null || error === void 0 ? void 0 : error.stack);
17930
+ }
17898
17931
  }
17899
17932
  });
17900
17933
  }
@@ -17911,6 +17944,9 @@
17911
17944
  var _a;
17912
17945
  const { source: ssrc, audioLevel } = audioState;
17913
17946
  const trackId = (_a = this._store) === null || _a === void 0 ? void 0 : _a.getTrackIdBySSRC(ssrc);
17947
+ if (!trackId) {
17948
+ return {};
17949
+ }
17914
17950
  const { userId } = parseTrackId(trackId);
17915
17951
  return {
17916
17952
  audioLevel: handleAudioLevel(audioLevel),
@@ -18132,7 +18168,7 @@
18132
18168
  }
18133
18169
  _send(report) {
18134
18170
  return __awaiter(this, void 0, void 0, function* () {
18135
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
18171
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
18136
18172
  return RCSendCode.NOT_REPORT;
18137
18173
  }
18138
18174
  const rCSendCode = yield this._context.setRTCState(this._roomId, report);
@@ -18284,7 +18320,7 @@
18284
18320
  * 加入房间
18285
18321
  */
18286
18322
  sendR1() {
18287
- const rtcVersion = "5.6.8-enterprise.1";
18323
+ const rtcVersion = "5.6.9-enterprise.1";
18288
18324
  const imVersion = this._context.getCoreVersion();
18289
18325
  const platform = 'web';
18290
18326
  const pcName = navigator.platform;
@@ -18324,7 +18360,7 @@
18324
18360
  _send(report, reportType) {
18325
18361
  var _a, _b;
18326
18362
  return __awaiter(this, void 0, void 0, function* () {
18327
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
18363
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
18328
18364
  return RCSendCode.NOT_REPORT;
18329
18365
  }
18330
18366
  const { logServer } = PolarisHttpReporter;
@@ -18434,7 +18470,7 @@
18434
18470
  _formatR1Data() {
18435
18471
  return {
18436
18472
  joinTime: this._context.userJoinTime || 0,
18437
- rtcVersion: "5.6.8-enterprise.1",
18473
+ rtcVersion: "5.6.9-enterprise.1",
18438
18474
  imVersion: this._context.getCoreVersion(),
18439
18475
  platform: 'web',
18440
18476
  device: navigator.platform,
@@ -19551,7 +19587,7 @@
19551
19587
  else if (this.roomType === RTCMode.CROSS_MUTI) {
19552
19588
  logTag = RCLoggerTag.L_RTC_CLIENT_JOIN_CROSS_RTC_ROOM_R;
19553
19589
  }
19554
- if (context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
19590
+ if (context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
19555
19591
  (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(logTag, JSON.stringify({
19556
19592
  status: RCLoggerStatus.FAILED,
19557
19593
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
@@ -22716,7 +22752,7 @@
22716
22752
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22717
22753
  const { status, time, iceCandidatePair } = data;
22718
22754
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22719
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22755
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22720
22756
  });
22721
22757
  // 发送上下行数据至北极星
22722
22758
  pc.__reportR3R4ToPolaris();
@@ -22741,7 +22777,7 @@
22741
22777
  pc.on(RCRTCPeerConnection.__INNER_ICE_STATE_CHANGE__, (data) => {
22742
22778
  const { status, time, iceCandidatePair } = data;
22743
22779
  iceCandidatePair && this._reportMediaActionLogger.setIceCandidatePair(pcName, iceCandidatePair);
22744
- this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22780
+ iceCandidatePair && this._reportMediaActionLogger.recordQualityIceStatusData(pcName, status, time);
22745
22781
  });
22746
22782
  pc.registerReportListener(this._reportListener);
22747
22783
  // 发送上下行数据至北极星
@@ -23770,6 +23806,13 @@
23770
23806
  }
23771
23807
  /**
23772
23808
  * 给单道流添加水印
23809
+ * @param trackId 资源 Id
23810
+ * @param uri 水印图片的地址,需注意图片需要是 png 格式
23811
+ * @param x 相对于整体画布的起始位置 x 坐标(百分比),有效值 `0.0` - `1.0`
23812
+ * @param y 相对于整体画布的起始位置 y 坐标(百分比),有效值 `0.0` - `1.0`
23813
+ * @param width 相对于整体画布的宽(百分比),有效值 `0.0` - `1.0`
23814
+ * @param height 相对于整体画布的高(百分比),有效值 `0.0` - `1.0`
23815
+ * @description 注意,参数中 x + width 不得大于 1,y + height 不得大于 1,否则调用 flush() 时会提示 46020 错误
23773
23816
  */
23774
23817
  addPictureWaterMark(trackId, uri, x, y, w, h) {
23775
23818
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -23785,7 +23828,7 @@
23785
23828
  }));
23786
23829
  return this;
23787
23830
  }
23788
- if ([x, y, w, h].some((item) => !engine.isNumber(item) || item < 0 || item > 1)) {
23831
+ if ([x, y, w, h].some((item) => !engine.isNumber(item) || item < 0 || item > 1) || x + w > 1 || y + h > 1) {
23789
23832
  (_j = (_h = (_g = this._invoker.store) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23790
23833
  status: RCLoggerStatus.FAILED, msg: `some attrs of (x, y, w, h) is invalid -> x: ${x}, y: ${y}, w: ${w}, h: ${h}`,
23791
23834
  }));
@@ -23807,7 +23850,7 @@
23807
23850
  }],
23808
23851
  });
23809
23852
  this._values.waterMark.singleScreen = singleScreen;
23810
- (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O, JSON.stringify({
23853
+ (_m = (_l = (_k = this._invoker.store) === null || _k === void 0 ? void 0 : _k.context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O, JSON.stringify({
23811
23854
  status: RCLoggerStatus.SUCCESSED, trackId, uri, x, y, w, h, singleScreen,
23812
23855
  }));
23813
23856
  return this;
@@ -24540,7 +24583,7 @@
24540
24583
  }), traceId);
24541
24584
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24542
24585
  }
24543
- if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
24586
+ if (this._context.getConnectionStatus() !== engine.RCConnectionStatus.CONNECTED) {
24544
24587
  (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24545
24588
  status: RCLoggerStatus.FAILED,
24546
24589
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
@@ -25770,6 +25813,11 @@
25770
25813
  const resId = getTrackId(item);
25771
25814
  const index = ids.indexOf(resId);
25772
25815
  const { userId, tag, mediaType } = parseTrackId(resId);
25816
+ /**
25817
+ * 设置房间 RTC 资源 ssrc 和 trackId map
25818
+ */
25819
+ const { ssrc } = JSON.parse(item.uri);
25820
+ this._store.setTrackIdSSRCMap(ssrc, resId);
25773
25821
  if (index > -1) {
25774
25822
  nowRes[index] = item;
25775
25823
  }
@@ -27312,7 +27360,7 @@
27312
27360
  this._audience = null;
27313
27361
  this._crtAudienceLivingRoom = null;
27314
27362
  // 用户不指定时,默认以 plan-b 优先选项
27315
- ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'plan-b');
27363
+ ASdpStrategy.setSdpSemantics(_options.sdpSemantics || 'unified-plan');
27316
27364
  this._service = new RCMediaService(this._runtime, this._context, this._options.mediaServer, this._options.timeout);
27317
27365
  // 监听 IM 连接状态变更
27318
27366
  this._context.registerConnectionStateChangeListener(this._onIMStatusChange.bind(this));
@@ -27528,7 +27576,7 @@
27528
27576
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RTC_CLIENT_IM_CONNECTION_STATE_S, JSON.stringify({
27529
27577
  status,
27530
27578
  }));
27531
- if (status !== engine.ConnectionStatus.CONNECTED) {
27579
+ if (status !== engine.RCConnectionStatus.CONNECTED) {
27532
27580
  return;
27533
27581
  }
27534
27582
  // 重连后执行探测逻辑
@@ -27853,7 +27901,7 @@
27853
27901
  }
27854
27902
  reportSDKInfo() {
27855
27903
  this._context.reportSDKInfo({
27856
- 'plugin-rtc': "5.6.8-enterprise.1",
27904
+ 'plugin-rtc': "5.6.9-enterprise.1",
27857
27905
  });
27858
27906
  }
27859
27907
  }
@@ -28842,9 +28890,9 @@ message probuf {
28842
28890
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28843
28891
  return false;
28844
28892
  }
28845
- engine.VersionManage.add('plugin-rtc', "5.6.8-enterprise.1");
28846
- if (!engine.VersionManage.validEngine(">=5.7.0-enterprise.2")) {
28847
- console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.0-enterprise.2"}'.`);
28893
+ engine.VersionManage.add('plugin-rtc', "5.6.9-enterprise.1");
28894
+ if (!engine.VersionManage.validEngine(">=5.7.2-enterprise.1")) {
28895
+ console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${">=5.7.2-enterprise.1"}'.`);
28848
28896
  return false;
28849
28897
  }
28850
28898
  return true;
@@ -28856,8 +28904,8 @@ message probuf {
28856
28904
  RTCLogger.setLogger(originLogger);
28857
28905
  logger.setLogger(originLogger);
28858
28906
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28859
- 'RCRTC Version': "5.6.8-enterprise.1",
28860
- Commit: "34e11acac78e5f1e18596830b8c0796659fb015a",
28907
+ 'RCRTC Version': "5.6.9-enterprise.1",
28908
+ Commit: "d8e8805bcf8f7e6302273f3fee5efba569e78d73",
28861
28909
  'browserInfo.browser': browserInfo.browser,
28862
28910
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28863
28911
  'browserInfo.version': browserInfo.version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rongcloud/plugin-rtc",
3
- "version": "5.6.8-enterprise.1",
3
+ "version": "5.6.9-enterprise.1",
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": ">=5.7.0-enterprise.2"
34
+ "@rongcloud/engine": ">=5.7.2-enterprise.1"
35
35
  },
36
- "__commit__": "34e11acac78e5f1e18596830b8c0796659fb015a"
36
+ "__commit__": "d8e8805bcf8f7e6302273f3fee5efba569e78d73"
37
37
  }