@rongcloud/plugin-rtc 5.6.3-alpha.2 → 5.6.3-alpha.5

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.esm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /*
2
- * RCRTC - v5.6.3-alpha.2
3
- * CommitId - 2fda2b34be0736183519f005f2d4157acd8a3161
4
- * Sun Nov 13 2022 12:38:30 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.3-alpha.5
3
+ * CommitId - 48fe4c6914037db2dfd263f31aba741834041487
4
+ * Wed Nov 16 2022 17:24:53 GMT+0800 (中国标准时间)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
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';
8
8
 
9
- /*! *****************************************************************************
9
+ /******************************************************************************
10
10
  Copyright (c) Microsoft Corporation.
11
11
 
12
12
  Permission to use, copy, modify, and/or distribute this software for any
@@ -246,10 +246,14 @@ var RCLoggerTag;
246
246
  */
247
247
  RCLoggerTag["L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R"] = "L-rtc_client_downgrade_to_audience_room-R";
248
248
  /**
249
- * 加入房间的动作、结果
249
+ * 业务层获取房间信息的动作、结果
250
250
  */
251
251
  RCLoggerTag["L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T"] = "L-rtc_client_get_joined_room_info-T";
252
252
  RCLoggerTag["L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R"] = "L-rtc_client_get_joined_room_info-R";
253
+ /**
254
+ * 观众不加房间触发应用层 onTrackReady 事件
255
+ */
256
+ RCLoggerTag["L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O"] = "L-audinence_client_call_onTrackReady-O";
253
257
  /**
254
258
  * 观众订阅资源任务
255
259
  */
@@ -371,11 +375,11 @@ var RCLoggerTag;
371
375
  */
372
376
  RCLoggerTag["L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O"] = "L-abstract_room_register_room_event_listener-O";
373
377
  /**
374
- * 房间注册上报事件
378
+ * 房间注册质量数据上报事件
375
379
  */
376
380
  RCLoggerTag["L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O"] = "L-abstract_room_register_report_listener-O";
377
381
  /**
378
- * 房间音频等级变更
382
+ * 注册音量变更事件
379
383
  */
380
384
  RCLoggerTag["L_ABSTRACT_ROOM_AUDIO_LEVEL_O"] = "L-abstract_room_audio_level-O";
381
385
  /**
@@ -423,13 +427,18 @@ var RCLoggerTag;
423
427
  */
424
428
  RCLoggerTag["L_LIVING_ROOM_ENABLE_INNER_CDN_R"] = "L-living_room_enable_inner_cdn-R";
425
429
  /**
426
- * livingroom扩散cdn内容的任务
430
+ * livingroom 扩散 cdn 内容的任务
427
431
  */
428
432
  RCLoggerTag["L_LIVING_ROOM_SPREAD_CDN_INFO_T"] = "L-living_room_spread_cdn_info-T";
429
433
  /**
430
- * livingroom扩散cdn内容的结果
434
+ * livingroom 扩散 cdn 内容的结果
431
435
  */
432
436
  RCLoggerTag["L_LIVING_ROOM_SPREAD_CDN_INFO_R"] = "L-living_room_spread_cdn_info-R";
437
+ /**
438
+ * livingroom 设置房间 cdn 信息任务和结果
439
+ */
440
+ RCLoggerTag["L_LIVING_ROOM_SET_ROOM_CDN_INFO_T"] = "L-living_room_set_room_cdn_info-T";
441
+ RCLoggerTag["L_LIVING_ROOM_SET_ROOM_CDN_INFO_R"] = "L-living_room_set_room_cdn_info-R";
433
442
  /**
434
443
  * livingroom加入pk房间的任务
435
444
  */
@@ -447,17 +456,33 @@ var RCLoggerTag;
447
456
  */
448
457
  RCLoggerTag["L_LIVING_ROOM_LEAVE_PK_ROOM_R"] = "L-living_room_leave_pk_room-R";
449
458
  /**
450
- * livingroom获取pk房间handler
459
+ * 主动离开 pk 房间
460
+ */
461
+ RCLoggerTag["L_APP_CALL_LEAVE_PK_ROOM_O"] = "L-app_call_leave_pk_room-O";
462
+ /**
463
+ * 结束连麦触发离开 pk 房间
464
+ */
465
+ RCLoggerTag["L_QUIT_PK_LEAVE_PK_ROOM_O"] = "L-quit_pk_leave_pk_room-O";
466
+ /**
467
+ * livingroom 获取 pk 房间 handler
451
468
  */
452
469
  RCLoggerTag["L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O"] = "L-living_room_get_room_pk_handler-O";
470
+ /**
471
+ * livingroom 获取 getMCUConfigBuilder
472
+ */
473
+ RCLoggerTag["L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O"] = "L-living_room_get_mcu_config_builder-O";
453
474
  /**
454
475
  * livingroom离开全部pk房间
455
476
  */
456
477
  RCLoggerTag["L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O"] = "L-living_room_quit_all_pk_room-O";
457
478
  /**
458
- * livingpkhandler注册pk房间监听事件
479
+ * livingpkhandler 注册pk房间监听事件
459
480
  */
460
481
  RCLoggerTag["L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O"] = "L-living_pk_handler_register_room_pk_event_listener-O";
482
+ /**
483
+ * livingpkhandler 注册事件执行
484
+ */
485
+ RCLoggerTag["L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O"] = "L-living_pk_handler_call_app_listener-O";
461
486
  /**
462
487
  * livingpkhandler发起跨房间连麦请求的任务
463
488
  */
@@ -499,13 +524,29 @@ var RCLoggerTag;
499
524
  */
500
525
  RCLoggerTag["L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R"] = "L-living_pk_handler_leave_other_room-R";
501
526
  /**
502
- * AudienceLivingRoom信令数据变化的任务
527
+ * 结束连麦的执行和结果
528
+ */
529
+ RCLoggerTag["L_QUIT_PK_T"] = "L-quit_pk-T";
530
+ RCLoggerTag["L_QUIT_PK_R"] = "L-quit_pk-R";
531
+ /**
532
+ * ExchangeWithPushOtherRoomCommand 执行和结果
533
+ */
534
+ RCLoggerTag["L_EXCHANGE_WITH_PUSHOTHERROOM_T"] = "L-exchange_with_pushotherroom-T";
535
+ RCLoggerTag["L_EXCHANGE_WITH_PUSHOTHERROOM_R"] = "L-exchange_with_pushotherroom-R";
536
+ /**
537
+ * AudienceLivingRoom 触发业务层事件
503
538
  */
504
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_T"] = "L-audience_living_room_singal_data_change-T";
539
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O"] = "L-audience_living_room_call_app_listener-O";
505
540
  /**
506
- * AudienceLivingRoom信令数据变化的结果
541
+ * AudienceLivingRoom 拉 kvEntries
507
542
  */
508
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_R"] = "L-audience_living_room_singal_data_change-R";
543
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O"] = "L-audience_living_room_pull_kvEntries-O";
544
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T"] = "L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T";
545
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R"] = "L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R";
546
+ /**
547
+ * AudienceLivingRoom信令数据变化的结果处理过程
548
+ */
549
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P"] = "L-audience_living_room_singal_data_change-P";
509
550
  /**
510
551
  * AudienceLivingRoom获取cdn播放地址的任务
511
552
  */
@@ -523,17 +564,27 @@ var RCLoggerTag;
523
564
  */
524
565
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R"] = "L-audience_living_room_subscribe-R";
525
566
  /**
526
- * AudienceLivingRoom取消订阅资源的任务
567
+ * AudienceLivingRoom 取消订阅资源的任务
527
568
  */
528
569
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T"] = "L-audience_living_room_unsubscribe-T";
529
570
  /**
530
- * AudienceLivingRoom取消订阅资源的结果
571
+ * AudienceLivingRoom 取消订阅资源的结果
531
572
  */
532
573
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R"] = "L-audience_living_room_unsubscribe-R";
533
574
  /**
534
- * AudienceLivingRoom声音改变
575
+ * AudienceLivingRoom updateSubscribeList 执行和结果
576
+ */
577
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T"] = "L-audience_living_room_update_subscribeList-T";
578
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R"] = "L-audience_living_room_update_subscribeList-R";
579
+ /**
580
+ * AudienceLivingRoom 内部 onTrackReady 触发
535
581
  */
536
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_AUDIO_LEVEL_CHANGE_O"] = "L-audience_living_room_audio_level_change-O";
582
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O"] = "L-audience_living_room_onTrackReady-O";
583
+ /**
584
+ * AudienceLivingRoom 内部 im 重连
585
+ */
586
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R"] = "L-audience_living_room_im_reconnected-R";
587
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T"] = "L-audience_living_room_im_reconnected-T";
537
588
  /**
538
589
  * MCUConfigBuilder设置音频轨道
539
590
  */
@@ -638,10 +689,6 @@ var RCLoggerTag;
638
689
  * MCUConfigBuilder重置
639
690
  */
640
691
  RCLoggerTag["L_MCU_CONFIG_BUILDER_RESET_O"] = "L-mcu_config_builder_reset-O";
641
- /**
642
- * MCUConfigBuilder刷新
643
- */
644
- // L_MCU_CONFIG_BUILDER_FLUSH_O = 'L-mcu_config_builder_flush-O',
645
692
  /**
646
693
  * MCUConfigBuilder设置单到流水印
647
694
  */
@@ -670,6 +717,14 @@ var RCLoggerTag;
670
717
  * MediaService获取CDN资源内容的结果
671
718
  */
672
719
  RCLoggerTag["L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R"] = "L-media_service_get_cnd_resource_info-R";
720
+ /**
721
+ * MediaService 使用的 msList 重新获取、排序
722
+ */
723
+ RCLoggerTag["L_MEDIA_SERVICE_MSLIST_CHANGE_O"] = "L-media_service_msList_change-O";
724
+ /**
725
+ * MediaService 解析 navi callVoip info 数据
726
+ */
727
+ RCLoggerTag["L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O"] = "L-media_service_parse_navi_callvoip_info-O";
673
728
  /**
674
729
  * MediaService发起请求的任务
675
730
  */
@@ -678,10 +733,6 @@ var RCLoggerTag;
678
733
  * MediaService发起请求的结果
679
734
  */
680
735
  RCLoggerTag["L_MEDIA_SERVICE_REQUEST_R"] = "L-media_service_request-R";
681
- /**
682
- * LocalTrack设置推流详情
683
- */
684
- RCLoggerTag["L_LOCAL_TRACK_INNER_SET_PUBLISHED_O"] = "L-loacl_track_inner_set_published-O";
685
736
  /**
686
737
  * LocalTrack销毁
687
738
  */
@@ -695,9 +746,10 @@ var RCLoggerTag;
695
746
  */
696
747
  RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_O"] = "L-loacl_track_set_local_muted-O";
697
748
  /**
698
- * LocalTrack 设置禁用/启用动作扩散结果
749
+ * LocalTrack 设置禁用/启用动作扩散动作、结果
699
750
  */
700
- RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_R"] = "L-loacl_track_set_local_muted-R";
751
+ RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T"] = "L-loacl_track_set_local_muted_spread-T";
752
+ RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R"] = "L-loacl_track_set_local_muted_spread-R";
701
753
  /**
702
754
  * Track播放的动作
703
755
  */
@@ -734,14 +786,6 @@ var RCLoggerTag;
734
786
  * Track可以播放
735
787
  */
736
788
  RCLoggerTag["L_TRACK_CANPLAY_O"] = "L-track_canplay-O";
737
- /**
738
- * Track静音
739
- */
740
- RCLoggerTag["L_TRACK_MUTE_O"] = "L-track_mute-O";
741
- /**
742
- * Track取消静音
743
- */
744
- RCLoggerTag["L_TRACK_UNMUTE_O"] = "L-track_unmute-O";
745
789
  /**
746
790
  * AbstractStatParser格式化状态
747
791
  */
@@ -754,18 +798,10 @@ var RCLoggerTag;
754
798
  * ASdpStrategy设置远端回答
755
799
  */
756
800
  RCLoggerTag["L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O"] = "L-a_sdp_strategy_set_remote_answer-O";
757
- /**
758
- * RTCPeerConnection获取状态数据
759
- */
760
- RCLoggerTag["L_RTC_PEER_CONNECTION_GET_STATS_DATA_O"] = "L-rtc_peer_connection_get_stats_data-O";
761
801
  /**
762
802
  * RTCPeerConnection设置本地轨道
763
803
  */
764
804
  RCLoggerTag["L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O"] = "L-rtc_peer_connection_add_local_track-O";
765
- /**
766
- * RTCPeerConnection获取本地轨道
767
- */
768
- RCLoggerTag["L_RTC_PEER_CONNECTION_GET_LOCAL_TRACKS_O"] = "L-rtc_peer_connection_get_local_tracks-O";
769
805
  /**
770
806
  * RTCPeerConnection ICE 连接状态改变
771
807
  */
@@ -798,14 +834,6 @@ var RCLoggerTag;
798
834
  * RTCPeerConnection删除本地轨道
799
835
  */
800
836
  RCLoggerTag["L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O"] = "L-rtc_peer_connection_remove_local_track-O";
801
- /**
802
- * RTCPeerConnection更新远端轨道
803
- */
804
- RCLoggerTag["L_RTC_PEER_CONNECTION_UPDATE_SUB_REMOTE_TRACKS_O"] = "L-rtc_peer_connection_update_sub_remote_tracks-O";
805
- /**
806
- * RTCPeerConnection设置本地声音
807
- */
808
- RCLoggerTag["L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O"] = "L-rtc_peer_connection_local_track_muted-O";
809
837
  /**
810
838
  * RTCPeerConnection销毁
811
839
  */
@@ -814,10 +842,6 @@ var RCLoggerTag;
814
842
  * 设置码率出错,设置的码率值未在推荐列表
815
843
  */
816
844
  RCLoggerTag["L_RTC_SET_RECOMMEND_BITRATE_O"] = "L_rtc_set_recommend_bitrate_O";
817
- /**
818
- * 设置 SDP 上的码率
819
- */
820
- RCLoggerTag["L_RTC_SDP_BITRATE_O"] = "L_rtc_sdp_bitrate_O";
821
845
  /**
822
846
  * 3A 降噪
823
847
  */
@@ -936,10 +960,12 @@ var RCLoggerTag;
936
960
  RCLoggerTag["L_UNPUBLISH_PREV_COMMAND_T"] = "L-unpublish_prev_command-T";
937
961
  RCLoggerTag["L_UNPUBLISH_PREV_COMMAND_R"] = "L-unpublish_prev_command-R";
938
962
  /**
939
- * RetryExchangeCommand 任务和结果
963
+ * RetryExchangeCommand 任务
964
+ * RetryExchange 之后执行扩散动作和结果
940
965
  */
941
966
  RCLoggerTag["L_RETRY_EXCHANGE_COMMAND_T"] = "L-retry_exchange_command-T";
942
- RCLoggerTag["L_RETRY_EXCHANGE_COMMAND_R"] = "L-retry_exchange_command-R";
967
+ RCLoggerTag["L_RETRY_EXCHANGE_SPREAD_T"] = "L-retry_exchange_spread-T";
968
+ RCLoggerTag["L_RETRY_EXCHANGE_SPREAD_R"] = "L-retry_exchange_spread-R";
943
969
  /**
944
970
  * ParseUserStateCommand 的结果
945
971
  */
@@ -957,9 +983,29 @@ var RCLoggerTag;
957
983
  */
958
984
  RCLoggerTag["L_SET_AUDIO_CONSTRAINTS_O"] = "L-set_audio_constraints-O";
959
985
  /**
986
+ * 方法不可用
987
+ */
988
+ RCLoggerTag["L_FUNCTION_IS_UNAVAILABLE"] = "L-function_is_unavailable";
989
+ /*
960
990
  * 取消订阅本地清除的订阅关系列表
961
991
  */
962
992
  RCLoggerTag["L_CLEAR_UNSUBSCRIBE_LIST_O"] = "L-clear_unsubscribe_list-O";
993
+ /**
994
+ * 队列任务插入
995
+ */
996
+ RCLoggerTag["L_INVOKER_PUSH_O"] = "L-invoker_push-O";
997
+ /**
998
+ * 队列任务开始执行
999
+ */
1000
+ RCLoggerTag["L_INVOKER_EXECUTE_T"] = "L-invoker_execute-T";
1001
+ /**
1002
+ * 队列任务执行结束
1003
+ */
1004
+ RCLoggerTag["L_INVOKER_EXECUTE_R"] = "L-invoker_execute-R";
1005
+ /**
1006
+ * 销毁队列事件
1007
+ */
1008
+ RCLoggerTag["L_INVOKER_DESTROY_O"] = "L-invoker_destroy-R";
963
1009
  })(RCLoggerTag || (RCLoggerTag = {}));
964
1010
  var RCLoggerStatus;
965
1011
  (function (RCLoggerStatus) {
@@ -7163,7 +7209,6 @@ class RCLocalTrack extends RCTrack {
7163
7209
  */
7164
7210
  changed && this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, this, resolve);
7165
7211
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_O, JSON.stringify({
7166
- status: RCLoggerStatus.SUCCESSED,
7167
7212
  enable: bool,
7168
7213
  trackId: this._id,
7169
7214
  }));
@@ -14755,7 +14800,7 @@ const getCommonHeader$1 = () => ({
14755
14800
  'Content-Type': 'application/json;charset=UTF-8',
14756
14801
  'Cache-Control': 'no-cache',
14757
14802
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14758
- ClientVersion: "5.6.3-alpha.2",
14803
+ ClientVersion: "5.6.3-alpha.5",
14759
14804
  'Client-Session-Id': getUUID(),
14760
14805
  'Request-Id': Date.now().toString(),
14761
14806
  });
@@ -14780,8 +14825,6 @@ const getFastMediaUrl = (hosts, runtime, jwt) => __awaiter(void 0, void 0, void
14780
14825
  timeout: PING_REQ_TIMEOUT,
14781
14826
  method: HttpMethod.POST,
14782
14827
  });
14783
- const logger = RTCLogger.getLogger();
14784
- logger === null || logger === void 0 ? void 0 : logger.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `ping res => ${JSON.stringify({ status: res.status, host })}`);
14785
14828
  if (res.status === 200) {
14786
14829
  pingRes.push(host.clusterId);
14787
14830
  }
@@ -14806,7 +14849,7 @@ const parseDetectorServer = (info) => {
14806
14849
  }
14807
14850
  catch (error) {
14808
14851
  const logger = RTCLogger.getLogger();
14809
- logger === null || logger === void 0 ? void 0 : logger.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `parse \`voipCallInfo\` of navi failed: ${info.voipCallInfo}`);
14852
+ logger === null || logger === void 0 ? void 0 : logger.warn(RCLoggerTag.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O, `parse \`voipCallInfo\` of navi failed: ${info.voipCallInfo}`);
14810
14853
  return '';
14811
14854
  }
14812
14855
  if (voipInfo.strategy === 0) {
@@ -15333,7 +15376,7 @@ const getCommonHeader = () => ({
15333
15376
  'Content-Type': 'application/json;charset=UTF-8',
15334
15377
  'Cache-Control': 'no-cache',
15335
15378
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
15336
- ClientVersion: "5.6.3-alpha.2",
15379
+ ClientVersion: "5.6.3-alpha.5",
15337
15380
  'Client-Session-Id': getUUID(),
15338
15381
  'Request-Id': Date.now().toString(),
15339
15382
  });
@@ -15378,7 +15421,6 @@ class RCMediaService {
15378
15421
  }
15379
15422
  }
15380
15423
  detectorMediaSever() {
15381
- var _a, _b;
15382
15424
  const naviInfo = this._context.getNaviInfo();
15383
15425
  RCMediaService.jwtToken = (naviInfo === null || naviInfo === void 0 ? void 0 : naviInfo.jwt) || '';
15384
15426
  // 如果有传入自定义 MediaServer 地址不走探测逻辑
@@ -15388,7 +15430,6 @@ class RCMediaService {
15388
15430
  const nowDate = Date.now();
15389
15431
  const isValid = (RCMediaService.detectValidMinute + RCMediaService.detectorTime > nowDate);
15390
15432
  RCMediaService.isDetector = isValid;
15391
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `set msInDetector => ${JSON.stringify(RCMediaService.msInDetector)}`);
15392
15433
  if (!isValid && naviInfo && notEmptyObject(naviInfo)) {
15393
15434
  this._msList = [];
15394
15435
  this._getDetectorUrls(naviInfo);
@@ -15400,7 +15441,6 @@ class RCMediaService {
15400
15441
  * 拿不到等 IM 链接成功后,再回调中调用开始嗅探
15401
15442
  */
15402
15443
  _getDetectorUrls(naviInfo) {
15403
- var _a, _b, _c, _d;
15404
15444
  return __awaiter(this, void 0, void 0, function* () {
15405
15445
  if (RCMediaService.isDetector) {
15406
15446
  return;
@@ -15415,8 +15455,6 @@ class RCMediaService {
15415
15455
  RCMediaService.msInDetector = fastMediaUrl || [];
15416
15456
  RCMediaService.detectorTime = Date.now();
15417
15457
  RCMediaService.detectValidMinute = clientDetectMinute * 60 * 1000;
15418
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `RCMediaService detectorTime => ${RCMediaService.detectorTime}`);
15419
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `RCMediaService detectValidMinute => ${RCMediaService.detectValidMinute}`);
15420
15458
  });
15421
15459
  }
15422
15460
  getNaviMS() {
@@ -15434,20 +15472,18 @@ class RCMediaService {
15434
15472
  * ping1 :ping 结果返回最快值
15435
15473
  */
15436
15474
  setMediaServiceList() {
15437
- var _a, _b, _c, _d, _e, _f, _g, _h;
15475
+ var _a, _b;
15438
15476
  let backupMsInDetector = [];
15439
15477
  let backupMsInNavi = [];
15440
15478
  if (this._clusterId) {
15441
15479
  this._clusterId = this._clusterId.replace(/^(https?:\/\/)?/, 'https://');
15442
15480
  this._msList.push(this._clusterId);
15443
15481
  }
15444
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `MediaServiceList _clusterId -> ${this._clusterId}`);
15445
15482
  if (notEmptyArray(RCMediaService.msInDetector)) {
15446
15483
  RCMediaService.msInDetector = RCMediaService.msInDetector.map((item) => item.replace(/^(https?:\/\/)?/, 'https://'));
15447
15484
  this._msList.push(RCMediaService.msInDetector[0]);
15448
15485
  backupMsInDetector = RCMediaService.msInDetector.concat().splice(1, RCMediaService.msInDetector.length - 1);
15449
15486
  }
15450
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `MediaServiceList msInDetector ->${JSON.stringify(RCMediaService.msInDetector)}`);
15451
15487
  if (this._msInNavi.length === 0) {
15452
15488
  if (this._failedMs.length === 0) {
15453
15489
  this._msInNavi.push(...parseNaviInfo(this._context.getNaviInfo()));
@@ -15457,12 +15493,11 @@ class RCMediaService {
15457
15493
  this._failedMs.length = 0;
15458
15494
  }
15459
15495
  }
15460
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `MediaServiceList _msInNavi-> ${JSON.stringify(this._msInNavi)}`);
15461
15496
  backupMsInNavi = this._msInNavi.concat().splice(1, this._msInNavi.length - 1);
15462
15497
  this._msList.push(this._msInNavi[0]);
15463
15498
  this._msList = [...this._msList, ...backupMsInDetector, ...backupMsInNavi];
15464
15499
  this._msList = [...new Set(this._msList)];
15465
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `MediaServiceList msList -> ${JSON.stringify(this._msList)}`);
15500
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_MEDIA_SERVICE_MSLIST_CHANGE_O, `MediaServiceList msList -> ${JSON.stringify(this._msList)}`);
15466
15501
  return this._msList;
15467
15502
  }
15468
15503
  /**
@@ -15541,7 +15576,6 @@ class RCMediaService {
15541
15576
  (_g = (_f = this._context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.info(RCLoggerTag.L_MEDIA_SERVICE_REQUEST_R, JSON.stringify({
15542
15577
  status: RCLoggerStatus.SUCCESSED,
15543
15578
  url,
15544
- reqId,
15545
15579
  }), traceId);
15546
15580
  return { code: RCRTCCode.SUCCESS, data: resp };
15547
15581
  }
@@ -15648,13 +15682,13 @@ class RCMediaService {
15648
15682
  /**
15649
15683
  * 房间内观众获取 CDN 资源信息、拉流地址
15650
15684
  */
15651
- getCDNResourceInfo(headers, url) {
15685
+ getCDNResourceInfo(headers, url, traceId) {
15652
15686
  var _a, _b, _c, _d, _e, _f;
15653
15687
  return __awaiter(this, void 0, void 0, function* () {
15654
15688
  const commonHeader = getCommonHeader();
15655
15689
  const mergeHeaders = Object.assign(Object.assign({}, commonHeader), headers);
15656
15690
  const reqId = commonHeader['Request-Id'];
15657
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T, `request -> Request-Id: ${reqId}, url: ${url}, headers: ${JSON.stringify(mergeHeaders)}`);
15691
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T, `Request-Id: ${reqId}, url: ${url}`, traceId);
15658
15692
  const { status, data: resStr } = yield this._runtime.httpReq({
15659
15693
  url,
15660
15694
  headers: mergeHeaders,
@@ -15664,15 +15698,14 @@ class RCMediaService {
15664
15698
  const data = JSON.parse(resStr);
15665
15699
  (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R, JSON.stringify({
15666
15700
  status: RCLoggerStatus.SUCCESSED,
15667
- reqId: commonHeader['Request-Id'],
15668
- }));
15701
+ cdnPlayerUrl: data === null || data === void 0 ? void 0 : data.data.pull_url,
15702
+ }), traceId);
15669
15703
  return { code: data.resultCode, res: data };
15670
15704
  }
15671
15705
  (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R, JSON.stringify({
15672
15706
  status: RCLoggerStatus.FAILED,
15673
15707
  code: RCRTCCode.REQUEST_FAILED,
15674
- msg: `request error -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}, url: ${url}`,
15675
- }));
15708
+ }), traceId);
15676
15709
  return { code: RCRTCCode.REQUEST_FAILED };
15677
15710
  });
15678
15711
  }
@@ -16863,11 +16896,6 @@ class ASdpBuilder {
16863
16896
  * @param {IRCTrackBitrate} bitrate - 以 kbps 为单位的比特率。
16864
16897
  */
16865
16898
  setAudiosBitrate(bitrate) {
16866
- var _a;
16867
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16868
- bitrate,
16869
- msg: 'SDP setAudiosBitrate',
16870
- }));
16871
16899
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => this.setAudioItemBitrate(sdpAudioBlock, bitrate));
16872
16900
  return this;
16873
16901
  }
@@ -16877,12 +16905,6 @@ class ASdpBuilder {
16877
16905
  * @param {string} streamId - 音频流的媒体流 ID。
16878
16906
  */
16879
16907
  setAudioBitrateWithStreamId(bitrate, streamId) {
16880
- var _a;
16881
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16882
- bitrate,
16883
- streamId,
16884
- msg: 'SDP setAudioBitrateWithStreamId',
16885
- }));
16886
16908
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16887
16909
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16888
16910
  // 判断 msid 是否存在
@@ -16899,12 +16921,6 @@ class ASdpBuilder {
16899
16921
  * @param {string} mid - 音频流的媒体流 ID。
16900
16922
  */
16901
16923
  setAudioBitrateWithMid(bitrate, mid) {
16902
- var _a;
16903
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16904
- bitrate,
16905
- mid,
16906
- msg: 'SDP setAudioBitrateWithMid',
16907
- }));
16908
16924
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16909
16925
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
16910
16926
  // 判断 msid 是否存在
@@ -16953,11 +16969,6 @@ class ASdpBuilder {
16953
16969
  * @param bitrate
16954
16970
  */
16955
16971
  setVideosBitrate(bitrate) {
16956
- var _a;
16957
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16958
- bitrate,
16959
- msg: 'SDP setVideosBitrate',
16960
- }));
16961
16972
  // 找到 profile-level-id 行在后面添加 ;x-google--bitrate ;x-google--bitrate=
16962
16973
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => this.setVideoItemBitrate(sdpVideoBlock, bitrate));
16963
16974
  return this;
@@ -16968,12 +16979,6 @@ class ASdpBuilder {
16968
16979
  * @param {string} streamId - 媒体流 ID。
16969
16980
  */
16970
16981
  setVideoBitrateWithStreamId(bitrate, streamId) {
16971
- var _a;
16972
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16973
- bitrate,
16974
- streamId,
16975
- msg: 'SDP setVideoBitrateWithStreamId',
16976
- }));
16977
16982
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
16978
16983
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16979
16984
  if (testStreamId.test(sdpVideoBlock)) {
@@ -16989,12 +16994,6 @@ class ASdpBuilder {
16989
16994
  * @param {string} streamId - 媒体流 ID。
16990
16995
  */
16991
16996
  setVideoBitrateWithMid(bitrate, mid) {
16992
- var _a;
16993
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16994
- bitrate,
16995
- mid,
16996
- msg: 'SDP setVideoBitrateWithMid',
16997
- }));
16998
16997
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
16999
16998
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
17000
16999
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17241,7 +17240,7 @@ class PlanBSdpBuilder extends ASdpBuilder {
17241
17240
  */
17242
17241
  setAudioBitrateWithStreamId(bitrate, streamId) {
17243
17242
  var _a;
17244
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'plan-b not support set Audio Bitrate With Stream Id');
17243
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_FUNCTION_IS_UNAVAILABLE, 'plan-b not support set Audio Bitrate With Stream Id');
17245
17244
  return this;
17246
17245
  }
17247
17246
  /**
@@ -17249,7 +17248,7 @@ class PlanBSdpBuilder extends ASdpBuilder {
17249
17248
  */
17250
17249
  setVideoBitrateWithStreamId(bitrate, streamId) {
17251
17250
  var _a;
17252
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'plan-b not support set Video Bitrate With Stream Id');
17251
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_FUNCTION_IS_UNAVAILABLE, 'plan-b not support set Video Bitrate With Stream Id');
17253
17252
  return this;
17254
17253
  }
17255
17254
  }
@@ -17588,7 +17587,7 @@ class UnifiedPlanStrategy extends ASdpStrategy {
17588
17587
  }
17589
17588
  setBitrate(max, min, start) {
17590
17589
  var _a;
17591
- (_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`');
17590
+ (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_FUNCTION_IS_UNAVAILABLE, 'the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`');
17592
17591
  }
17593
17592
  /**
17594
17593
  * 该函数用于向对等连接添加本地轨道
@@ -18153,16 +18152,12 @@ class RCRTCPeerConnection extends EventEmitter {
18153
18152
  return this._sdpStrategy.getOutboundVideoInfo();
18154
18153
  }
18155
18154
  _onLocalTrackMuted(track, resolve) {
18156
- var _a;
18157
18155
  // 修改已发布的小流状态
18158
18156
  const tinyTrack = this.getLocalTrack(`${track.getTrackId()}_tiny`);
18159
18157
  if (tinyTrack) {
18160
18158
  tinyTrack.__innerGetMediaStreamTrack().enabled = !track.isLocalMuted();
18161
18159
  }
18162
18160
  this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, track, resolve);
18163
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O, JSON.stringify({
18164
- trackId: track.getTrackId(),
18165
- }));
18166
18161
  }
18167
18162
  _onLocalTrackDestroied(track) {
18168
18163
  this.emit(RCLocalTrack.__INNER_EVENT_DESTROY__, track);
@@ -18341,7 +18336,7 @@ class RCRTCPeerConnection extends EventEmitter {
18341
18336
  * 优化 300 人大会议室 https://rc-jira.rongcloud.net/browse/BEEM-289
18342
18337
  * Mac 端卡顿严重, RTCLib 房间超出 32 路流时,不再做北极星质量数据上报,仅取音量数据,以保持 Beem 声音激励功能可用
18343
18338
  */
18344
- if (!((_a = this === null || this === void 0 ? void 0 : this._initOptions) === null || _a === void 0 ? void 0 : _a.polarisThrottle) && formatData.receivers.length + formatData.senders.length > this.senderAndReciveSize) {
18339
+ if (((_a = this === null || this === void 0 ? void 0 : this._initOptions) === null || _a === void 0 ? void 0 : _a.polarisThrottle) && formatData.receivers.length + formatData.senders.length > this.senderAndReciveSize) {
18345
18340
  return true;
18346
18341
  }
18347
18342
  if (formatData.senders.length || formatData.receivers.length) {
@@ -18689,7 +18684,7 @@ class PolarisReporter {
18689
18684
  * 加入房间
18690
18685
  */
18691
18686
  sendR1() {
18692
- const rtcVersion = "5.6.3-alpha.2";
18687
+ const rtcVersion = "5.6.3-alpha.5";
18693
18688
  const imVersion = this._context.getCoreVersion();
18694
18689
  const platform = 'web';
18695
18690
  const pcName = navigator.platform;
@@ -18839,7 +18834,7 @@ class PolarisHttpReporter {
18839
18834
  _formatR1Data() {
18840
18835
  return {
18841
18836
  joinTime: this._context.userJoinTime || 0,
18842
- rtcVersion: "5.6.3-alpha.2",
18837
+ rtcVersion: "5.6.3-alpha.5",
18843
18838
  imVersion: this._context.getCoreVersion(),
18844
18839
  platform: 'web',
18845
18840
  device: navigator.platform,
@@ -19108,7 +19103,11 @@ class RCRTCPeerCManager {
19108
19103
  /**
19109
19104
  * context
19110
19105
  */
19111
- _initOptions) {
19106
+ _initOptions,
19107
+ /**
19108
+ * 是否是观众
19109
+ */
19110
+ _isAudience) {
19112
19111
  this._useMutilPeerC = _useMutilPeerC;
19113
19112
  this._roomId = _roomId;
19114
19113
  this._reTryExchange = _reTryExchange;
@@ -19116,6 +19115,7 @@ class RCRTCPeerCManager {
19116
19115
  this._polarisReport = _polarisReport;
19117
19116
  this._isRoomAudience = _isRoomAudience;
19118
19117
  this._initOptions = _initOptions;
19118
+ this._isAudience = _isAudience;
19119
19119
  // private _reportListener: {[key: string]: IRCRTCReportListener | null} = {}
19120
19120
  /**
19121
19121
  * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
@@ -19129,6 +19129,12 @@ class RCRTCPeerCManager {
19129
19129
  * 根据 track 判断是否为上行
19130
19130
  */
19131
19131
  _isPub(tracks) {
19132
+ if (this._isAudience) {
19133
+ return false;
19134
+ }
19135
+ if (!this._useMutilPeerC) {
19136
+ return true;
19137
+ }
19132
19138
  // 取消订阅时,剩余订阅资源为空,tracks 会为 []
19133
19139
  if (!tracks.length) {
19134
19140
  return false;
@@ -19202,15 +19208,12 @@ class RCRTCPeerCManager {
19202
19208
  const peerCArr = [];
19203
19209
  // isPublish 判断tracks中的资源是否为本地发布资源 从而区分是订阅与发布
19204
19210
  const isPub = this._isPub(tracks);
19205
- // 不使用多 peerConnection
19206
- if (!this._useMutilPeerC) {
19207
- const pcName = this._genPCName(true);
19208
- peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19209
- return peerCArr;
19210
- }
19211
- // 多 peerConnction 订阅
19212
- if (this._useMutilPeerC && !isPub) {
19213
- const pcName = this._genPCName(false);
19211
+ /**
19212
+ * 不使用多 peerConnection 或
19213
+ * peerConnction 订阅
19214
+ */
19215
+ if (!this._useMutilPeerC || (this._useMutilPeerC && !isPub)) {
19216
+ const pcName = this._genPCName(isPub);
19214
19217
  peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19215
19218
  return peerCArr;
19216
19219
  }
@@ -19288,24 +19291,84 @@ class RCRTCPeerCManager {
19288
19291
  /* 定义命令类型 */
19289
19292
  var RCCommandKind;
19290
19293
  (function (RCCommandKind) {
19294
+ /**
19295
+ * 发信令取消加入房间之前的资源
19296
+ */
19297
+ RCCommandKind["UNPUBLISH_PREV"] = "UnpublishPrevCommand";
19298
+ /**
19299
+ * 拉取房间内数据
19300
+ */
19301
+ RCCommandKind["PULL_RTCROOM_STATUS"] = "PullRTCRoomStatusCommand";
19302
+ /**
19303
+ * 加入房间
19304
+ */
19305
+ RCCommandKind["JOINROOM"] = "JoinRoomCommand";
19306
+ /**
19307
+ * 解析远端资源数据
19308
+ */
19309
+ RCCommandKind["PARSE_REMOTERES"] = "ParseRemoteResCommand";
19310
+ /**
19311
+ * 解析远端人员数据
19312
+ */
19313
+ RCCommandKind["PARSE_USERSTATE"] = "ParseUserStateCommand";
19314
+ /**
19315
+ * 本端 track 禁用/启用
19316
+ */
19317
+ RCCommandKind["LOCAL_TRACK_MUTE"] = "LocalTrackMuteCommand";
19318
+ /**
19319
+ * 发布资源
19320
+ */
19321
+ RCCommandKind["PUBLISH"] = "PublishCommand";
19322
+ /**
19323
+ * 恢复 ice 连接
19324
+ */
19325
+ RCCommandKind["RETRY_EXCHANGE"] = "RetryExchangeCommand";
19326
+ /**
19327
+ * 取消发布
19328
+ */
19329
+ RCCommandKind["UNPUBLISH"] = "UnpublishCommand";
19330
+ /**
19331
+ * 订阅
19332
+ */
19333
+ RCCommandKind["SUBSCRIBE"] = "SubscribeCommand";
19334
+ /**
19335
+ * 异步订阅、取消订阅、全量订阅
19336
+ */
19337
+ RCCommandKind["ASYNC_COMMAND"] = "AsyncCommand";
19338
+ /**
19339
+ * 取消订阅
19340
+ */
19341
+ RCCommandKind["UNSUBSCRIBE"] = "UnsubscribeCommand";
19342
+ /**
19343
+ * 全量订阅
19344
+ */
19345
+ RCCommandKind["UPDATE_SUBSCRIBE_LIST"] = "UpdateSubscribeListCommand";
19346
+ /**
19347
+ * im 重连房间内人员、资源处理
19348
+ */
19349
+ RCCommandKind["ON_SIGNAL_RECONNECTED"] = "OnSignalReconnectedCommand";
19350
+ /**
19351
+ * 退出副房间
19352
+ */
19353
+ RCCommandKind["LEAVE_OTHER_ROOM"] = "LeaveOtherRoomCommand";
19354
+ /**
19355
+ * 主播、观众切换身份
19356
+ */
19357
+ RCCommandKind["RTC_IDENTITY_CHANGE"] = "RTCIdentityChangeCommand";
19358
+ /**
19359
+ * 开/关 CDN
19360
+ */
19361
+ RCCommandKind["ENABLE_INNER_CDN"] = "EnableInnerCDNCommand";
19362
+ /**
19363
+ * 携带副房间信息重新发 /exchange 请求
19364
+ */
19365
+ RCCommandKind["EXCHANGE_WITH_PUSH_OTHER_ROOM"] = "ExchangeWithPushOtherRoomCommand";
19366
+ /**
19367
+ * 发送 MCU 请求
19368
+ */
19369
+ RCCommandKind["MCUCONFIG_FLUSH"] = "MCUConfigFlushCommand";
19291
19370
  // 未定议的
19292
- RCCommandKind[RCCommandKind["Unknow"] = 0] = "Unknow";
19293
- // 发布资源
19294
- RCCommandKind[RCCommandKind["Publish"] = 1] = "Publish";
19295
- // 取消发布资源
19296
- RCCommandKind[RCCommandKind["UnPublish"] = 2] = "UnPublish";
19297
- // 加入房间
19298
- RCCommandKind[RCCommandKind["JoinRoom"] = 3] = "JoinRoom";
19299
- // 离开房间
19300
- RCCommandKind[RCCommandKind["LeaveRoom"] = 4] = "LeaveRoom";
19301
- // 更新订阅列表
19302
- RCCommandKind[RCCommandKind["UpdateSubscribeTask"] = 5] = "UpdateSubscribeTask";
19303
- // 资源订阅
19304
- RCCommandKind[RCCommandKind["SubscribedTask"] = 6] = "SubscribedTask";
19305
- // 取消资源订阅
19306
- RCCommandKind[RCCommandKind["UnSubscribedTask"] = 7] = "UnSubscribedTask";
19307
- // 异步事件命令
19308
- RCCommandKind["AsyncCommand"] = "AsyncCommand";
19371
+ RCCommandKind["UNKNOWN"] = "Unknown";
19309
19372
  })(RCCommandKind || (RCCommandKind = {}));
19310
19373
 
19311
19374
  // 描述 链表 中的位置
@@ -19341,7 +19404,7 @@ class BaseCommand {
19341
19404
  * @returns 命令的种类。
19342
19405
  */
19343
19406
  get kind() {
19344
- return RCCommandKind.Unknow;
19407
+ return RCCommandKind.UNKNOWN;
19345
19408
  }
19346
19409
  }
19347
19410
 
@@ -19351,7 +19414,7 @@ class AsyncCommand extends BaseCommand {
19351
19414
  this.state = state;
19352
19415
  }
19353
19416
  get kind() {
19354
- return RCCommandKind.AsyncCommand;
19417
+ return RCCommandKind.ASYNC_COMMAND;
19355
19418
  }
19356
19419
  /**
19357
19420
  * `public setState(状态:RCLinkedListPoint):void`
@@ -19638,7 +19701,7 @@ class Store extends ReadableStore {
19638
19701
  }
19639
19702
 
19640
19703
  class BaseInvoker {
19641
- constructor(
19704
+ constructor(context,
19642
19705
  /**
19643
19706
  * 内存数据管理实例
19644
19707
  */
@@ -19647,6 +19710,7 @@ class BaseInvoker {
19647
19710
  * 命令终止时返回的错误码定义
19648
19711
  */
19649
19712
  abortCode) {
19713
+ this.context = context;
19650
19714
  this._store = _store;
19651
19715
  this.abortCode = abortCode;
19652
19716
  // command 队列
@@ -19660,6 +19724,7 @@ class BaseInvoker {
19660
19724
  this._execute();
19661
19725
  }
19662
19726
  _execute() {
19727
+ var _a, _b, _c, _d;
19663
19728
  return __awaiter(this, void 0, void 0, function* () {
19664
19729
  if (this._isDestroyed || this._busy || this._queue.length === 0) {
19665
19730
  return;
@@ -19667,23 +19732,37 @@ class BaseInvoker {
19667
19732
  this._busy = true;
19668
19733
  const { command, resolve, reject } = this._queue.shift();
19669
19734
  let res;
19735
+ const traceId = (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
19670
19736
  try {
19671
19737
  /**
19672
19738
  * 说明:由于是先弹出 再执行 Command,所以不存在 在队列中正在执行的任务
19673
19739
  */
19740
+ (_b = this.context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_INVOKER_EXECUTE_T, `commandKind: ${command.kind}, commandLength: ${this._queue.length}`, traceId);
19674
19741
  res = yield command.execute(this._store, this);
19675
19742
  }
19676
19743
  catch (error) {
19744
+ (_c = this.context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_INVOKER_EXECUTE_R, JSON.stringify({
19745
+ error,
19746
+ status: RCLoggerStatus.FAILED,
19747
+ commandKind: command.kind,
19748
+ }), traceId);
19677
19749
  reject(error);
19678
19750
  this._next();
19679
19751
  return;
19680
19752
  }
19753
+ (_d = this.context.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_INVOKER_EXECUTE_R, `status: ${RCLoggerStatus.SUCCESSED}, commandKind: ${command.kind}`, traceId);
19681
19754
  resolve(res);
19682
19755
  this._next();
19683
19756
  });
19684
19757
  }
19685
19758
  push(command) {
19686
19759
  return new Promise((resolve, reject) => {
19760
+ var _a;
19761
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_PUSH_O, JSON.stringify({
19762
+ isDestroyed: this._isDestroyed,
19763
+ commandKind: command.kind,
19764
+ commandLength: this._queue.length,
19765
+ }));
19687
19766
  // 房间已销毁
19688
19767
  if (this._isDestroyed) {
19689
19768
  reject({
@@ -19696,7 +19775,7 @@ class BaseInvoker {
19696
19775
  // 所以只要队列中存在中 Subscribed 或 UnSubscribed 则可以只执行最后一个
19697
19776
  const { kind } = command;
19698
19777
  if (this._queue.length > 0) {
19699
- if (kind === RCCommandKind.AsyncCommand) {
19778
+ if (kind === RCCommandKind.ASYNC_COMMAND) {
19700
19779
  // 重写 resolve, reject 并将使用新回调的进行包裹它
19701
19780
  ({ command, resolve, reject } = this.commandOffset(command, resolve, reject));
19702
19781
  }
@@ -19725,7 +19804,7 @@ class BaseInvoker {
19725
19804
  });
19726
19805
  }
19727
19806
  /**
19728
- * 查找出 RCCommandKind.AsyncCommand 类型的 Command,并将其从队列中删除
19807
+ * 查找出 RCCommandKind.ASYNC_COMMAND 类型的 Command,并将其从队列中删除
19729
19808
  * 并使用最新的一次 Command 接管它的 resolve & reject
19730
19809
  * @param resolve
19731
19810
  * @param reject
@@ -19735,11 +19814,14 @@ class BaseInvoker {
19735
19814
  // 因为一次只可以插入一个 Command 所以查找 只需要在队列最后查找一个即可
19736
19815
  const index = this._queue.length - 1;
19737
19816
  const item = this._queue[index];
19738
- const hashSubscribTask = item.command.kind === RCCommandKind.AsyncCommand;
19817
+ const hashSubscribTask = item.command.kind === RCCommandKind.ASYNC_COMMAND;
19739
19818
  // 如果队列中不存在则直接返回
19740
19819
  if (!hashSubscribTask) {
19741
19820
  return { command, resolve, reject };
19742
19821
  }
19822
+ /**
19823
+ * 倒数第二个任务的 state 改为 middle,最后一个任务的 state 设为 tail
19824
+ */
19743
19825
  const [task] = this._queue.splice(index, 1);
19744
19826
  if (task.command instanceof AsyncCommand) {
19745
19827
  task.command.setState(RCLinkedListPoint.MIDDLE);
@@ -19769,9 +19851,17 @@ class BaseInvoker {
19769
19851
  };
19770
19852
  }
19771
19853
  isDestroyed() {
19854
+ var _a;
19855
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_DESTROY_O, JSON.stringify({
19856
+ isDestroyed: this._isDestroyed,
19857
+ }));
19772
19858
  return this._isDestroyed;
19773
19859
  }
19774
19860
  destroy() {
19861
+ var _a;
19862
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_DESTROY_O, JSON.stringify({
19863
+ isDestroyed: this._isDestroyed,
19864
+ }));
19775
19865
  if (this._isDestroyed) {
19776
19866
  return;
19777
19867
  }
@@ -19788,7 +19878,7 @@ class BaseInvoker {
19788
19878
  */
19789
19879
  class Invoker extends BaseInvoker {
19790
19880
  constructor(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom) {
19791
- super(new Store(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom), RCRTCCode.ROOM_HAS_BEEN_DESTROYED);
19881
+ super(context, new Store(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom), RCRTCCode.ROOM_HAS_BEEN_DESTROYED);
19792
19882
  }
19793
19883
  /**
19794
19884
  * 获取 store 存储实例,返回值类型 `ReadableStore`,避免非 command 定义中修改内存
@@ -19808,6 +19898,9 @@ class Invoker extends BaseInvoker {
19808
19898
  * 该步骤没有必要与 MediaServer 的交互,因后续资源变更交互为全量交互
19809
19899
  */
19810
19900
  class UnpublishPrevCommand extends BaseCommand {
19901
+ get kind() {
19902
+ return RCCommandKind.UNPUBLISH_PREV;
19903
+ }
19811
19904
  execute(store) {
19812
19905
  var _a, _b, _c, _d, _e, _f, _g, _h;
19813
19906
  return __awaiter(this, void 0, void 0, function* () {
@@ -19820,7 +19913,7 @@ class UnpublishPrevCommand extends BaseCommand {
19820
19913
  resource: tmpRes,
19821
19914
  }), traceId);
19822
19915
  // 添加请求队列并等待结果
19823
- const code = yield store.context.setRTCTotalRes(store.roomId, buildPlusMessage(RCRTCMessageType.UNPUBLISH, tmpRes), buildTotalURIMessageContent([]), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent([]));
19916
+ const code = yield store.context.setRTCTotalRes(store.roomId, [buildPlusMessage(RCRTCMessageType.UNPUBLISH, tmpRes)], buildTotalURIMessageContent([]), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent([]));
19824
19917
  if (code !== ErrorCode.SUCCESS) {
19825
19918
  (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_UNPUBLISH_PREV_COMMAND_R, JSON.stringify({
19826
19919
  status: RCLoggerStatus.FAILED,
@@ -19887,7 +19980,7 @@ class JoinRoomCommand extends BaseCommand {
19887
19980
  this.traceId = traceId;
19888
19981
  }
19889
19982
  get kind() {
19890
- return RCCommandKind.JoinRoom;
19983
+ return RCCommandKind.JOINROOM;
19891
19984
  }
19892
19985
  execute(store, invoker) {
19893
19986
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
@@ -20082,6 +20175,9 @@ class UpdateSubscribeListCommand extends BaseCommand {
20082
20175
  this.forceReq = forceReq;
20083
20176
  this.traceId = traceId;
20084
20177
  }
20178
+ get kind() {
20179
+ return RCCommandKind.UPDATE_SUBSCRIBE_LIST;
20180
+ }
20085
20181
  execute(store, invoker) {
20086
20182
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
20087
20183
  return __awaiter(this, void 0, void 0, function* () {
@@ -20226,6 +20322,9 @@ class UnsubscribeCommand extends BaseCommand {
20226
20322
  this.subhook = subhook;
20227
20323
  this.traceId = traceId;
20228
20324
  }
20325
+ get kind() {
20326
+ return RCCommandKind.UNSUBSCRIBE;
20327
+ }
20229
20328
  execute(store, invoker) {
20230
20329
  var _a, _b, _c, _d;
20231
20330
  return __awaiter(this, void 0, void 0, function* () {
@@ -20315,14 +20414,18 @@ function createExchangeParams(subscribeList, iceRestart, pc, store) {
20315
20414
  * 扩散 cdn_uris 资源
20316
20415
  */
20317
20416
  function spreadCDNInfo(context, roomId, CDNUris) {
20318
- var _a, _b;
20417
+ var _a, _b, _c, _d;
20319
20418
  return __awaiter(this, void 0, void 0, function* () {
20419
+ const traceId = (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20420
+ (_b = context === null || context === void 0 ? void 0 : context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_T, JSON.stringify({
20421
+ CDNUris,
20422
+ }), traceId);
20320
20423
  const code = yield context.setRTCCDNUris(roomId, RCRTCMessageType.TOTAL_CONTENT_RESOURCE, JSON.stringify([CDNUris]));
20321
20424
  if (code !== ErrorCode.SUCCESS) {
20322
- (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `spreadCDNInfo failed -> code: ${code}`);
20425
+ (_c = context === null || context === void 0 ? void 0 : context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_R, `status: ${RCLoggerStatus.FAILED}, code: ${code}`, traceId);
20323
20426
  return { code: RCRTCCode.SIGNAL_ERROR };
20324
20427
  }
20325
- (_b = context === null || context === void 0 ? void 0 : context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'spreadCDNInfo succeed');
20428
+ (_d = context === null || context === void 0 ? void 0 : context.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
20326
20429
  return { code: RCRTCCode.SUCCESS };
20327
20430
  });
20328
20431
  }
@@ -20330,14 +20433,16 @@ function spreadCDNInfo(context, roomId, CDNUris) {
20330
20433
  * 给房间设置 CDN 数据
20331
20434
  */
20332
20435
  function setRoomCDNInfo(context, roomId, CDNUris) {
20333
- var _a, _b;
20436
+ var _a, _b, _c, _d;
20334
20437
  return __awaiter(this, void 0, void 0, function* () {
20438
+ const traceId = (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20439
+ (_b = context === null || context === void 0 ? void 0 : context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T, `CDNUris: ${CDNUris}`, traceId);
20335
20440
  const code = yield context.setRTCData(roomId, 'cdn_uris', JSON.stringify([CDNUris]), true, RTCApiType.ROOM);
20336
20441
  if (code !== ErrorCode.SUCCESS) {
20337
- (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `setRoomCDNInfo failed -> code: ${code}`);
20442
+ (_c = context === null || context === void 0 ? void 0 : context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R, `status: ${RCLoggerStatus.FAILED}, code: ${code}`, traceId);
20338
20443
  return { code: RCRTCCode.SIGNAL_ERROR };
20339
20444
  }
20340
- (_b = context === null || context === void 0 ? void 0 : context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'setRoomCDNInfo succeed');
20445
+ (_d = context === null || context === void 0 ? void 0 : context.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
20341
20446
  return { code: RCRTCCode.SUCCESS };
20342
20447
  });
20343
20448
  }
@@ -20345,34 +20450,16 @@ function setRoomCDNInfo(context, roomId, CDNUris) {
20345
20450
  * 开启、停用 CDN 推资源后发信令
20346
20451
  */
20347
20452
  function sendCDNInfoSignal(store) {
20348
- var _a, _b, _c, _d, _e, _f;
20349
20453
  return __awaiter(this, void 0, void 0, function* () {
20350
20454
  const { context } = store;
20351
20455
  const { roomId } = store;
20352
20456
  // eslint-disable-next-line
20353
20457
  const CDNUris = Object.assign({}, store.getCDNUris(), { enableInnerCDN: store.getCDNEnable() });
20354
- (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_T, JSON.stringify({
20355
- roomId,
20356
- CDNUris,
20357
- }));
20358
20458
  const resCodeArr = yield Promise.all([
20359
20459
  spreadCDNInfo(context, roomId, CDNUris),
20360
20460
  setRoomCDNInfo(context, roomId, CDNUris),
20361
20461
  ]);
20362
20462
  const isSuccess = resCodeArr.every((item) => item.code === RCRTCCode.SUCCESS);
20363
- if (isSuccess) {
20364
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_R, JSON.stringify({
20365
- status: RCLoggerStatus.SUCCESSED,
20366
- CDNUris,
20367
- }));
20368
- }
20369
- else {
20370
- (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_ROOM_SPREAD_CDN_INFO_R, JSON.stringify({
20371
- status: RCLoggerStatus.FAILED,
20372
- code: RCRTCCode.SIGNAL_ERROR,
20373
- msg: 'signal error',
20374
- }));
20375
- }
20376
20463
  return isSuccess ? { code: RCRTCCode.SUCCESS } : { code: RCRTCCode.SIGNAL_ERROR };
20377
20464
  });
20378
20465
  }
@@ -20613,6 +20700,9 @@ class ParseUserStateCommand extends BaseCommand {
20613
20700
  this.subhook = subhook;
20614
20701
  this.traceId = traceId;
20615
20702
  }
20703
+ get kind() {
20704
+ return RCCommandKind.PARSE_USERSTATE;
20705
+ }
20616
20706
  get priority() {
20617
20707
  return CommandPriority.NORMAL;
20618
20708
  }
@@ -20707,6 +20797,9 @@ class ParseRemoteResCommand extends BaseCommand {
20707
20797
  this.callback = callback;
20708
20798
  this.traceId = traceId;
20709
20799
  }
20800
+ get kind() {
20801
+ return RCCommandKind.PARSE_REMOTERES;
20802
+ }
20710
20803
  get priority() {
20711
20804
  return CommandPriority.NORMAL;
20712
20805
  }
@@ -20832,14 +20925,18 @@ class ParseRemoteResCommand extends BaseCommand {
20832
20925
  }
20833
20926
 
20834
20927
  class SubscribeCommand extends BaseCommand {
20835
- constructor(tracks, subhook, forceReq) {
20928
+ constructor(tracks, subhook, forceReq, traceId) {
20836
20929
  super();
20837
20930
  this.tracks = tracks;
20838
20931
  this.subhook = subhook;
20839
20932
  this.forceReq = forceReq;
20933
+ this.traceId = traceId;
20934
+ }
20935
+ get kind() {
20936
+ return RCCommandKind.SUBSCRIBE;
20840
20937
  }
20841
20938
  execute(store, invoker) {
20842
- var _a, _b, _c, _d, _e, _f, _g, _h;
20939
+ var _a, _b, _c, _d, _e, _f;
20843
20940
  return __awaiter(this, void 0, void 0, function* () {
20844
20941
  // 取消房间状态检查,房间销毁后,invoker 应直接清空,避免后续执行动作
20845
20942
  // const roomStatusCode = this._assertRoomDestroyed()
@@ -20848,17 +20945,16 @@ class SubscribeCommand extends BaseCommand {
20848
20945
  // return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED }
20849
20946
  // }
20850
20947
  const { tracks, forceReq } = this;
20851
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
20852
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_T, JSON.stringify({
20948
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_T, JSON.stringify({
20853
20949
  trackIds: tracks.map(getTrackIdFromAttr),
20854
20950
  forceReq,
20855
- }), traceId);
20951
+ }), this.traceId);
20856
20952
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
20857
- (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
20953
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
20858
20954
  status: RCLoggerStatus.FAILED,
20859
20955
  code: RCRTCCode.PARAMS_ERROR,
20860
20956
  msg: 'params error -> tracks',
20861
- }), traceId);
20957
+ }), this.traceId);
20862
20958
  return { code: RCRTCCode.PARAMS_ERROR };
20863
20959
  }
20864
20960
  const crtSubList = store.getSubscribedList().map((item) => (Object.assign({}, item)));
@@ -20881,16 +20977,16 @@ class SubscribeCommand extends BaseCommand {
20881
20977
  changed = true;
20882
20978
  });
20883
20979
  if (!changed && !forceReq) {
20884
- (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.warn(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
20980
+ (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.warn(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
20885
20981
  status: RCLoggerStatus.SUCCESSED,
20886
20982
  msg: 'repeat subscribe',
20887
- }), traceId);
20983
+ }), this.traceId);
20888
20984
  return { code: RCRTCCode.SUCCESS };
20889
20985
  }
20890
20986
  // 北极星上报
20891
20987
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
20892
20988
  recordSubscribeCommand(true);
20893
- return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, traceId).execute(store, invoker);
20989
+ return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, this.traceId).execute(store, invoker);
20894
20990
  });
20895
20991
  }
20896
20992
  }
@@ -20957,7 +21053,7 @@ class PublishCommand extends BaseCommand {
20957
21053
  this._traceId = (_a = this._logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20958
21054
  }
20959
21055
  get kind() {
20960
- return RCCommandKind.Publish;
21056
+ return RCCommandKind.PUBLISH;
20961
21057
  }
20962
21058
  /**
20963
21059
  * 从 pc 移除当次发布失败的资源
@@ -21158,7 +21254,7 @@ class PublishCommand extends BaseCommand {
21158
21254
  // 通知房间成员
21159
21255
  // 连通率相关埋点-统计扩散耗时
21160
21256
  recordPublishSignalTotalData();
21161
- let errorCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList), CDNValueInfo);
21257
+ let errorCode = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.PUBLISH, plus)], buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList), CDNValueInfo);
21162
21258
  // TIPS: 通知房间成员失败,对信息进行重试操作
21163
21259
  if (errorCode !== ErrorCode.SUCCESS) {
21164
21260
  const RetrySignal = RetrySignaling.handler();
@@ -21168,7 +21264,7 @@ class PublishCommand extends BaseCommand {
21168
21264
  if ((new Date()).valueOf() - startTime > this.signalRetryTime) {
21169
21265
  return errorCode;
21170
21266
  }
21171
- const code = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21267
+ const code = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.PUBLISH, plus)], buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21172
21268
  if (code !== ErrorCode.SUCCESS) {
21173
21269
  yield RetrySignal.task(loop);
21174
21270
  }
@@ -21292,7 +21388,7 @@ class UnpublishCommand extends BaseCommand {
21292
21388
  this.unpubhook = unpubhook;
21293
21389
  }
21294
21390
  get kind() {
21295
- return RCCommandKind.UnPublish;
21391
+ return RCCommandKind.UNPUBLISH;
21296
21392
  }
21297
21393
  __unpublish(store, invoker, peerCItem, tracks) {
21298
21394
  var _a, _b, _c, _d;
@@ -21391,7 +21487,7 @@ class UnpublishCommand extends BaseCommand {
21391
21487
  const dList = publishedList.filter((item) => !unpublishList.includes(item));
21392
21488
  // 通知房间内成员
21393
21489
  recordUnpublishSignalTotalData();
21394
- const singalCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.UNPUBLISH, unpublishList), buildTotalURIMessageContent(dList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21490
+ const singalCode = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.UNPUBLISH, unpublishList)], buildTotalURIMessageContent(dList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21395
21491
  if (singalCode !== ErrorCode.SUCCESS) {
21396
21492
  reportQualityUnpublishSignalTotalData(publishedList, singalCode);
21397
21493
  (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_ABSTRACT_ROOM_UNPUBLISH_R, JSON.stringify({
@@ -21479,17 +21575,24 @@ class LocalTrackMuteCommand extends BaseCommand {
21479
21575
  this.localTrack = localTrack;
21480
21576
  this._recvSignalResultFn = _recvSignalResultFn;
21481
21577
  }
21578
+ get kind() {
21579
+ return RCCommandKind.LOCAL_TRACK_MUTE;
21580
+ }
21482
21581
  execute(store, invoker) {
21483
- var _a, _b, _c, _d;
21582
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21484
21583
  return __awaiter(this, void 0, void 0, function* () {
21485
21584
  const { localTrack } = this;
21486
21585
  const trackId = localTrack.getTrackId();
21487
21586
  const { crtUserId, roomId } = store;
21488
21587
  const enabled = !localTrack.isLocalMuted();
21588
+ const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21589
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T, JSON.stringify({
21590
+ enabled,
21591
+ trackId: this.localTrack.getTrackId(),
21592
+ }), traceId);
21489
21593
  // 本地资源,需同步房间状态
21490
21594
  const localResource = [{ resourceId: trackId, enabled }];
21491
21595
  // 计算更新后的全量资源数据
21492
- // const publishedList = this._roomResources[crtUserId] || []
21493
21596
  const publishedList = store.getResourcesByUserId(crtUserId);
21494
21597
  // 增量数据
21495
21598
  const plusList = [];
@@ -21504,23 +21607,19 @@ class LocalTrackMuteCommand extends BaseCommand {
21504
21607
  break;
21505
21608
  }
21506
21609
  }
21507
- const code = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.MODIFY, plusList), buildTotalURIMessageContent(publishedList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21610
+ const code = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.MODIFY, plusList)], buildTotalURIMessageContent(publishedList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21508
21611
  // 执行 localTrack.mute 传入的 resolve,并返回 signal 扩散的 code 码
21509
21612
  this._recvSignalResultFn(code);
21510
21613
  if (code !== ErrorCode.SUCCESS) {
21511
- (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_R, JSON.stringify({
21614
+ (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R, JSON.stringify({
21512
21615
  status: RCLoggerStatus.FAILED,
21513
21616
  code,
21514
- enabled,
21515
- trackId: this.localTrack.getTrackId(),
21516
21617
  msg: 'signal error',
21517
- }));
21618
+ }), traceId);
21518
21619
  }
21519
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_R, JSON.stringify({
21620
+ (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R, JSON.stringify({
21520
21621
  status: RCLoggerStatus.SUCCESSED,
21521
- enabled,
21522
- trackId: this.localTrack.getTrackId(),
21523
- }));
21622
+ }), traceId);
21524
21623
  });
21525
21624
  }
21526
21625
  }
@@ -21532,13 +21631,19 @@ class RetryExchangeCommand extends BaseCommand {
21532
21631
  this.isPub = isPub;
21533
21632
  this.retryHook = retryHook;
21534
21633
  }
21634
+ get kind() {
21635
+ return RCCommandKind.RETRY_EXCHANGE;
21636
+ }
21535
21637
  get priority() {
21536
21638
  return CommandPriority.HIGH;
21537
21639
  }
21538
21640
  execute(store, invoker) {
21539
- var _a, _b;
21641
+ var _a, _b, _c, _d, _e;
21540
21642
  return __awaiter(this, void 0, void 0, function* () {
21541
- (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_T);
21643
+ const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21644
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_T);
21645
+ this._store = store;
21646
+ this._userId = store.context.getCurrentId();
21542
21647
  const { pcName, isPub } = this;
21543
21648
  const { useMutilPeerC } = store;
21544
21649
  const { pc } = store.peerMgr.getPCItemByPCName(pcName);
@@ -21553,28 +21658,109 @@ class RetryExchangeCommand extends BaseCommand {
21553
21658
  // 发送 /exchange 请求
21554
21659
  const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
21555
21660
  if (resp.code !== RCRTCCode.SUCCESS) {
21556
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resp.code}, pcName: ${pcName}`, traceId);
21557
21661
  return;
21558
21662
  }
21559
21663
  const { sdp: answer, resultCode } = resp.data;
21560
21664
  if (resultCode !== RCRTCCode.SUCCESS) {
21561
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resultCode}, pcName: ${pcName}`, traceId);
21562
21665
  return;
21563
21666
  }
21564
21667
  // 请求成功,清除 ice 断线重连的定时器
21565
21668
  pc.clearReTryExchangeTimer();
21566
- yield pc.setRemoteAnswer(answer.sdp);
21669
+ const code = yield pc.setRemoteAnswer(answer.sdp);
21670
+ if (code !== RCRTCCode.SUCCESS) {
21671
+ return;
21672
+ }
21673
+ if (!this.isPub) {
21674
+ return;
21675
+ }
21676
+ /**
21677
+ * 对比 ice 恢复后,发布的资源 uri 是否有变化,
21678
+ * 有则更新内存、扩散给房间内其他人
21679
+ */
21680
+ const publishList = ((_e = resp.data) === null || _e === void 0 ? void 0 : _e.publishList) || [];
21681
+ const { plus, minus } = this._diffPublishListChange(publishList);
21682
+ if (plus.length || minus.length) {
21683
+ yield this._spreadPublishListUri(plus, minus, traceId);
21684
+ }
21685
+ });
21686
+ }
21687
+ /**
21688
+ * 对比新增、取消发布的资源
21689
+ */
21690
+ _diffPublishListChange(publishResource) {
21691
+ const oldPublisheList = this._store.getResourcesByUserId(this._userId);
21692
+ const { useMutilPeerC } = this._store;
21693
+ let newPublishList = JSON.parse(JSON.stringify(oldPublisheList));
21694
+ /**
21695
+ * 单 peerConnection 直接覆盖发布列表
21696
+ * 多 peerConnection 发布完,原 oldPublisheList 中如果有,则替换,没有则为新增
21697
+ */
21698
+ if (!useMutilPeerC) {
21699
+ newPublishList = publishResource.map((item) => (Object.assign({ tag: item.msid.split('_').pop(), state: this._store.getTrackState(getTrackId(item)) }, item)));
21700
+ }
21701
+ else {
21702
+ publishResource.forEach((pubItem) => {
21703
+ const { mediaType, msid } = pubItem;
21704
+ const index = newPublishList.findIndex((oldItem) => {
21705
+ const { mediaType: oldMediaType, msid: oldMsid } = oldItem;
21706
+ return (mediaType === oldMediaType && msid === oldMsid);
21707
+ });
21708
+ if (index === -1) {
21709
+ const newItem = Object.assign({ tag: msid.split('_').pop(), state: this._store.getTrackState(getTrackId(pubItem)) }, pubItem);
21710
+ newPublishList.push(newItem);
21711
+ }
21712
+ else {
21713
+ newPublishList[index].uri = pubItem.uri;
21714
+ }
21715
+ });
21716
+ }
21717
+ const { publishedList: plus, unpublishedList: minus } = diffPublishResources(oldPublisheList, newPublishList, true);
21718
+ this._store.setResourcesByUserId(this._userId, newPublishList);
21719
+ return { plus, minus };
21720
+ }
21721
+ /**
21722
+ * 扩散新增、取消发布资源
21723
+ * @param plus 新增发布
21724
+ * @param minus 减少发布
21725
+ */
21726
+ _spreadPublishListUri(plus, minus, traceId) {
21727
+ var _a, _b, _c;
21728
+ return __awaiter(this, void 0, void 0, function* () {
21729
+ const allPublishList = this._store.getResourcesByUserId(this._userId);
21730
+ (_a = this._store.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_T, JSON.stringify({
21731
+ plus,
21732
+ minus,
21733
+ allPublishList,
21734
+ pcName: this.pcName,
21735
+ }), traceId);
21736
+ const oldSdkSpreadMsg = [];
21737
+ minus.length && oldSdkSpreadMsg.push(buildPlusMessage(RCRTCMessageType.UNPUBLISH, minus));
21738
+ plus.length && oldSdkSpreadMsg.push(buildPlusMessage(RCRTCMessageType.PUBLISH, plus));
21739
+ const code = yield this._store.context.setRTCTotalRes(this._store.roomId, oldSdkSpreadMsg, buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21740
+ if (code === ErrorCode.SUCCESS) {
21741
+ (_b = this._store.context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
21742
+ }
21743
+ else {
21744
+ (_c = this._store.context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_R, `status: ${RCLoggerStatus.FAILED}`, traceId);
21745
+ }
21567
21746
  });
21568
21747
  }
21569
21748
  }
21570
21749
 
21571
21750
  class OnSignalReconnectedCommand extends BaseCommand {
21572
- constructor(subhook, callbacks, livingType) {
21751
+ constructor(subhook, callbacks, _retryHook, _pubhook, _signalRetryTime = PUBLISHSIGNALRETRYTIME, _pullRTCRoomStatus, livingType) {
21573
21752
  super();
21574
21753
  this.subhook = subhook;
21575
21754
  this.callbacks = callbacks;
21755
+ this._retryHook = _retryHook;
21756
+ this._pubhook = _pubhook;
21757
+ this._signalRetryTime = _signalRetryTime;
21758
+ this._pullRTCRoomStatus = _pullRTCRoomStatus;
21576
21759
  this.livingType = livingType;
21577
21760
  }
21761
+ get kind() {
21762
+ return RCCommandKind.ON_SIGNAL_RECONNECTED;
21763
+ }
21578
21764
  /**
21579
21765
  * @override
21580
21766
  */
@@ -21582,10 +21768,11 @@ class OnSignalReconnectedCommand extends BaseCommand {
21582
21768
  return CommandPriority.HIGH;
21583
21769
  }
21584
21770
  execute(store, invoker) {
21585
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
21771
+ var _a, _b, _c, _d, _e, _f;
21586
21772
  return __awaiter(this, void 0, void 0, function* () {
21587
- const { livingType } = this;
21588
21773
  const { roomId, roomMode } = store;
21774
+ this._roomId = roomId;
21775
+ this._roomMode = roomMode;
21589
21776
  const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21590
21777
  (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_T, undefined, traceId);
21591
21778
  /**
@@ -21603,9 +21790,32 @@ class OnSignalReconnectedCommand extends BaseCommand {
21603
21790
  this.callbacks.onPeerClosed && this.callbacks.onPeerClosed();
21604
21791
  return;
21605
21792
  }
21606
- const { code, data } = yield store.context.joinRTCRoom(roomId, roomMode, livingType);
21793
+ const { code: pingCode } = yield store.context.rtcPing(roomId, roomMode);
21794
+ /**
21795
+ * 不在房间内时,需重新加房间,恢复资源状态
21796
+ * ErrorCode 增加 40001 需更新 im 包,暂时转为数字对比
21797
+ * 在房间内获取房间内最新数据
21798
+ */
21799
+ if (pingCode === 40001) {
21800
+ const code = yield this._joinRoom(store, traceId, invoker);
21801
+ /**
21802
+ * 加入房间成功后,恢复和 mediaServer 服务之间的连接
21803
+ */
21804
+ if (code === ErrorCode.SUCCESS) {
21805
+ yield this._restoreMediaServer(store, invoker);
21806
+ }
21807
+ }
21808
+ else {
21809
+ yield this._pullRTCRoomStatus(this._roomId, traceId).execute(store, invoker);
21810
+ }
21811
+ });
21812
+ }
21813
+ _joinRoom(store, traceId, invoker) {
21814
+ var _a, _b, _c, _d, _e, _f, _g;
21815
+ return __awaiter(this, void 0, void 0, function* () {
21816
+ const { code, data } = yield store.context.joinRTCRoom(this._roomId, this._roomMode, this.livingType);
21607
21817
  if (code !== ErrorCode.SUCCESS) {
21608
- (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21818
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21609
21819
  status: RCLoggerStatus.FAILED,
21610
21820
  code,
21611
21821
  msg: 'im reconnect joinRTCRoom failed',
@@ -21613,7 +21823,7 @@ class OnSignalReconnectedCommand extends BaseCommand {
21613
21823
  return;
21614
21824
  }
21615
21825
  if (!data) {
21616
- (_k = (_j = store.context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_LIVING_ROOM_RECONNECTED_R, JSON.stringify({
21826
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21617
21827
  status: RCLoggerStatus.FAILED,
21618
21828
  msg: 'im reconnect joinRTCRoom, roomData is empty',
21619
21829
  }), traceId);
@@ -21622,13 +21832,38 @@ class OnSignalReconnectedCommand extends BaseCommand {
21622
21832
  /**
21623
21833
  * 处理全量的房间数据
21624
21834
  */
21625
- const CDNUris = (_l = data.roomInfo.filter((item) => item.key === 'cdn_uris')[0]) === null || _l === void 0 ? void 0 : _l.value;
21835
+ const CDNUris = (_e = data.roomInfo.filter((item) => item.key === 'cdn_uris')[0]) === null || _e === void 0 ? void 0 : _e.value;
21626
21836
  handleFullRoomData(data, store, this.callbacks, invoker, this.subhook, CDNUris, traceId);
21627
- (_o = (_m = store.context) === null || _m === void 0 ? void 0 : _m.logger) === null || _o === void 0 ? void 0 : _o.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21837
+ (_g = (_f = store.context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21628
21838
  status: RCLoggerStatus.SUCCESSED,
21629
21839
  roomData: data,
21630
21840
  }), traceId);
21631
- return { data };
21841
+ return code;
21842
+ });
21843
+ }
21844
+ _restoreMediaServer(store, invoker) {
21845
+ return __awaiter(this, void 0, void 0, function* () {
21846
+ const { useMutilPeerC } = store.peerMgr;
21847
+ const localTracks = store.getLocalTracks();
21848
+ const subedTracks = Object.values(store.getRemoteTracks()).filter((track) => !!track.isSubscribed());
21849
+ /**
21850
+ * 多 peerConnection 恢复订阅资源
21851
+ */
21852
+ if (useMutilPeerC) {
21853
+ /**
21854
+ * 多 peerConnection 恢复发布资源
21855
+ */
21856
+ subedTracks.length && (yield new SubscribeCommand(subedTracks, this.subhook, true).execute(store, invoker));
21857
+ localTracks.length && (yield new PublishCommand(localTracks, this._pubhook, this._signalRetryTime).execute(store, invoker));
21858
+ return;
21859
+ }
21860
+ /**
21861
+ * 单 peerConnection 恢复发布、订阅资源
21862
+ */
21863
+ localTracks.length && (yield new PublishCommand(localTracks, this._pubhook, this._signalRetryTime).execute(store, invoker));
21864
+ if (!localTracks.length && subedTracks.length) {
21865
+ yield new SubscribeCommand(subedTracks, this.subhook, true).execute(store, invoker);
21866
+ }
21632
21867
  });
21633
21868
  }
21634
21869
  }
@@ -21646,12 +21881,13 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21646
21881
  this._logger = null;
21647
21882
  this._logger = RTCLogger.getLogger();
21648
21883
  }
21884
+ get kind() {
21885
+ return RCCommandKind.ASYNC_COMMAND;
21886
+ }
21649
21887
  execute(store, invoker) {
21650
- var _a, _b, _c, _d;
21888
+ var _a, _b, _c;
21651
21889
  return __awaiter(this, void 0, void 0, function* () {
21652
21890
  const { tracks } = this;
21653
- const { roomId } = store;
21654
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `unsubscribe -> roomId: ${roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
21655
21891
  if (this.state === RCLinkedListPoint.NORMAL) {
21656
21892
  // 获取原订阅列表
21657
21893
  const originTracks = store.getSubscribedList().slice();
@@ -21660,7 +21896,7 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21660
21896
  const subscribedTracks = store.getSubscribedList().slice();
21661
21897
  // 计算订阅列表 Diff
21662
21898
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21663
- (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21899
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21664
21900
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21665
21901
  });
21666
21902
  return { code: updateSuscribeCode, failedList };
@@ -21676,14 +21912,14 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21676
21912
  // 自执行一次,计算出最终的 collectSubscribeList
21677
21913
  const { code: updateSuscribeCode, failedList } = yield new UpdateSubscribeListCommand(tracks, this.subhook, true).execute(store, invoker);
21678
21914
  if (updateSuscribeCode !== RCRTCCode.SUCCESS) {
21679
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21915
+ (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21680
21916
  code: updateSuscribeCode, subscribe: [], unsubscribe: [], failedList,
21681
21917
  });
21682
21918
  return { code: updateSuscribeCode, failedList };
21683
21919
  }
21684
21920
  const subscribedTracks = store.getSubscribedList().slice(0);
21685
21921
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21686
- (_d = this.callbacks) === null || _d === void 0 ? void 0 : _d.onTaskCompleted({
21922
+ (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21687
21923
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21688
21924
  });
21689
21925
  return { code: updateSuscribeCode, failedList };
@@ -21703,22 +21939,25 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21703
21939
  }
21704
21940
 
21705
21941
  class AsyncSubscribeCommand extends AsyncCommand {
21706
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
21942
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21707
21943
  super(state);
21708
21944
  this.tracks = tracks;
21709
21945
  this.subhook = subhook;
21710
21946
  this.callbacks = callbacks;
21947
+ this.traceId = traceId;
21948
+ }
21949
+ get kind() {
21950
+ return RCCommandKind.ASYNC_COMMAND;
21711
21951
  }
21712
21952
  execute(store, invoker) {
21713
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21953
+ var _a, _b, _c, _d, _e;
21714
21954
  return __awaiter(this, void 0, void 0, function* () {
21715
21955
  const { tracks } = this;
21716
- const { roomId } = store;
21717
21956
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21718
21957
  if (this.state === RCLinkedListPoint.NORMAL) {
21719
21958
  // 获取原订阅列表
21720
21959
  const originTracks = store.getSubscribedList().slice();
21721
- const { code: subscribeCode, failedList } = yield new SubscribeCommand(tracks, this.subhook).execute(store, invoker);
21960
+ const { code: subscribeCode, failedList } = yield new SubscribeCommand(tracks, this.subhook, false, this.traceId).execute(store, invoker);
21722
21961
  // 获取新的订阅列表
21723
21962
  const subscribedTracks = store.getSubscribedList().slice();
21724
21963
  // 计算订阅列表 Diff
@@ -21728,16 +21967,15 @@ class AsyncSubscribeCommand extends AsyncCommand {
21728
21967
  });
21729
21968
  return { code: subscribeCode, failedList };
21730
21969
  }
21731
- const traceId = (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.createTraceId();
21732
- (_e = (_d = store.context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.info(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_T, JSON.stringify({
21970
+ (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_T, JSON.stringify({
21733
21971
  trackIds: tracks.map(getTrackIdFromAttr),
21734
- }), traceId);
21972
+ }), this.traceId);
21735
21973
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
21736
- (_g = (_f = store.context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
21974
+ (_e = (_d = store.context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.error(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
21737
21975
  status: RCLoggerStatus.FAILED,
21738
21976
  code: RCRTCCode.PARAMS_ERROR,
21739
21977
  msg: 'params error -> tracks',
21740
- }));
21978
+ }), this.traceId);
21741
21979
  return { code: RCRTCCode.PARAMS_ERROR };
21742
21980
  }
21743
21981
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item)));
@@ -21761,16 +21999,12 @@ class AsyncSubscribeCommand extends AsyncCommand {
21761
21999
  });
21762
22000
  // 北极星上报
21763
22001
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
21764
- (_j = (_h = store.context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.info(RCLoggerTag.L_ABSTRACT_ROOM_SUBSCRIBE_R, JSON.stringify({
21765
- trackIds: tracks.map(getTrackIdFromAttr),
21766
- roomId,
21767
- }));
21768
22002
  if (this.state === RCLinkedListPoint.TAIL) {
21769
- const { code: subscribeCode } = yield new AsyncSubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE).execute(store, invoker);
22003
+ const { code: subscribeCode } = yield new AsyncSubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE, this.traceId).execute(store, invoker);
21770
22004
  if (subscribeCode === RCRTCCode.SUCCESS) {
21771
22005
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21772
22006
  const tracks = store.getCollectSubscribeList().slice(0);
21773
- return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, traceId).execute(store, invoker);
22007
+ return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, this.traceId).execute(store, invoker);
21774
22008
  }
21775
22009
  return { code: subscribeCode };
21776
22010
  }
@@ -21797,60 +22031,58 @@ class AsyncSubscribeCommand extends AsyncCommand {
21797
22031
  }
21798
22032
 
21799
22033
  class AsyncUnsubscribeCommand extends AsyncCommand {
21800
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
22034
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21801
22035
  super(state);
21802
22036
  this.tracks = tracks;
21803
22037
  this.subhook = subhook;
21804
22038
  this.callbacks = callbacks;
22039
+ this.traceId = traceId;
22040
+ }
22041
+ get kind() {
22042
+ return RCCommandKind.ASYNC_COMMAND;
21805
22043
  }
21806
22044
  execute(store, invoker) {
21807
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22045
+ var _a, _b, _c, _d, _e;
21808
22046
  return __awaiter(this, void 0, void 0, function* () {
21809
22047
  const { tracks } = this;
21810
- const { roomId } = store;
21811
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21812
22048
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21813
22049
  if (this.state === RCLinkedListPoint.NORMAL) {
21814
22050
  // 获取原订阅列表
21815
22051
  const originTracks = store.getSubscribedList().slice();
21816
- const { code: unsubscribeCode, failedList } = yield new UnsubscribeCommand(tracks, this.subhook, traceId).execute(store, invoker);
22052
+ const { code: unsubscribeCode, failedList } = yield new UnsubscribeCommand(tracks, this.subhook, this.traceId).execute(store, invoker);
21817
22053
  // 获取新的订阅列表
21818
22054
  const subscribedTracks = store.getSubscribedList().slice();
21819
22055
  // 计算出 Diff
21820
22056
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21821
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
22057
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21822
22058
  code: unsubscribeCode, subscribe, unsubscribe, failedList,
21823
22059
  });
21824
22060
  return { code: unsubscribeCode, failedList };
21825
22061
  }
21826
- (_e = (_d = store.context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.info(RCLoggerTag.L_ABSTRACT_ROOM_UNSUBSCRIBE_T, JSON.stringify({
22062
+ (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_ABSTRACT_ROOM_UNSUBSCRIBE_T, JSON.stringify({
21827
22063
  trackIds: tracks.map(getTrackIdFromAttr),
21828
- }));
22064
+ }), this.traceId);
21829
22065
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
21830
- (_g = (_f = store.context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.warn(RCLoggerTag.L_ABSTRACT_ROOM_UNSUBSCRIBE_R, JSON.stringify({
22066
+ (_e = (_d = store.context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.warn(RCLoggerTag.L_ABSTRACT_ROOM_UNSUBSCRIBE_R, JSON.stringify({
21831
22067
  status: RCLoggerStatus.FAILED,
21832
22068
  code: RCRTCCode.PARAMS_ERROR,
21833
22069
  msg: 'params error -> tracks',
21834
- }));
22070
+ }), this.traceId);
21835
22071
  return { code: RCRTCCode.PARAMS_ERROR };
21836
22072
  }
21837
22073
  // 计算剩余订阅列表, 如果资源在取消订阅列表内则排除它
21838
22074
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item))).filter((item) => !tracks.includes(item.track));
21839
22075
  // 北极星上报
21840
22076
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
21841
- (_j = (_h = store.context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.info(RCLoggerTag.L_ABSTRACT_ROOM_UNSUBSCRIBE_R, JSON.stringify({
21842
- trackIds: tracks.map(getTrackIdFromAttr),
21843
- roomId,
21844
- }));
21845
22077
  if (this.state === RCLinkedListPoint.TAIL) {
21846
22078
  // 自执行一次,计算出最终的 collectSubscribeList
21847
- const { code: unsubscribeCode } = yield new AsyncUnsubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE).execute(store, invoker);
22079
+ const { code: unsubscribeCode } = yield new AsyncUnsubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE, this.traceId).execute(store, invoker);
21848
22080
  // 拥塞队列处理完成的数据
21849
22081
  if (unsubscribeCode === RCRTCCode.SUCCESS) {
21850
22082
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21851
22083
  const tracks = store.getCollectSubscribeList().slice(0).map((item) => item.track);
21852
22084
  // 自执行一次,计算出最终的 collectSubscribeList
21853
- return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, traceId).execute(store, invoker);
22085
+ return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, this.traceId).execute(store, invoker);
21854
22086
  }
21855
22087
  return { code: unsubscribeCode };
21856
22088
  }
@@ -21909,8 +22141,11 @@ class PullRTCRoomStatusCommand extends BaseCommand {
21909
22141
  this._subhook = _subhook;
21910
22142
  this._dealUserAppListener = _dealUserAppListener;
21911
22143
  }
22144
+ get kind() {
22145
+ return RCCommandKind.PULL_RTCROOM_STATUS;
22146
+ }
21912
22147
  execute(store, invoker) {
21913
- var _a, _b;
22148
+ var _a, _b, _c;
21914
22149
  return __awaiter(this, void 0, void 0, function* () {
21915
22150
  const version = store.getRoomStatusVersion();
21916
22151
  (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_PULL_ROOM_STATUS_T, JSON.stringify({
@@ -21919,10 +22154,14 @@ class PullRTCRoomStatusCommand extends BaseCommand {
21919
22154
  }), this._traceId);
21920
22155
  const { code, data } = yield this._context.pullRTCRoomStatus(this._roomId, version);
21921
22156
  if (code !== ErrorCode.SUCCESS) {
22157
+ (_b = this._context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
22158
+ status: RCLoggerStatus.FAILED,
22159
+ code,
22160
+ }), this._traceId);
21922
22161
  return { code };
21923
22162
  }
21924
22163
  const { bFullStatus, version: newVersion, usersData, roomStatus, } = data;
21925
- (_b = this._context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
22164
+ (_c = this._context.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
21926
22165
  bFullStatus,
21927
22166
  version: int64ToTimestamp(newVersion),
21928
22167
  usersData,
@@ -22019,8 +22258,18 @@ class RCAbstractRoom extends EventEmitter {
22019
22258
  this._peerCManager.setStore(this._store);
22020
22259
  // 注册监听 rtc_ntf 信令数据,收到通知时拉取房间数据
22021
22260
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
22022
- var _a, _b, _c, _d;
22261
+ var _a, _b, _c, _d, _e, _f;
22023
22262
  const { time, type, roomId, } = this._context.decodeRtcNotify(buffer);
22263
+ // 房间销毁后直接生吞发过来的事件
22264
+ if (this._invoker.isDestroyed()) {
22265
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RTCNTF_PULL_ROOM_STATUS_O, JSON.stringify({
22266
+ isDestroyed: true,
22267
+ type,
22268
+ time,
22269
+ roomId,
22270
+ }));
22271
+ return;
22272
+ }
22024
22273
  switch (type) {
22025
22274
  case 2:
22026
22275
  if (roomId !== this._roomId) {
@@ -22028,28 +22277,31 @@ class RCAbstractRoom extends EventEmitter {
22028
22277
  }
22029
22278
  // 拉取房间数据
22030
22279
  // eslint-disable-next-line no-case-declarations
22031
- const tracId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
22032
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_RTCNTF_PULL_ROOM_STATUS_O, null, tracId);
22280
+ const tracId = (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.createTraceId();
22281
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_RTCNTF_PULL_ROOM_STATUS_O, null, tracId);
22033
22282
  this._startPullRTCRoomStatus(roomId, tracId);
22034
22283
  break;
22035
22284
  }
22036
22285
  }));
22037
22286
  }
22287
+ _pullRTCRoomStatus(roomId, tracId) {
22288
+ return new PullRTCRoomStatusCommand(roomId, tracId, this._context, {
22289
+ onUserJoin: this._callAppListener.bind(this, 'onUserJoin'),
22290
+ onUserLeave: this._callAppListener.bind(this, 'onUserLeave'),
22291
+ onAudioMuteChange: this._onAudioMuteChange.bind(this),
22292
+ onVideoMuteChange: this._onVideoMuteChange.bind(this),
22293
+ onTrackPublish: this._onTrackPublish.bind(this),
22294
+ onTrackUnpublish: this._onTrackUnpublish.bind(this),
22295
+ onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22296
+ }, this._subhook.bind(this), this._dealUserAppListener.bind(this));
22297
+ }
22038
22298
  /**
22039
22299
  * 拉取房间数据
22040
22300
  * @param roomId 房间 id
22041
22301
  */
22042
22302
  _startPullRTCRoomStatus(roomId, tracId) {
22043
22303
  return __awaiter(this, void 0, void 0, function* () {
22044
- yield this._invoker.push(new PullRTCRoomStatusCommand(roomId, tracId, this._context, {
22045
- onUserJoin: this._callAppListener.bind(this, 'onUserJoin'),
22046
- onUserLeave: this._callAppListener.bind(this, 'onUserLeave'),
22047
- onAudioMuteChange: this._onAudioMuteChange.bind(this),
22048
- onVideoMuteChange: this._onVideoMuteChange.bind(this),
22049
- onTrackPublish: this._onTrackPublish.bind(this),
22050
- onTrackUnpublish: this._onTrackUnpublish.bind(this),
22051
- onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22052
- }, this._subhook.bind(this), this._dealUserAppListener.bind(this)));
22304
+ yield this._invoker.push(this._pullRTCRoomStatus(roomId, tracId));
22053
22305
  });
22054
22306
  }
22055
22307
  __innerInit(mode, joinType, livingType, innerUserDatas, outerUserDatas, traceId) {
@@ -22690,15 +22942,11 @@ class RCAbstractRoom extends EventEmitter {
22690
22942
  });
22691
22943
  }
22692
22944
  _getRTCReqestHeaders(pcName) {
22693
- const heasers = {
22694
- 'App-Key': this._context.getAppkey(),
22695
- RoomId: this._roomId,
22696
- Token: this._store.getToken(),
22697
- RoomType: this._store.roomMode,
22698
- UserId: this._context.getCurrentId(),
22699
- 'Client-Session-Id': this._clientSessionId,
22700
- 'Peer-Connection-Id': pcName,
22701
- };
22945
+ /**
22946
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
22947
+ */
22948
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': pcName } : {};
22949
+ const heasers = Object.assign({ 'App-Key': this._context.getAppkey(), RoomId: this._roomId, Token: this._store.getToken(), RoomType: this._store.roomMode, UserId: this._context.getCurrentId(), 'Client-Session-Id': this._clientSessionId }, peerConnectionId);
22702
22950
  return heasers;
22703
22951
  }
22704
22952
  /**
@@ -22767,9 +23015,11 @@ class RCAbstractRoom extends EventEmitter {
22767
23015
  * @returns 一个用代码和失败列表解析为对象的承诺。
22768
23016
  */
22769
23017
  addSubscribeTask(tracks) {
23018
+ var _a;
23019
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22770
23020
  this._invoker.push(new AsyncSubscribeCommand(tracks, this._subhook.bind(this), {
22771
23021
  onTaskCompleted: this._onTaskCompleted.bind(this),
22772
- }));
23022
+ }, RCLinkedListPoint.NORMAL, traceId));
22773
23023
  }
22774
23024
  /**
22775
23025
  * 取消订阅资源
@@ -22789,9 +23039,11 @@ class RCAbstractRoom extends EventEmitter {
22789
23039
  * @returns 一个用代码和失败列表解析为对象的承诺。
22790
23040
  */
22791
23041
  addUnsubscribeTask(tracks) {
23042
+ var _a;
23043
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22792
23044
  this._invoker.push(new AsyncUnsubscribeCommand(tracks, this._subhook.bind(this), {
22793
23045
  onTaskCompleted: this._onTaskCompleted.bind(this),
22794
- }));
23046
+ }, RCLinkedListPoint.NORMAL, traceId));
22795
23047
  }
22796
23048
  /**
22797
23049
  * 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
@@ -22915,7 +23167,7 @@ class RCAbstractRoom extends EventEmitter {
22915
23167
  onTrackPublish: this._onTrackPublish.bind(this),
22916
23168
  onTrackUnpublish: this._onTrackUnpublish.bind(this),
22917
23169
  onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22918
- }, livingType));
23170
+ }, (pcName) => ({ pushOtherRooms: this._getPushOtherRoomsParams(), headers: this._getRTCReqestHeaders(pcName) }), this._pubhook.bind(this), this.signalRetryTime, this._pullRTCRoomStatus.bind(this), livingType));
22919
23171
  });
22920
23172
  }
22921
23173
  _onAudioMuteChange(audioTrack) {
@@ -22957,6 +23209,9 @@ class MCUConfigFlushCommand extends BaseCommand {
22957
23209
  this.data = data;
22958
23210
  this.cdnValues = cdnValues;
22959
23211
  }
23212
+ get kind() {
23213
+ return RCCommandKind.MCUCONFIG_FLUSH;
23214
+ }
22960
23215
  execute(store, invoker) {
22961
23216
  var _a, _b, _c, _d;
22962
23217
  return __awaiter(this, void 0, void 0, function* () {
@@ -23974,23 +24229,28 @@ var RCInnerCDNPushMode;
23974
24229
  })(RCInnerCDNPushMode || (RCInnerCDNPushMode = {}));
23975
24230
 
23976
24231
  class ExchangeWithPushOtherRoomCommand extends BaseCommand {
23977
- constructor(roomId, hooks, roomPKHandler) {
24232
+ constructor(roomId, hooks, roomPKHandler, traceId) {
23978
24233
  super();
23979
24234
  this.roomId = roomId;
23980
24235
  this.hooks = hooks;
23981
24236
  this.roomPKHandler = roomPKHandler;
24237
+ this.traceId = traceId;
23982
24238
  }
23983
24239
  /**
23984
24240
  * 携带 pushOtherRooms 与 mediaServer 重新交互
23985
24241
  */
23986
24242
  _exchangeWithPushOtherRoom(store, invoker) {
23987
- var _a, _b, _c, _d;
24243
+ var _a, _b, _c, _d, _e, _f, _g, _h;
23988
24244
  return __awaiter(this, void 0, void 0, function* () {
23989
24245
  /**
23990
24246
  * 如果己方未发布过资源,无需发请求
23991
24247
  */
23992
24248
  const pubTracks = store.getLocalTracks();
23993
24249
  if (!pubTracks.length) {
24250
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24251
+ status: RCLoggerStatus.SUCCESSED,
24252
+ msg: 'have not published resource',
24253
+ }), this.traceId);
23994
24254
  return;
23995
24255
  }
23996
24256
  const mutilPeerCList = Object.values(store.peerMgr.getMutilPeerCData());
@@ -24001,60 +24261,65 @@ class ExchangeWithPushOtherRoomCommand extends BaseCommand {
24001
24261
  const reqBody = yield createExchangeParams(subscribeList, false, pc, store);
24002
24262
  const { pushOtherRooms, headers } = this.hooks(pcNameList[index]);
24003
24263
  reqBody.pushOtherRooms = pushOtherRooms;
24004
- const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
24264
+ const resp = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
24005
24265
  if (resp.code !== RCRTCCode.SUCCESS) {
24006
- (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `exchange with pushOtherRoom failed: ${resp.code}`);
24266
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24267
+ status: RCLoggerStatus.FAILED,
24268
+ code: resp.code,
24269
+ pushOtherRooms,
24270
+ }), this.traceId);
24007
24271
  return;
24008
24272
  }
24009
24273
  const { sdp: answer, resultCode } = resp.data;
24010
24274
  if (resultCode !== RCRTCCode.SUCCESS) {
24011
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `exchange with pushOtherRoom failed: ${resultCode}`);
24275
+ (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24276
+ status: RCLoggerStatus.FAILED,
24277
+ code: resultCode,
24278
+ pushOtherRooms,
24279
+ }), this.traceId);
24012
24280
  return;
24013
24281
  }
24282
+ (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24283
+ status: RCLoggerStatus.SUCCESSED,
24284
+ pushOtherRooms,
24285
+ }), this.traceId);
24014
24286
  pc.setRemoteAnswer(answer.sdp);
24015
24287
  }
24016
24288
  });
24017
24289
  }
24290
+ get kind() {
24291
+ return RCCommandKind.EXCHANGE_WITH_PUSH_OTHER_ROOM;
24292
+ }
24018
24293
  execute(store, invoker) {
24019
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24294
+ var _a, _b, _c, _d, _e, _f;
24020
24295
  return __awaiter(this, void 0, void 0, function* () {
24021
24296
  const { roomId } = this;
24022
- (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_ROOM_JOINED_PK_ROOM_T, JSON.stringify({
24297
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_T, JSON.stringify({
24023
24298
  roomId,
24024
- userId: store.crtUserId,
24025
24299
  }));
24026
24300
  // 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
24027
24301
  if (!this.roomPKHandler) {
24028
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_LIVING_ROOM_JOINED_PK_ROOM_R, JSON.stringify({
24302
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24029
24303
  status: RCLoggerStatus.FAILED,
24030
- code: '',
24031
24304
  msg: '_roomPKHandler not exist',
24032
- }));
24305
+ }), this.traceId);
24033
24306
  return;
24034
24307
  }
24035
24308
  const PKInfo = this.roomPKHandler.getPKInfo(roomId);
24036
24309
  if (!PKInfo) {
24037
- (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `exchange to update pushOtherRoom cancel, pkInfo lost -> roomId: ${roomId}`);
24038
- (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_LIVING_ROOM_JOINED_PK_ROOM_R, JSON.stringify({
24310
+ (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_EXCHANGE_WITH_PUSHOTHERROOM_R, JSON.stringify({
24039
24311
  status: RCLoggerStatus.FAILED,
24040
- code: '',
24041
24312
  msg: 'PKInfo not exist',
24042
- }));
24313
+ }), this.traceId);
24043
24314
  return;
24044
24315
  }
24045
24316
  yield this._exchangeWithPushOtherRoom(store, invoker);
24046
- (_k = (_j = store.context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_LIVING_ROOM_JOINED_PK_ROOM_T, JSON.stringify({
24047
- status: RCLoggerStatus.SUCCESSED,
24048
- roomId,
24049
- userId: store.crtUserId,
24050
- PKInfo,
24051
- }));
24052
24317
  });
24053
24318
  }
24054
24319
  }
24055
24320
 
24056
24321
  class LeaveOtherRoomCommand extends BaseCommand {
24057
- constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK) {
24322
+ constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK, traceId) {
24058
24323
  super();
24059
24324
  this.pkHandler = pkHandler;
24060
24325
  this.room = room;
@@ -24062,18 +24327,21 @@ class LeaveOtherRoomCommand extends BaseCommand {
24062
24327
  this.hooks = hooks;
24063
24328
  this._joinedPKRooms = _joinedPKRooms;
24064
24329
  this.isQuitPK = isQuitPK;
24330
+ this.traceId = traceId;
24065
24331
  }
24066
24332
  get kind() {
24067
- return RCCommandKind.LeaveRoom;
24333
+ return RCCommandKind.LEAVE_OTHER_ROOM;
24068
24334
  }
24069
24335
  /**
24070
24336
  * 结束跨房间连麦
24071
24337
  * @param roomId 需要结束连麦的房间 roomId
24072
24338
  */
24073
- quitRoomPK(roomId, store) {
24074
- var _a, _b, _c, _d, _e, _f;
24339
+ quitRoomPK(roomId, store, traceId) {
24340
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24075
24341
  return __awaiter(this, void 0, void 0, function* () {
24342
+ (_b = (_a = store === null || store === void 0 ? void 0 : store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_QUIT_PK_T, `roomId: ${roomId}`, traceId);
24076
24343
  if (!this._PKInfo[roomId]) {
24344
+ (_d = (_c = store === null || store === void 0 ? void 0 : store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_QUIT_PK_R, `status: ${RCLoggerStatus.FAILED}, msg: pkinfo is empty`, traceId);
24077
24345
  return;
24078
24346
  }
24079
24347
  const { inviterRoomId, inviteeRoomId, inviterUserId, inviteSessionId, } = this._PKInfo[roomId];
@@ -24089,40 +24357,34 @@ class LeaveOtherRoomCommand extends BaseCommand {
24089
24357
  content: JSON.stringify(content),
24090
24358
  keys: [`${inviterRoomId}|${inviterUserId}`],
24091
24359
  };
24092
- (_b = (_a = store === null || store === void 0 ? void 0 : store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `quitRoomPK -> params: ${JSON.stringify(params)}`);
24093
24360
  const code = yield store.context.endRoomPK(params);
24094
24361
  if (code !== ErrorCode.SUCCESS) {
24095
- (_d = (_c = store === null || store === void 0 ? void 0 : store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(`quitRoomPK failed: ${code}`);
24362
+ (_f = (_e = store === null || store === void 0 ? void 0 : store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_QUIT_PK_R, `status: ${RCLoggerStatus.FAILED}, code: ${code}`, traceId);
24096
24363
  return { code: RCRTCCode.SIGNAL_ERROR };
24097
24364
  }
24098
- (_f = (_e = store === null || store === void 0 ? void 0 : store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info('quitRoomPK success');
24365
+ (_h = (_g = store === null || store === void 0 ? void 0 : store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_QUIT_PK_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
24099
24366
  delete this._PKInfo[roomId];
24100
24367
  return { code: RCRTCCode.SUCCESS };
24101
24368
  });
24102
24369
  }
24103
24370
  execute(store, invoker) {
24104
- var _a, _b, _c, _d, _e, _f;
24371
+ var _a, _b, _c, _d;
24105
24372
  return __awaiter(this, void 0, void 0, function* () {
24106
24373
  const { room, isQuitPK } = this;
24107
24374
  const roomId = room.getRoomId();
24108
- (_b = (_a = store === null || store === void 0 ? void 0 : store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `leavePKRoom -> userId: ${store.crtUserId} , roomId: ${roomId}`);
24109
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_ROOM_LEAVE_PK_ROOM_T, JSON.stringify({
24375
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_ROOM_LEAVE_PK_ROOM_T, JSON.stringify({
24110
24376
  roomId,
24111
- userId: store.crtUserId,
24112
24377
  isQuitPK,
24113
- }));
24378
+ }), this.traceId);
24114
24379
  yield room.__destroy(true);
24115
24380
  // 回调主直播房间离开 PK 房间
24116
24381
  delete this._joinedPKRooms[roomId];
24117
- yield new ExchangeWithPushOtherRoomCommand(roomId, this.hooks, this.pkHandler).execute(store, invoker);
24382
+ yield new ExchangeWithPushOtherRoomCommand(roomId, this.hooks, this.pkHandler, this.traceId).execute(store, invoker);
24118
24383
  // isQuitPK 为 true 时,结束连麦
24119
- isQuitPK && this.quitRoomPK(roomId, store);
24120
- (_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_LIVING_ROOM_LEAVE_PK_ROOM_R, JSON.stringify({
24384
+ isQuitPK && this.quitRoomPK(roomId, store, this.traceId);
24385
+ (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_ROOM_LEAVE_PK_ROOM_R, JSON.stringify({
24121
24386
  status: RCLoggerStatus.SUCCESSED,
24122
- roomId,
24123
- userId: store.crtUserId,
24124
- isQuitPK,
24125
- }));
24387
+ }), this.traceId);
24126
24388
  return { code: RCRTCCode.SUCCESS };
24127
24389
  });
24128
24390
  }
@@ -24164,9 +24426,8 @@ class RCLivingPKHandler {
24164
24426
  this._mainRoomId = this._mainLivingRoom.getRoomId();
24165
24427
  }
24166
24428
  _callAppListener(eventType, ...attrs) {
24167
- var _a, _b, _c, _d, _e;
24168
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `${eventType} callback -> ${JSON.stringify(attrs)}`);
24169
- const handle = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c[eventType];
24429
+ var _a, _b, _c;
24430
+ const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
24170
24431
  if (!handle) {
24171
24432
  return;
24172
24433
  }
@@ -24174,7 +24435,7 @@ class RCLivingPKHandler {
24174
24435
  handle(...attrs);
24175
24436
  }
24176
24437
  catch (error) {
24177
- (_e = (_d = this._context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, JSON.stringify(error));
24438
+ (_c = (_b = this._context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O, JSON.stringify(error));
24178
24439
  }
24179
24440
  }
24180
24441
  /**
@@ -24190,8 +24451,7 @@ class RCLivingPKHandler {
24190
24451
  extra,
24191
24452
  };
24192
24453
  this._PKInfo[inviterRoomId] = inviteInfo;
24193
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
24194
- status: RCLoggerStatus.SUCCESSED,
24454
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O, JSON.stringify({
24195
24455
  eventType: 'onRequestJoinOtherRoom',
24196
24456
  info,
24197
24457
  }));
@@ -24209,8 +24469,7 @@ class RCLivingPKHandler {
24209
24469
  extra,
24210
24470
  };
24211
24471
  delete this._PKInfo[inviterRoomId];
24212
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
24213
- status: RCLoggerStatus.SUCCESSED,
24472
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O, JSON.stringify({
24214
24473
  eventType: 'onCancelRequestOtherRoom',
24215
24474
  cancelInfo,
24216
24475
  }));
@@ -24245,21 +24504,20 @@ class RCLivingPKHandler {
24245
24504
  inviteeRoomId,
24246
24505
  };
24247
24506
  this._PKInfo[inviteeRoomId].inviteeUserAutoMix = inviteeUserAutoMix;
24248
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
24249
- status: RCLoggerStatus.SUCCESSED,
24507
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O, JSON.stringify({
24250
24508
  eventType: 'onResponseJoinOtherRoom',
24251
24509
  answerInfo,
24252
24510
  }));
24253
24511
  this._callAppListener('onResponseJoinOtherRoom', answerInfo);
24254
24512
  }
24255
- createLeaveOtherRoomCommand(room, isQuitPK) {
24256
- return new LeaveOtherRoomCommand(this, room, this._PKInfo, this._hooks, this._joinedPKRooms, isQuitPK);
24513
+ createLeaveOtherRoomCommand(room, isQuitPK, traceId) {
24514
+ return new LeaveOtherRoomCommand(this, room, this._PKInfo, this._hooks, this._joinedPKRooms, isQuitPK, traceId);
24257
24515
  }
24258
24516
  /**
24259
24517
  * 收到连麦结束
24260
24518
  */
24261
24519
  _onPKEnd(content) {
24262
- var _a, _b;
24520
+ var _a, _b, _c, _d, _e, _f;
24263
24521
  return __awaiter(this, void 0, void 0, function* () {
24264
24522
  const { inviteeRoomId, inviterRoomId, userId } = content.inviteInfo;
24265
24523
  const roomId = inviterRoomId === this._mainRoomId ? inviteeRoomId : inviterRoomId;
@@ -24269,10 +24527,11 @@ class RCLivingPKHandler {
24269
24527
  };
24270
24528
  // 兼容先退出房间,再收到 pk 结束的情况
24271
24529
  const room = this._joinedPKRooms[roomId];
24272
- room && (yield this._invoker.push(this.createLeaveOtherRoomCommand(room)));
24530
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24531
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_QUIT_PK_LEAVE_PK_ROOM_O, undefined, traceId);
24532
+ room && (yield this._invoker.push(this.createLeaveOtherRoomCommand(room, true, traceId)));
24273
24533
  delete this._PKInfo[roomId];
24274
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
24275
- status: RCLoggerStatus.SUCCESSED,
24534
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O, JSON.stringify({
24276
24535
  eventType: 'onFinishOtherRoom',
24277
24536
  endInfo,
24278
24537
  }));
@@ -24308,7 +24567,6 @@ class RCLivingPKHandler {
24308
24567
  registerRoomPKEventListener(listener) {
24309
24568
  var _a, _b;
24310
24569
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O, JSON.stringify({
24311
- status: RCLoggerStatus.SUCCESSED,
24312
24570
  listener: listener && Object.keys(listener),
24313
24571
  }));
24314
24572
  this._appListener = listener;
@@ -24321,23 +24579,23 @@ class RCLivingPKHandler {
24321
24579
  * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
24322
24580
  */
24323
24581
  requestJoinOtherRoom(inviteeRoomId, inviteeUserId, options) {
24324
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
24582
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24325
24583
  return __awaiter(this, void 0, void 0, function* () {
24326
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T, JSON.stringify({
24584
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24585
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T, JSON.stringify({
24327
24586
  inviteeRoomId,
24328
24587
  inviteeUserId,
24329
24588
  options,
24330
- }));
24589
+ }), traceId);
24331
24590
  if (!(validate('inviteeRoomId', inviteeRoomId, notEmptyString, true)
24332
24591
  && validate('inviteeUserId', inviteeUserId, notEmptyString, true))) {
24333
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24592
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24334
24593
  status: RCLoggerStatus.FAILED,
24335
24594
  code: RCRTCCode.PARAMS_ERROR,
24336
- msg: 'params error -> inviteeRoomId inviteeUserId',
24337
- }));
24595
+ msg: 'params error -> inviteeRoomId or inviteeUserId',
24596
+ }), traceId);
24338
24597
  return { code: RCRTCCode.PARAMS_ERROR };
24339
24598
  }
24340
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `requestRoomPK -> inviteeRoomId: ${inviteeRoomId}; inviteeUserId: ${inviteeUserId}; options: ${JSON.stringify(options || {})}`);
24341
24599
  const inviteSessionId = getUUID();
24342
24600
  const autoMix = isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24343
24601
  const inviteInfo = {
@@ -24358,18 +24616,14 @@ class RCLivingPKHandler {
24358
24616
  inviteInfo: JSON.stringify(inviteInfo),
24359
24617
  inviteSessionId,
24360
24618
  };
24361
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `requestRoomPK -> params: ${JSON.stringify(params)}`);
24362
24619
  const code = yield this._context.requestRoomPK(params);
24363
24620
  if (code !== ErrorCode.SUCCESS) {
24364
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `requestRoomPK failed: ${code}`);
24365
- (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24621
+ (_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_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24366
24622
  status: RCLoggerStatus.FAILED,
24367
24623
  code,
24368
- msg: '',
24369
- }));
24624
+ }), traceId);
24370
24625
  return { code };
24371
24626
  }
24372
- (_p = (_o = this._context) === null || _o === void 0 ? void 0 : _o.logger) === null || _p === void 0 ? void 0 : _p.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'requestRoomPK success');
24373
24627
  this._PKInfo[inviteeRoomId] = {
24374
24628
  inviteSessionId,
24375
24629
  inviterRoomId: this._mainRoomId,
@@ -24377,11 +24631,9 @@ class RCLivingPKHandler {
24377
24631
  inviterUserAutoMix: autoMix,
24378
24632
  inviteeRoomId,
24379
24633
  };
24380
- (_r = (_q = this._context) === null || _q === void 0 ? void 0 : _q.logger) === null || _r === void 0 ? void 0 : _r.info(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24381
- inviteeRoomId,
24382
- inviteeUserId,
24383
- options,
24384
- }));
24634
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24635
+ status: RCLoggerStatus.SUCCESSED,
24636
+ }), traceId);
24385
24637
  return { code: RCRTCCode.SUCCESS };
24386
24638
  });
24387
24639
  }
@@ -24392,34 +24644,31 @@ class RCLivingPKHandler {
24392
24644
  * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
24393
24645
  */
24394
24646
  cancelRequestJoinOtherRoom(inviteeRoomId, inviteeUserId, extra) {
24395
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
24647
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
24396
24648
  return __awaiter(this, void 0, void 0, function* () {
24397
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T, JSON.stringify({
24649
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24650
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T, JSON.stringify({
24398
24651
  inviteeRoomId,
24399
24652
  inviteeUserId,
24400
24653
  extra,
24401
- userId: this._context.getCurrentId(),
24402
- roomId: this._mainRoomId,
24403
- }));
24654
+ }), traceId);
24404
24655
  if (!(validate('inviteeRoomId', inviteeRoomId, notEmptyString, true)
24405
24656
  && validate('inviteeUserId', inviteeUserId, notEmptyString, true))) {
24406
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24657
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24407
24658
  status: RCLoggerStatus.FAILED,
24408
24659
  code: RCRTCCode.PARAMS_ERROR,
24409
24660
  msg: 'params error -> inviteeRoomId or inviteeUserId',
24410
- }));
24661
+ }), traceId);
24411
24662
  return { code: RCRTCCode.PARAMS_ERROR };
24412
24663
  }
24413
24664
  if (!this._PKInfo[inviteeRoomId]) {
24414
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`);
24415
24665
  (_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_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24416
24666
  status: RCLoggerStatus.FAILED,
24417
24667
  code: RCRTCCode.PARAMS_ERROR,
24418
24668
  msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24419
- }));
24669
+ }), traceId);
24420
24670
  return { code: RCRTCCode.PARAMS_ERROR };
24421
24671
  }
24422
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `canceRequestJoinPK -> inviteeRoomId: ${inviteeRoomId}; inviteeUserId: ${inviteeUserId}; extra: ${extra}`);
24423
24672
  const inviteInfo = {
24424
24673
  inviterRoomId: this._mainRoomId,
24425
24674
  inviterUserId: this._context.getCurrentId(),
@@ -24434,24 +24683,17 @@ class RCLivingPKHandler {
24434
24683
  inviteSessionId: this._PKInfo[inviteeRoomId].inviteSessionId,
24435
24684
  inviteInfo: JSON.stringify(inviteInfo),
24436
24685
  };
24437
- (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `canceRequestJoinPK -> params: ${JSON.stringify(params)}`);
24438
24686
  const code = yield this._context.cancelRoomPK(params);
24439
24687
  if (code !== ErrorCode.SUCCESS) {
24440
- (_p = (_o = this._context) === null || _o === void 0 ? void 0 : _o.logger) === null || _p === void 0 ? void 0 : _p.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `canceRequestJoinPK failed: ${code}`);
24441
- (_r = (_q = this._context) === null || _q === void 0 ? void 0 : _q.logger) === null || _r === void 0 ? void 0 : _r.error(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24688
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24442
24689
  status: RCLoggerStatus.FAILED,
24443
24690
  code,
24444
- msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24445
- }));
24691
+ }), traceId);
24446
24692
  return { code };
24447
24693
  }
24448
- (_t = (_s = this._context) === null || _s === void 0 ? void 0 : _s.logger) === null || _t === void 0 ? void 0 : _t.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'canceRequestJoinPK success');
24449
- (_v = (_u = this._context) === null || _u === void 0 ? void 0 : _u.logger) === null || _v === void 0 ? void 0 : _v.info(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24694
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R, JSON.stringify({
24450
24695
  status: RCLoggerStatus.SUCCESSED,
24451
- inviteeRoomId,
24452
- inviteeUserId,
24453
- extra,
24454
- }));
24696
+ }), traceId);
24455
24697
  delete this._PKInfo[inviteeRoomId];
24456
24698
  return { code: RCRTCCode.SUCCESS };
24457
24699
  });
@@ -24465,35 +24707,32 @@ class RCLivingPKHandler {
24465
24707
  * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
24466
24708
  */
24467
24709
  responseJoinOtherRoom(inviterRoomId, inviterUserId, agree, options) {
24468
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
24710
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
24469
24711
  return __awaiter(this, void 0, void 0, function* () {
24470
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T, JSON.stringify({
24712
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24713
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T, JSON.stringify({
24471
24714
  inviterRoomId,
24472
24715
  inviterUserId,
24473
24716
  agree,
24474
24717
  options,
24475
- userId: this._context.getCurrentId(),
24476
- roomId: this._mainRoomId,
24477
- }));
24718
+ }), traceId);
24478
24719
  if (!(validate('inviterRoomId', inviterRoomId, notEmptyString, true)
24479
24720
  && validate('inviterUserId', inviterUserId, notEmptyString, true))) {
24480
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24721
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24481
24722
  status: RCLoggerStatus.FAILED,
24482
24723
  code: RCRTCCode.PARAMS_ERROR,
24483
24724
  msg: 'params error -> inviterRoomId or inviterUserId',
24484
- }));
24725
+ }), traceId);
24485
24726
  return { code: RCRTCCode.PARAMS_ERROR };
24486
24727
  }
24487
24728
  if (!this._PKInfo[inviterRoomId]) {
24488
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `User ${inviterUserId} in room ${inviterRoomId} did not send a request for connection`);
24489
24729
  (_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_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24490
24730
  status: RCLoggerStatus.FAILED,
24491
24731
  code: RCRTCCode.PARAMS_ERROR,
24492
24732
  msg: `User ${inviterUserId} in room ${inviterRoomId} did not send a request for connection`,
24493
- }));
24733
+ }), traceId);
24494
24734
  return { code: RCRTCCode.PARAMS_ERROR };
24495
24735
  }
24496
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `responseRoomPK -> inviterRoomId: ${inviterRoomId}; inviterUserId: ${inviterUserId}; agree: ${agree}; options: ${JSON.stringify(options || {})}`);
24497
24736
  const { inviteSessionId, inviterUserAutoMix } = this._PKInfo[inviterRoomId];
24498
24737
  const autoMix = isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24499
24738
  const value = {
@@ -24523,27 +24762,17 @@ class RCLivingPKHandler {
24523
24762
  key: `${inviterRoomId}|${this._mainRoomId}`,
24524
24763
  value: JSON.stringify(value),
24525
24764
  };
24526
- (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `responseRoomPK -> params: ${JSON.stringify(params)}`);
24527
24765
  const code = yield this._context.responseRoomPK(params);
24528
24766
  if (code !== ErrorCode.SUCCESS) {
24529
- (_p = (_o = this._context) === null || _o === void 0 ? void 0 : _o.logger) === null || _p === void 0 ? void 0 : _p.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `responseRoomPK failed: ${code}`);
24530
- (_r = (_q = this._context) === null || _q === void 0 ? void 0 : _q.logger) === null || _r === void 0 ? void 0 : _r.error(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24767
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24531
24768
  status: RCLoggerStatus.FAILED,
24532
24769
  code,
24533
- msg: '',
24534
- }));
24770
+ }), traceId);
24535
24771
  return { code };
24536
24772
  }
24537
- (_t = (_s = this._context) === null || _s === void 0 ? void 0 : _s.logger) === null || _t === void 0 ? void 0 : _t.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'responseRoomPK success');
24538
- (_v = (_u = this._context) === null || _u === void 0 ? void 0 : _u.logger) === null || _v === void 0 ? void 0 : _v.info(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24773
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R, JSON.stringify({
24539
24774
  status: RCLoggerStatus.SUCCESSED,
24540
- inviterRoomId,
24541
- inviterUserId,
24542
- agree,
24543
- options,
24544
- userId: this._context.getCurrentId(),
24545
- roomId: this._mainRoomId,
24546
- }));
24775
+ }), traceId);
24547
24776
  this._PKInfo[inviterRoomId].inviteeUserAutoMix = autoMix;
24548
24777
  return { code: RCRTCCode.SUCCESS };
24549
24778
  });
@@ -24553,35 +24782,34 @@ class RCLivingPKHandler {
24553
24782
  * @roomId 副房间的 roomId
24554
24783
  */
24555
24784
  joinOtherRoom(roomId) {
24556
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
24785
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24557
24786
  return __awaiter(this, void 0, void 0, function* () {
24558
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T, JSON.stringify({
24787
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24788
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T, JSON.stringify({
24559
24789
  roomId,
24560
- userId: this._context.getCurrentId(),
24561
- }));
24790
+ }), traceId);
24562
24791
  if (!(validate('roomId', roomId, notEmptyString, true))) {
24563
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24792
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24564
24793
  status: RCLoggerStatus.FAILED,
24565
24794
  code: RCRTCCode.PARAMS_ERROR,
24566
24795
  msg: 'params error -> roomId',
24567
- }));
24796
+ }), traceId);
24568
24797
  return { code: RCRTCCode.PARAMS_ERROR };
24569
24798
  }
24570
24799
  if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
24571
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24800
+ (_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({
24572
24801
  status: RCLoggerStatus.FAILED,
24573
24802
  code: RCRTCCode.SIGNAL_DISCONNECTED,
24574
24803
  msg: 'IM disconnected',
24575
- }));
24804
+ }), traceId);
24576
24805
  return { code: RCRTCCode.SIGNAL_DISCONNECTED };
24577
24806
  }
24578
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `JoinPKRoom, roomId: ${roomId}`);
24579
24807
  if (this._joinedPKRooms[roomId]) {
24580
24808
  (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.warn(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24581
24809
  status: RCLoggerStatus.FAILED,
24582
24810
  code: RCRTCCode.REPERT_JOIN_ROOM,
24583
24811
  msg: 'Join the room repeatedly',
24584
- }));
24812
+ }), traceId);
24585
24813
  return { code: RCRTCCode.REPERT_JOIN_ROOM };
24586
24814
  }
24587
24815
  const livingType = RCLivingType.VIDEO; // signal 不处理 livingType 故写死 RCLivingType.VIDEO
@@ -24592,23 +24820,18 @@ class RCLivingPKHandler {
24592
24820
  const room = new RCLivingRoom(this._context, this._runtime, roomId, this._service, this._initOptions, livingType, false, false, false, this._clientSessionId);
24593
24821
  const { code, data } = yield room.__innerInit(RTCMode.LIVE, undefined, livingType, innerUserData);
24594
24822
  if (code !== RCRTCCode.SUCCESS) {
24595
- (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `JoinPKRoom failed -> code: ${code}`);
24596
- (_p = (_o = this._context) === null || _o === void 0 ? void 0 : _o.logger) === null || _p === void 0 ? void 0 : _p.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24823
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.error(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24597
24824
  status: RCLoggerStatus.FAILED,
24598
24825
  code,
24599
- msg: '',
24600
- }));
24826
+ }), traceId);
24601
24827
  return { code: code };
24602
24828
  }
24603
- (_r = (_q = this._context) === null || _q === void 0 ? void 0 : _q.logger) === null || _r === void 0 ? void 0 : _r.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `JoinPKRoom success -> userId: ${this._context.getCurrentId()}, roomId: ${roomId}, data: ${JSON.stringify(data)}`);
24604
24829
  // 回调主直播房间,已加入 PK 房间
24605
24830
  this._joinedPKRooms[roomId] = room;
24606
- yield this._onJoinedPKRoom(roomId, room);
24607
- (_t = (_s = this._context) === null || _s === void 0 ? void 0 : _s.logger) === null || _t === void 0 ? void 0 : _t.info(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24831
+ yield this._onJoinedPKRoom(roomId, traceId);
24832
+ (_p = (_o = this._context) === null || _o === void 0 ? void 0 : _o.logger) === null || _p === void 0 ? void 0 : _p.info(RCLoggerTag.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R, JSON.stringify({
24608
24833
  status: RCLoggerStatus.SUCCESSED,
24609
- roomId,
24610
- userId: this._context.getCurrentId(),
24611
- }));
24834
+ }), traceId);
24612
24835
  return {
24613
24836
  room, code: RCRTCCode.SUCCESS, userIds: room.getRemoteUserIds(), tracks: room.getRemoteTracks(),
24614
24837
  };
@@ -24620,8 +24843,11 @@ class RCLivingPKHandler {
24620
24843
  * @param isQuitPK 是否要结束连麦
24621
24844
  */
24622
24845
  leaveOtherRoom(room, isQuitPK) {
24846
+ var _a, _b, _c, _d;
24623
24847
  return __awaiter(this, void 0, void 0, function* () {
24624
- return this._invoker.push(this.createLeaveOtherRoomCommand(room, isQuitPK));
24848
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24849
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_APP_CALL_LEAVE_PK_ROOM_O, undefined, traceId);
24850
+ return this._invoker.push(this.createLeaveOtherRoomCommand(room, isQuitPK, traceId));
24625
24851
  });
24626
24852
  }
24627
24853
  /**
@@ -24659,6 +24885,9 @@ class EnableInnerCDNCommand extends BaseCommand {
24659
24885
  this.cdnValues = cdnValues;
24660
24886
  this.enable = enable;
24661
24887
  }
24888
+ get kind() {
24889
+ return RCCommandKind.ENABLE_INNER_CDN;
24890
+ }
24662
24891
  execute(store, invoker) {
24663
24892
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24664
24893
  return __awaiter(this, void 0, void 0, function* () {
@@ -24744,6 +24973,9 @@ class RTCIdentityChangeCommand extends BaseCommand {
24744
24973
  this.livingType = livingType;
24745
24974
  this.traceId = traceId;
24746
24975
  }
24976
+ get kind() {
24977
+ return RCCommandKind.RTC_IDENTITY_CHANGE;
24978
+ }
24747
24979
  execute(store, invoker) {
24748
24980
  var _a;
24749
24981
  return __awaiter(this, void 0, void 0, function* () {
@@ -24899,9 +25131,8 @@ class RCLivingRoom extends RCAbstractRoom {
24899
25131
  var _a;
24900
25132
  const { userId } = parseTrackId(resourceId);
24901
25133
  // 是否是主房间资源
24902
- // const isHostRoomResource = !!this._roomResources[userId]?.find(item => getTrackId(item) === resourceId)
24903
25134
  const isHostRoomResource = !!((_a = this._store.getResourcesByUserId(userId)) === null || _a === void 0 ? void 0 : _a.find((item) => getTrackId(item) === resourceId));
24904
- // 是否是主房间资源
25135
+ // 是否是副房间资源
24905
25136
  let isPKRoomResource = false;
24906
25137
  /**
24907
25138
  * 无副房间时,只验证是否为主房间资源
@@ -24933,7 +25164,7 @@ class RCLivingRoom extends RCAbstractRoom {
24933
25164
  * 副房间不可调用
24934
25165
  */
24935
25166
  if (!this._store.isMainRoom) {
24936
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'the `getMCUConfigBuilder` is disabled in PK room');
25167
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O, 'the `getMCUConfigBuilder` is disabled in PK room');
24937
25168
  return { code: RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM };
24938
25169
  }
24939
25170
  return this._mcuConfigBuilder;
@@ -25023,7 +25254,7 @@ class RCLivingRoom extends RCAbstractRoom {
25023
25254
  * @override
25024
25255
  * 加入 PK 房间回调
25025
25256
  */
25026
- _onJoinedPKRoom(roomId, room) {
25257
+ _onJoinedPKRoom(roomId, traceId) {
25027
25258
  return __awaiter(this, void 0, void 0, function* () {
25028
25259
  /**
25029
25260
  * 加入副房间之后,如果己方发布过资源,且参与连麦,
@@ -25032,8 +25263,7 @@ class RCLivingRoom extends RCAbstractRoom {
25032
25263
  this._invoker.push(new ExchangeWithPushOtherRoomCommand(roomId, (pcName) => ({
25033
25264
  pushOtherRooms: this._getPushOtherRoomsParams(),
25034
25265
  headers: this._getRTCReqestHeaders(pcName),
25035
- }), this._roomPKHandler));
25036
- // push(async () => this._onLeavePKRoom(roomId))
25266
+ }), this._roomPKHandler, traceId));
25037
25267
  });
25038
25268
  }
25039
25269
  /**
@@ -25222,7 +25452,7 @@ class RCAudienceClient {
25222
25452
  this._appListener = null;
25223
25453
  this._crtUserId = this._context.getCurrentId();
25224
25454
  this._service = new RCMediaService(runtime, _context, _initOption.mediaServer);
25225
- this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._crtUserId, this._reTryExchange.bind(this), this._crtUserId, undefined, false, _initOption);
25455
+ this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._crtUserId, this._reTryExchange.bind(this), this._crtUserId, undefined, false, _initOption, true);
25226
25456
  /**
25227
25457
  * 利用 store 存储数据
25228
25458
  */
@@ -25230,7 +25460,6 @@ class RCAudienceClient {
25230
25460
  this._peerCManager.setStore(this._store);
25231
25461
  }
25232
25462
  _getReqHeaders(livingType) {
25233
- var _a, _b;
25234
25463
  return __awaiter(this, void 0, void 0, function* () {
25235
25464
  // 直播观众端 RoomId 与 UserId 保持一致
25236
25465
  const roomId = this._crtUserId;
@@ -25238,22 +25467,17 @@ class RCAudienceClient {
25238
25467
  if (!this._rtcToken) {
25239
25468
  const { code, data } = yield this._context.getRTCToken(roomId, RTCMode.LIVE, livingType);
25240
25469
  if (code !== ErrorCode.SUCCESS) {
25241
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `getRTCToken failed: ${code}`);
25242
25470
  return { code: RCRTCCode.SIGNAL_ERROR };
25243
25471
  }
25244
25472
  this._rtcToken = data.rtcToken;
25245
25473
  }
25474
+ /**
25475
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
25476
+ */
25477
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
25246
25478
  return {
25247
25479
  code: RCRTCCode.SUCCESS,
25248
- headers: {
25249
- 'App-Key': this._context.getAppkey(),
25250
- UserId: this._crtUserId,
25251
- RoomId: roomId,
25252
- RoomType: RTCMode.LIVE,
25253
- Token: this._rtcToken,
25254
- 'Peer-Connection-Id': this._pcName,
25255
- 'Client-Session-Id': this._clientSessionId,
25256
- },
25480
+ headers: Object.assign({ 'App-Key': this._context.getAppkey(), UserId: this._crtUserId, RoomId: roomId, RoomType: RTCMode.LIVE, Token: this._rtcToken, 'Client-Session-Id': this._clientSessionId }, peerConnectionId),
25257
25481
  };
25258
25482
  });
25259
25483
  }
@@ -25290,7 +25514,7 @@ class RCAudienceClient {
25290
25514
  });
25291
25515
  }
25292
25516
  __subscribe(liveUrl, livingType, mediaType, subTiny = false) {
25293
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
25517
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
25294
25518
  return __awaiter(this, void 0, void 0, function* () {
25295
25519
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_T, JSON.stringify({
25296
25520
  liveUrl,
@@ -25311,8 +25535,7 @@ class RCAudienceClient {
25311
25535
  !this._fromRetry && ((_e = this._pc) === null || _e === void 0 ? void 0 : _e.clearReTryExchangeTimer());
25312
25536
  this._fromRetry = false;
25313
25537
  if (!isString(liveUrl)) {
25314
- (_g = (_f = this._context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `liveUrl is invalid: ${liveUrl}`);
25315
- (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25538
+ (_g = (_f = this._context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25316
25539
  status: RCLoggerStatus.FAILED,
25317
25540
  code: RCRTCCode.PARAMS_ERROR,
25318
25541
  msg: `params error -> liveUrl: ${liveUrl}`,
@@ -25320,8 +25543,8 @@ class RCAudienceClient {
25320
25543
  return { code: RCRTCCode.PARAMS_ERROR, tracks };
25321
25544
  }
25322
25545
  if (![RCLivingType.AUDIO, RCLivingType.VIDEO].includes(livingType)) {
25323
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.error(`livingType is invalid: ${livingType}`);
25324
- (_o = (_m = this._context) === null || _m === void 0 ? void 0 : _m.logger) === null || _o === void 0 ? void 0 : _o.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25546
+ (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(`livingType is invalid: ${livingType}`);
25547
+ (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25325
25548
  status: RCLoggerStatus.FAILED,
25326
25549
  code: RCRTCCode.PARAMS_ERROR,
25327
25550
  msg: `params error -> livingType: ${livingType}`,
@@ -25329,8 +25552,7 @@ class RCAudienceClient {
25329
25552
  return { code: RCRTCCode.PARAMS_ERROR, tracks };
25330
25553
  }
25331
25554
  if (![RCMediaType.AUDIO_ONLY, RCMediaType.VIDEO_ONLY, RCMediaType.AUDIO_VIDEO].includes(mediaType)) {
25332
- (_q = (_p = this._context) === null || _p === void 0 ? void 0 : _p.logger) === null || _q === void 0 ? void 0 : _q.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `mediaType is invalid: ${mediaType}`);
25333
- (_s = (_r = this._context) === null || _r === void 0 ? void 0 : _r.logger) === null || _s === void 0 ? void 0 : _s.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25555
+ (_o = (_m = this._context) === null || _m === void 0 ? void 0 : _m.logger) === null || _o === void 0 ? void 0 : _o.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25334
25556
  status: RCLoggerStatus.FAILED,
25335
25557
  code: RCRTCCode.PARAMS_ERROR,
25336
25558
  msg: `params error -> -> mediaType: ${mediaType}`,
@@ -25339,7 +25561,7 @@ class RCAudienceClient {
25339
25561
  }
25340
25562
  // 允许观众动态切换大小流订阅,或重复订阅同一资源
25341
25563
  if (this._liveUrl && this._liveUrl !== liveUrl) {
25342
- (_u = (_t = this._context) === null || _t === void 0 ? void 0 : _t.logger) === null || _u === void 0 ? void 0 : _u.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25564
+ (_q = (_p = this._context) === null || _p === void 0 ? void 0 : _p.logger) === null || _q === void 0 ? void 0 : _q.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25343
25565
  status: RCLoggerStatus.FAILED,
25344
25566
  code: RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,
25345
25567
  msg: 'repeat subscribe',
@@ -25363,10 +25585,10 @@ class RCAudienceClient {
25363
25585
  // 构建 http req headers
25364
25586
  const { code, headers } = yield this._getReqHeaders(livingType);
25365
25587
  if (code !== RCRTCCode.SUCCESS) {
25366
- (_w = (_v = this._context) === null || _v === void 0 ? void 0 : _v.logger) === null || _w === void 0 ? void 0 : _w.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25588
+ (_s = (_r = this._context) === null || _r === void 0 ? void 0 : _r.logger) === null || _s === void 0 ? void 0 : _s.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25367
25589
  status: RCLoggerStatus.FAILED,
25368
25590
  code,
25369
- msg: '',
25591
+ msg: 'getRTCToken failed',
25370
25592
  }));
25371
25593
  return { code, tracks };
25372
25594
  }
@@ -25390,25 +25612,21 @@ class RCAudienceClient {
25390
25612
  };
25391
25613
  const resp = yield this._service.broadcastSubscribe(headers, body);
25392
25614
  if (resp.code !== RCRTCCode.SUCCESS) {
25393
- (_y = (_x = this._context) === null || _x === void 0 ? void 0 : _x.logger) === null || _y === void 0 ? void 0 : _y.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `andience subscribe failed: ${resp.code}`);
25394
- (_0 = (_z = this._context) === null || _z === void 0 ? void 0 : _z.logger) === null || _0 === void 0 ? void 0 : _0.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25615
+ (_u = (_t = this._context) === null || _t === void 0 ? void 0 : _t.logger) === null || _u === void 0 ? void 0 : _u.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25395
25616
  status: RCLoggerStatus.FAILED,
25396
25617
  code: resp.code,
25397
- msg: `andience subscribe failed: ${resp.code}`,
25398
25618
  }));
25399
25619
  return { code: resp.code, tracks };
25400
25620
  }
25401
25621
  const data = resp.data;
25402
25622
  if (data.resultCode !== RCRTCCode.SUCCESS) {
25403
- (_2 = (_1 = this._context) === null || _1 === void 0 ? void 0 : _1.logger) === null || _2 === void 0 ? void 0 : _2.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `andience subscribe failed! code: ${data.resultCode}; message: ${data.message}`);
25404
- (_4 = (_3 = this._context) === null || _3 === void 0 ? void 0 : _3.logger) === null || _4 === void 0 ? void 0 : _4.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25623
+ (_w = (_v = this._context) === null || _v === void 0 ? void 0 : _v.logger) === null || _w === void 0 ? void 0 : _w.error(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25405
25624
  status: RCLoggerStatus.FAILED,
25406
25625
  code: data.resultCode,
25407
- msg: `andience subscribe failed! code: ${data.resultCode}; message: ${data.message}`,
25626
+ msg: data.message,
25408
25627
  }));
25409
25628
  return { code: data.resultCode, tracks };
25410
25629
  }
25411
- (_6 = (_5 = this._context) === null || _5 === void 0 ? void 0 : _5.logger) === null || _6 === void 0 ? void 0 : _6.debug(RCLoggerTag.L_OLD_DAILY_RECORD_O, `andience subscribe success: ${liveUrl}`);
25412
25630
  this._livingType = livingType;
25413
25631
  this._mediaType = mediaType;
25414
25632
  this._subTiny = subTiny;
@@ -25427,7 +25645,7 @@ class RCAudienceClient {
25427
25645
  readyTracks && this._updateTrackIdSSRCMap(answer.sdp, readyTracks);
25428
25646
  // 缓存订阅资源的ssrc和msid
25429
25647
  // AbstractStatParser.formatSourceIdMapFromSdp(answer.sdp, 'subscribe');
25430
- (_8 = (_7 = this._context) === null || _7 === void 0 ? void 0 : _7.logger) === null || _8 === void 0 ? void 0 : _8.info(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25648
+ (_y = (_x = this._context) === null || _x === void 0 ? void 0 : _x.logger) === null || _y === void 0 ? void 0 : _y.info(RCLoggerTag.L_AUDIENCE_CLIENT_SUBSCRIBE_R, JSON.stringify({
25431
25649
  status: RCLoggerStatus.SUCCESSED,
25432
25650
  liveUrl,
25433
25651
  }));
@@ -25456,7 +25674,7 @@ class RCAudienceClient {
25456
25674
  });
25457
25675
  }
25458
25676
  __unsubscribe() {
25459
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
25677
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25460
25678
  return __awaiter(this, void 0, void 0, function* () {
25461
25679
  (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T, JSON.stringify({
25462
25680
  liveUrl: this._liveUrl,
@@ -25475,19 +25693,15 @@ class RCAudienceClient {
25475
25693
  const { headers } = yield this._getReqHeaders();
25476
25694
  const { code } = yield this._service.broadcastExit(headers);
25477
25695
  if (code !== RCRTCCode.SUCCESS) {
25478
- (_g = (_f = this._context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `broadcast unsubscribe failed: ${code}`);
25479
- (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(RCLoggerTag.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R, JSON.stringify({
25696
+ (_g = (_f = this._context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.error(RCLoggerTag.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R, JSON.stringify({
25480
25697
  status: RCLoggerStatus.FAILED,
25481
25698
  code,
25482
- msg: `broadcast unsubscribe failed: ${code}`,
25483
25699
  }));
25484
25700
  }
25485
25701
  else {
25486
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.debug(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'broadcast unsubscribe success');
25487
- (_o = (_m = this._context) === null || _m === void 0 ? void 0 : _m.logger) === null || _o === void 0 ? void 0 : _o.info(RCLoggerTag.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R, JSON.stringify({
25702
+ (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.info(RCLoggerTag.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R, JSON.stringify({
25488
25703
  status: RCLoggerStatus.SUCCESSED,
25489
25704
  liveUrl: this._liveUrl,
25490
- msg: 'broadcast unsubscribe success',
25491
25705
  }));
25492
25706
  this._subscribedList = [];
25493
25707
  }
@@ -25511,16 +25725,17 @@ class RCAudienceClient {
25511
25725
  this._appListener = listener;
25512
25726
  }
25513
25727
  _onTrackReady(evt) {
25514
- var _a, _b, _c, _d;
25728
+ var _a, _b, _c, _d, _e, _f;
25515
25729
  const { track } = evt.receiver;
25516
25730
  const mediaType = track.kind === 'audio' ? RCMediaType.AUDIO_ONLY : RCMediaType.VIDEO_ONLY;
25517
25731
  const rTrack = this._subTracks[mediaType];
25518
25732
  rTrack.__innerSetMediaStreamTrack(track);
25519
25733
  try {
25520
- (_b = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a.onTrackReady) === null || _b === void 0 ? void 0 : _b.call(_a, rTrack);
25734
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O, `trackId: ${rTrack.getTrackId()}`);
25735
+ (_d = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c.onTrackReady) === null || _d === void 0 ? void 0 : _d.call(_c, rTrack);
25521
25736
  }
25522
25737
  catch (error) {
25523
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, JSON.stringify(error));
25738
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O, JSON.stringify(error));
25524
25739
  }
25525
25740
  }
25526
25741
  }
@@ -25586,14 +25801,12 @@ class RCAudienceLivingRoom {
25586
25801
  // 北极星数据
25587
25802
  this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this, PolarisRole.Audience);
25588
25803
  this._polarisReport.sendR1();
25589
- this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._crtUserId, this._polarisReport, true, this._initOptions);
25804
+ this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._crtUserId, this._polarisReport, true, this._initOptions, true);
25590
25805
  // 注册监听 rtc_ntf 信令数据,解码后拉取指定房间数据
25591
25806
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
25592
- var _a, _b;
25593
25807
  // 1. 拉取数据,非本房间可不拉取
25594
25808
  // 2. 拉取完成后调用原通知方法 this.singalDataChange(_roomId)
25595
25809
  const { time, type, roomId } = this._context.decodeRtcNotify(buffer);
25596
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `registerRTCSignalListener -> ${JSON.stringify({ time, type, roomId })}`);
25597
25810
  switch (type) {
25598
25811
  case 1:
25599
25812
  // RTC KV拉取
@@ -25610,7 +25823,7 @@ class RCAudienceLivingRoom {
25610
25823
  this._setInitData();
25611
25824
  }
25612
25825
  _startPull(roomId, timestamp) {
25613
- var _a, _b;
25826
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25614
25827
  return __awaiter(this, void 0, void 0, function* () {
25615
25828
  if (this._isPulling) {
25616
25829
  return;
@@ -25621,14 +25834,17 @@ class RCAudienceLivingRoom {
25621
25834
  this._isPulling = false;
25622
25835
  return;
25623
25836
  }
25837
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
25838
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T, `pullTime: ${this._pullTime}`, traceId);
25624
25839
  const { code, data } = yield this._context.pullRTCRoomEntry(roomId);
25625
25840
  if (code === ErrorCode.SUCCESS) {
25626
25841
  this._isPulling = false;
25627
25842
  this._pullTime = data.syncTime || 0;
25628
25843
  const kvEntries = (data === null || data === void 0 ? void 0 : data.kvEntries) || [];
25629
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `_startPull -> ${JSON.stringify(kvEntries)}`);
25630
- this.singalDataChange(kvEntries, roomId);
25844
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R, `status: ${RCLoggerStatus.SUCCESSED}, kvEntries: ${JSON.stringify(kvEntries)}`, traceId);
25845
+ this.singalDataChange(kvEntries, roomId, traceId);
25631
25846
  }
25847
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R, `status: ${RCLoggerStatus.FAILED}, code: ${code}`, traceId);
25632
25848
  });
25633
25849
  }
25634
25850
  /**
@@ -25690,10 +25906,7 @@ class RCAudienceLivingRoom {
25690
25906
  });
25691
25907
  }
25692
25908
  _assertRoomDestroyed() {
25693
- var _a, _b;
25694
25909
  if (this._destroyed) {
25695
- const msg = 'This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.';
25696
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, msg);
25697
25910
  return RCRTCCode.ROOM_HAS_BEEN_DESTROYED;
25698
25911
  }
25699
25912
  }
@@ -25706,26 +25919,18 @@ class RCAudienceLivingRoom {
25706
25919
  * * key RC_RTC_SESSIONID value: sessionId
25707
25920
  * * key RC_CDN value: CDN 资源数据
25708
25921
  */
25709
- singalDataChange(singalData, roomId) {
25710
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
25711
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_T, JSON.stringify({
25712
- singalData,
25713
- roomId,
25714
- userId: this._crtUserId,
25715
- }));
25922
+ singalDataChange(singalData, roomId, traceId) {
25923
+ var _a, _b, _c;
25716
25924
  if (roomId !== this._roomId) {
25717
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `singalDataChange -> not the current room data: data roomId: ${roomId}, current roomId: ${this._roomId}`);
25718
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_R, JSON.stringify({
25925
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P, JSON.stringify({
25719
25926
  status: RCLoggerStatus.FAILED,
25720
- code: '',
25721
- msg: `id inconsistency -> params id:${roomId},current id:${this._roomId}`,
25722
- }));
25927
+ msg: `roomId inconsistency -> params roomId:${roomId}, current roomId:${this._roomId}`,
25928
+ }), traceId);
25723
25929
  return;
25724
25930
  }
25725
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.debug(RCLoggerTag.L_OLD_DAILY_RECORD_O, `singalDataChange -> singalData: ${JSON.stringify(singalData || {})}`);
25726
25931
  const allMcuUris = [];
25727
- const CDNUrisStr = (_j = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _j === void 0 ? void 0 : _j.value;
25728
- CDNUrisStr && this._diffCDNUris(JSON.parse(JSON.parse(CDNUrisStr).cdn_uris)[0]);
25932
+ const CDNUrisStr = (_c = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _c === void 0 ? void 0 : _c.value;
25933
+ CDNUrisStr && this._diffCDNUris(JSON.parse(JSON.parse(CDNUrisStr).cdn_uris)[0], traceId);
25729
25934
  singalData.forEach((data) => {
25730
25935
  const { key, value, timestamp, uid, } = data;
25731
25936
  const isResKey = key.indexOf('RC_RES_') !== -1;
@@ -25735,7 +25940,7 @@ class RCAudienceLivingRoom {
25735
25940
  const anchorUris = JSON.parse(serverUris.uris || '[]');
25736
25941
  allMcuUris.push(...mcuUris);
25737
25942
  // 处理主播发布的分流资源
25738
- this._diffAnchorResource(anchorUris, uid);
25943
+ this._diffAnchorResource(anchorUris, uid, traceId);
25739
25944
  return;
25740
25945
  }
25741
25946
  // 处理主播列表
@@ -25743,21 +25948,15 @@ class RCAudienceLivingRoom {
25743
25948
  const anchorUserIds = JSON.parse(value || '[]');
25744
25949
  const { joinUserIds, leftUserIds } = this._diffAnchorList(anchorUserIds);
25745
25950
  if (joinUserIds.length > 0) {
25746
- this._handleNewJoinedAnchor(joinUserIds);
25951
+ this._handleNewJoinedAnchor(joinUserIds, traceId);
25747
25952
  }
25748
25953
  if (leftUserIds.length > 0) {
25749
- this._handleLeftedAnchor(leftUserIds);
25954
+ this._handleLeftedAnchor(leftUserIds, traceId);
25750
25955
  }
25751
25956
  }
25752
25957
  });
25753
25958
  // 处理直播间 MCU 合流资源资源
25754
- this._diffRoomResource(allMcuUris);
25755
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_R, JSON.stringify({
25756
- status: RCLoggerStatus.SUCCESSED,
25757
- singalData,
25758
- roomId,
25759
- userId: this._crtUserId,
25760
- }));
25959
+ this._diffRoomResource(allMcuUris, traceId);
25761
25960
  }
25762
25961
  /**
25763
25962
  * 计算加入离开的主播 ID 列表
@@ -25770,19 +25969,18 @@ class RCAudienceLivingRoom {
25770
25969
  joinUserIds,
25771
25970
  };
25772
25971
  }
25773
- _handleNewJoinedAnchor(list) {
25972
+ _handleNewJoinedAnchor(list, traceId) {
25774
25973
  var _a, _b;
25775
25974
  // 更新 _roomAnchorList
25776
25975
  this._roomAnchorList.push(...list);
25777
25976
  // 触发 app 主播加入监听
25778
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25779
- status: RCLoggerStatus.SUCCESSED,
25977
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25780
25978
  eventType: 'onAnchorJoin',
25781
25979
  list,
25782
- }));
25980
+ }), traceId);
25783
25981
  this._callAppListener('onAnchorJoin', list);
25784
25982
  }
25785
- _handleLeftedAnchor(list) {
25983
+ _handleLeftedAnchor(list, traceId) {
25786
25984
  var _a, _b;
25787
25985
  return __awaiter(this, void 0, void 0, function* () {
25788
25986
  // 更新 _roomAnchorList
@@ -25798,18 +25996,17 @@ class RCAudienceLivingRoom {
25798
25996
  tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
25799
25997
  }
25800
25998
  // 触发 app 主播离开监听
25801
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25802
- status: RCLoggerStatus.SUCCESSED,
25999
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25803
26000
  eventType: 'onAnchorLeave',
25804
26001
  list,
25805
- }));
26002
+ }), traceId);
25806
26003
  this._callAppListener('onAnchorLeave', list);
25807
26004
  });
25808
26005
  }
25809
26006
  /**
25810
26007
  * 计算新发布和取消发布的合流资源
25811
26008
  */
25812
- _diffRoomResource(uris) {
26009
+ _diffRoomResource(uris, traceId) {
25813
26010
  var _a, _b;
25814
26011
  return __awaiter(this, void 0, void 0, function* () {
25815
26012
  const newPubTracks = [];
@@ -25845,31 +26042,23 @@ class RCAudienceLivingRoom {
25845
26042
  });
25846
26043
  // 通知 APP 新发布的 tracks
25847
26044
  if (newPubTracks.length > 0) {
25848
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25849
- status: RCLoggerStatus.SUCCESSED,
26045
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25850
26046
  eventType: 'onTrackPublish',
25851
26047
  trackIds: newPubTracks.map((track) => track.getTrackId()),
25852
- }));
26048
+ }), traceId);
25853
26049
  this._callAppListener('onTrackPublish', newPubTracks);
25854
26050
  }
25855
26051
  if (unpubTracks.length > 0) {
25856
- this._onUserUnpublish(unpubTracks, 'onTrackUnpublish');
26052
+ this._onUserUnpublish(unpubTracks, 'onTrackUnpublish', traceId);
25857
26053
  }
25858
26054
  });
25859
26055
  }
25860
26056
  /**
25861
26057
  * 计算主播发布和取消发布的资源,以及资源的状态变更
25862
26058
  */
25863
- _diffAnchorResource(uris, userId) {
25864
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26059
+ _diffAnchorResource(uris, userId, traceId) {
26060
+ var _a, _b, _c, _d, _e, _f;
25865
26061
  return __awaiter(this, void 0, void 0, function* () {
25866
- /**
25867
- * 设置房间内 RTC 资源 ssrc 和 trackId map
25868
- */
25869
- uris.forEach((res) => {
25870
- const { ssrc, resourceId } = JSON.parse(res.uri);
25871
- this._store.setTrackIdSSRCMap(ssrc, resourceId);
25872
- });
25873
26062
  // 当前资源清单
25874
26063
  const nowRes = this._roomAnchorRes[userId] || (this._roomAnchorRes[userId] = []);
25875
26064
  const { publishedList, unpublishedList, modifiedList } = diffPublishResources(nowRes, uris);
@@ -25907,17 +26096,19 @@ class RCAudienceLivingRoom {
25907
26096
  // 重新订阅二次发布资源
25908
26097
  if (subedTracks.length) {
25909
26098
  const trackIds = subedTracks.map((item) => item.getTrackId());
25910
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.debug(RCLoggerTag.L_OLD_DAILY_RECORD_O, `resub tracks -> ${JSON.stringify(trackIds)}`);
25911
26099
  const { code } = yield push(() => this._subscribeHandle(subedTracks, true));
25912
26100
  if (code !== RCRTCCode.SUCCESS) {
25913
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `resub tracks failed -> code: ${code}, ids: ${JSON.stringify(trackIds)}`);
26101
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_RESUB_REPUB_RES_R, JSON.stringify({
26102
+ status: RCLoggerStatus.FAILED,
26103
+ trackIds,
26104
+ code,
26105
+ }));
25914
26106
  }
25915
26107
  }
25916
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25917
- status: RCLoggerStatus.SUCCESSED,
26108
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25918
26109
  eventType: 'onAnchorTrackPublish',
25919
26110
  trackIds: newTracks.map((track) => track.getTrackId()),
25920
- }));
26111
+ }), traceId);
25921
26112
  this._callAppListener('onAnchorTrackPublish', newTracks);
25922
26113
  }
25923
26114
  if (unpublishedList.length) {
@@ -25932,7 +26123,7 @@ class RCAudienceLivingRoom {
25932
26123
  const trackId = getTrackId(item);
25933
26124
  return this._remoteTracks[trackId];
25934
26125
  });
25935
- yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish');
26126
+ yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish', traceId);
25936
26127
  }
25937
26128
  if (modifiedList.length) {
25938
26129
  const resIds = nowRes.map(getTrackId);
@@ -25944,27 +26135,17 @@ class RCAudienceLivingRoom {
25944
26135
  nowRes[index].state = item.state;
25945
26136
  const rTrack = this._remoteTracks[id];
25946
26137
  rTrack.__innerSetRemoteMuted(item.state === 0);
25947
- if (rTrack.isAudioTrack()) {
25948
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25949
- status: RCLoggerStatus.SUCCESSED,
25950
- eventType: 'onAudioMuteChange',
25951
- trackId: rTrack.getTrackId(),
25952
- }));
25953
- this._callAppListener('onAudioMuteChange', rTrack);
25954
- }
25955
- else {
25956
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25957
- status: RCLoggerStatus.SUCCESSED,
25958
- eventType: 'onVideoMuteChange',
25959
- trackId: rTrack.getTrackId(),
25960
- }));
25961
- this._callAppListener('onVideoMuteChange', rTrack);
25962
- }
26138
+ const eventType = rTrack.isAudioTrack() ? 'onAudioMuteChange' : 'onVideoMuteChange';
26139
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26140
+ eventType,
26141
+ trackId: rTrack.getTrackId(),
26142
+ }), traceId);
26143
+ this._callAppListener(eventType, rTrack);
25963
26144
  }
25964
26145
  }
25965
26146
  });
25966
26147
  }
25967
- _onUserUnpublish(tracks, eventName) {
26148
+ _onUserUnpublish(tracks, eventName, traceId) {
25968
26149
  var _a, _b;
25969
26150
  return __awaiter(this, void 0, void 0, function* () {
25970
26151
  // 需要替业务层取消订阅,业务层只需关注 UI 变化
@@ -25976,18 +26157,16 @@ class RCAudienceLivingRoom {
25976
26157
  delete this._remoteTracks[item.getTrackId()];
25977
26158
  });
25978
26159
  // 通知 APP 取消发布的 tracks
25979
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25980
- status: RCLoggerStatus.SUCCESSED,
26160
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
25981
26161
  eventType: eventName,
25982
26162
  trackIds: tracks.map((track) => track.getTrackId()),
25983
- }));
26163
+ }), traceId);
25984
26164
  this._callAppListener(eventName, tracks);
25985
26165
  });
25986
26166
  }
25987
26167
  _callAppListener(eventType, ...attrs) {
25988
- var _a, _b, _c, _d, _e;
25989
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `${eventType} callback -> ${JSON.stringify(attrs)}`);
25990
- const handle = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c[eventType];
26168
+ var _a, _b, _c;
26169
+ const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
25991
26170
  if (!handle) {
25992
26171
  return;
25993
26172
  }
@@ -25995,7 +26174,7 @@ class RCAudienceLivingRoom {
25995
26174
  handle(...attrs);
25996
26175
  }
25997
26176
  catch (error) {
25998
- (_e = (_d = this._context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, JSON.stringify(error));
26177
+ (_c = (_b = this._context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify(error));
25999
26178
  }
26000
26179
  }
26001
26180
  /**
@@ -26004,17 +26183,15 @@ class RCAudienceLivingRoom {
26004
26183
  _reTryExchange() {
26005
26184
  return __awaiter(this, void 0, void 0, function* () {
26006
26185
  push(() => __awaiter(this, void 0, void 0, function* () {
26007
- var _a, _b, _c, _d, _e;
26186
+ var _a;
26008
26187
  const { reqBody } = yield this._createSubscribeParams(this._subscribedList, {}, true);
26009
26188
  // 发送 /exchange 请求
26010
26189
  const resp = yield this._exchangeHandle(reqBody);
26011
26190
  if (resp.code !== RCRTCCode.SUCCESS) {
26012
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `reTryExchange failed: ${resp.code}`);
26013
26191
  return { code: resp.code };
26014
26192
  }
26015
26193
  const { sdp: answer, resultCode } = resp.data;
26016
26194
  if (resultCode !== RCRTCCode.SUCCESS) {
26017
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `reTryExchange failed: ${resultCode}`);
26018
26195
  return { code: resultCode };
26019
26196
  }
26020
26197
  // 请求成功,清除 ice 断线重连的定时器
@@ -26022,7 +26199,7 @@ class RCAudienceLivingRoom {
26022
26199
  const mcuSubList = this._subscribedList.filter((item) => item.track.isMCUTrack());
26023
26200
  if (mcuSubList.length > 0) {
26024
26201
  const mcuTrackId = mcuSubList[0].track.getTrackId();
26025
- const sdpMsid = (_e = this._roomRes[mcuTrackId]) === null || _e === void 0 ? void 0 : _e.msid;
26202
+ const sdpMsid = (_a = this._roomRes[mcuTrackId]) === null || _a === void 0 ? void 0 : _a.msid;
26026
26203
  const currentMsid = [this._roomId, 'RongCloudRTC'].join('_');
26027
26204
  answer.sdp = answer.sdp.replace(new RegExp(sdpMsid, 'g'), currentMsid);
26028
26205
  }
@@ -26089,23 +26266,28 @@ class RCAudienceLivingRoom {
26089
26266
  });
26090
26267
  }
26091
26268
  _subscribeHandle(tracks, forceReq = false) {
26092
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26269
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26093
26270
  return __awaiter(this, void 0, void 0, function* () {
26271
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26272
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T, JSON.stringify({
26273
+ trackIds: tracks.map(getTrackIdFromAttr),
26274
+ forceReq,
26275
+ }), traceId);
26094
26276
  const roomStatusCode = this._assertRoomDestroyed();
26095
26277
  if (roomStatusCode) {
26096
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26278
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26097
26279
  status: RCLoggerStatus.FAILED,
26098
26280
  code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26099
26281
  msg: 'room destroyed',
26100
- }));
26282
+ }), traceId);
26101
26283
  return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26102
26284
  }
26103
26285
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
26104
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26286
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26105
26287
  status: RCLoggerStatus.FAILED,
26106
26288
  code: RCRTCCode.PARAMS_ERROR,
26107
26289
  msg: 'params error -> tracks',
26108
- }));
26290
+ }), traceId);
26109
26291
  return { code: RCRTCCode.PARAMS_ERROR };
26110
26292
  }
26111
26293
  const { pc, pcName } = this._peerCManager.createPeerCList(tracks)[0];
@@ -26136,23 +26318,15 @@ class RCAudienceLivingRoom {
26136
26318
  trackChanged = true;
26137
26319
  });
26138
26320
  if (!trackChanged && !forceReq) {
26139
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.warn(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26140
- status: RCLoggerStatus.FAILED,
26141
- code: '',
26321
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.warn(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26322
+ status: RCLoggerStatus.SUCCESSED,
26142
26323
  msg: 'repeat subscribe',
26143
- }));
26324
+ }), traceId);
26144
26325
  return { code: RCRTCCode.SUCCESS };
26145
26326
  }
26146
26327
  // 北极星上报
26147
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26148
- (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R, JSON.stringify({
26149
- status: RCLoggerStatus.SUCCESSED,
26150
- trackIds: tracks.map(getTrackIdFromAttr),
26151
- roomId: this._roomId,
26152
- userId: this._crtUserId,
26153
- forceReq,
26154
- }));
26155
- return this._updateSubListHandle(crtSubList, true);
26328
+ (_l = this._polarisReport) === null || _l === void 0 ? void 0 : _l.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26329
+ return this._updateSubListHandle(crtSubList, true, traceId);
26156
26330
  });
26157
26331
  }
26158
26332
  /**
@@ -26166,12 +26340,11 @@ class RCAudienceLivingRoom {
26166
26340
  const trackId = [msid, track.kind === 'audio' ? RCMediaType.AUDIO_ONLY : RCMediaType.VIDEO_ONLY].join('_');
26167
26341
  const rTrack = this._remoteTracks[trackId];
26168
26342
  if (!rTrack) {
26169
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `cannot found RCRemoteTrack: ${track.id}`);
26343
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.warn(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O, `cannot found RCRemoteTrack: ${track.id}`);
26170
26344
  return;
26171
26345
  }
26172
26346
  rTrack.__innerSetMediaStreamTrack(track);
26173
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26174
- status: RCLoggerStatus.SUCCESSED,
26347
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26175
26348
  eventType: 'onTrackReady',
26176
26349
  trackId: rTrack.getTrackId(),
26177
26350
  }));
@@ -26180,31 +26353,23 @@ class RCAudienceLivingRoom {
26180
26353
  }
26181
26354
  _getReqHeaders() {
26182
26355
  const userId = this._crtUserId;
26356
+ /**
26357
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
26358
+ */
26359
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
26183
26360
  // 直播观众端 RoomId 与 UserId 保持一致
26184
- return {
26185
- 'App-Key': this._context.getAppkey(),
26186
- RoomId: userId,
26187
- Token: this._joinResData.token,
26188
- RoomType: RTCMode.LIVE,
26189
- UserId: userId,
26190
- 'Session-Id': this._sessionId,
26191
- 'Peer-Connection-Id': this._pcName,
26192
- 'Client-Session-Id': this._clientSessionId,
26193
- };
26361
+ return Object.assign({ 'App-Key': this._context.getAppkey(), RoomId: userId, Token: this._joinResData.token, RoomType: RTCMode.LIVE, UserId: userId, 'Session-Id': this._sessionId, 'Client-Session-Id': this._clientSessionId }, peerConnectionId);
26194
26362
  }
26195
26363
  _exchangeHandle(body) {
26196
26364
  return this._service.broadcastSubscribe(this._getReqHeaders(), body);
26197
26365
  }
26198
- _updateSubListHandle(tracks, forceReq = false) {
26199
- var _a, _b, _c, _d, _e;
26366
+ _updateSubListHandle(tracks, forceReq = false, traceId) {
26367
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26200
26368
  return __awaiter(this, void 0, void 0, function* () {
26201
- const roomStatusCode = this._assertRoomDestroyed();
26202
- if (roomStatusCode) {
26203
- return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26204
- }
26205
- if (!validate('resources', tracks, () => isArray(tracks) && tracks.every((res) => res instanceof RCRemoteTrack || res.track instanceof RCRemoteTrack), true)) {
26206
- return { code: RCRTCCode.PARAMS_ERROR };
26207
- }
26369
+ (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T, JSON.stringify({
26370
+ trackIds: tracks.map(getTrackIdFromAttr),
26371
+ forceReq,
26372
+ }), traceId);
26208
26373
  let attrs = tracks.map((item) => (item instanceof RCRemoteTrack ? { track: item } : Object.assign({}, item)));
26209
26374
  // resourceId 去重,并做数据深拷贝
26210
26375
  const map = {};
@@ -26239,6 +26404,10 @@ class RCAudienceLivingRoom {
26239
26404
  changed = true;
26240
26405
  }
26241
26406
  if (!changed) {
26407
+ (_c = (_b = this._context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R, JSON.stringify({
26408
+ status: RCLoggerStatus.SUCCESSED,
26409
+ msg: 'repeat subscribe',
26410
+ }), traceId);
26242
26411
  return { code: RCRTCCode.SUCCESS };
26243
26412
  }
26244
26413
  }
@@ -26248,12 +26417,6 @@ class RCAudienceLivingRoom {
26248
26417
  // 连通率相关埋点-订阅开始
26249
26418
  recordQualitySubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26250
26419
  recordQualityUnsubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26251
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T, JSON.stringify({
26252
- trackIds: tracks.map(getTrackIdFromAttr),
26253
- roomId: this._roomId,
26254
- userId: this._crtUserId,
26255
- forceReq,
26256
- }));
26257
26420
  // MediaServer 交互
26258
26421
  const { reqBody } = yield this._createSubscribeParams(attrs, {}, false);
26259
26422
  const result = yield this._exchangeHandle(reqBody);
@@ -26263,16 +26426,24 @@ class RCAudienceLivingRoom {
26263
26426
  crtSubList.forEach((item) => {
26264
26427
  resourceIds.push(item.track.getTrackId());
26265
26428
  });
26266
- (_c = this._pc.reportParser) === null || _c === void 0 ? void 0 : _c.clearLatestPacketsRecv(resourceIds);
26429
+ (_d = this._pc.reportParser) === null || _d === void 0 ? void 0 : _d.clearLatestPacketsRecv(resourceIds);
26267
26430
  }
26268
26431
  if (result.code !== RCRTCCode.SUCCESS) {
26269
26432
  reportQualitySubscribeAndUnsubscribeData(attrs, result.code);
26433
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R, JSON.stringify({
26434
+ status: RCLoggerStatus.FAILED,
26435
+ code: result.code,
26436
+ }), traceId);
26270
26437
  return { code: result.code };
26271
26438
  }
26272
26439
  const { sdp: answer, resultCode, message, subscribedList, } = result.data;
26273
26440
  if (resultCode !== RCRTCCode.SUCCESS) {
26274
26441
  reportQualitySubscribeAndUnsubscribeData(attrs, resultCode);
26275
- (_e = (_d = this._context) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `change subscribe list failed: ${message}, ${resultCode}`);
26442
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R, JSON.stringify({
26443
+ status: RCLoggerStatus.FAILED,
26444
+ code: resultCode,
26445
+ msg: message,
26446
+ }), traceId);
26276
26447
  return { code: resultCode };
26277
26448
  }
26278
26449
  // 修改 answer.sdp 中 msid
@@ -26288,6 +26459,11 @@ class RCAudienceLivingRoom {
26288
26459
  const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
26289
26460
  if (resCode !== RCRTCCode.SUCCESS) {
26290
26461
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
26462
+ (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R, JSON.stringify({
26463
+ status: RCLoggerStatus.FAILED,
26464
+ code: resCode,
26465
+ msg: 'set remote answer error',
26466
+ }), traceId);
26291
26467
  return { code: resCode };
26292
26468
  }
26293
26469
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
@@ -26310,6 +26486,11 @@ class RCAudienceLivingRoom {
26310
26486
  }
26311
26487
  // 更新本地订阅关系
26312
26488
  this._subscribedList.splice(0, this._subscribedList.length, ...subSuccessList);
26489
+ (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R, JSON.stringify({
26490
+ status: RCLoggerStatus.SUCCESSED,
26491
+ subSuccessTrackIds,
26492
+ failedList,
26493
+ }), traceId);
26313
26494
  return failedList.length ? { code: RCRTCCode.SUCCESS, failedList } : { code: RCRTCCode.SUCCESS };
26314
26495
  });
26315
26496
  }
@@ -26317,17 +26498,16 @@ class RCAudienceLivingRoom {
26317
26498
  * 对比 cdn_uris 资源
26318
26499
  * @param newCDNUris 新的 cdn_uris 数据
26319
26500
  */
26320
- _diffCDNUris(newCDNUris) {
26501
+ _diffCDNUris(newCDNUris, traceId) {
26321
26502
  var _a, _b, _c, _d, _e, _f;
26322
26503
  return __awaiter(this, void 0, void 0, function* () {
26323
26504
  /**
26324
26505
  * CDN 资源减少: 上次 CDNUris 中有 url,变更后无 url
26325
26506
  */
26326
26507
  if (this._CDNUris.url && !newCDNUris.url) {
26327
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26328
- status: RCLoggerStatus.SUCCESSED,
26508
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26329
26509
  eventType: 'onCDNInfoDisable',
26330
- }));
26510
+ }), traceId);
26331
26511
  this._callAppListener('onCDNInfoDisable');
26332
26512
  /**
26333
26513
  * 更新内存中存储的 cdn_uris 数据
@@ -26341,12 +26521,11 @@ class RCAudienceLivingRoom {
26341
26521
  * 上次 CDNUris 无 url,变更后有 url
26342
26522
  */
26343
26523
  if (!this._CDNUris || (!this._CDNUris.url && newCDNUris.url)) {
26344
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26345
- status: RCLoggerStatus.SUCCESSED,
26524
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26346
26525
  eventType: 'onCDNInfoEnable',
26347
26526
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26348
26527
  fps: `FPS_${newCDNUris.fps}`,
26349
- }));
26528
+ }), traceId);
26350
26529
  this._callAppListener('onCDNInfoEnable', {
26351
26530
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26352
26531
  fps: `FPS_${newCDNUris.fps}`,
@@ -26359,12 +26538,11 @@ class RCAudienceLivingRoom {
26359
26538
  const isHChange = (this._CDNUris.h && newCDNUris.h && (this._CDNUris.h !== newCDNUris.h));
26360
26539
  const isFpsChange = (this._CDNUris.fps && newCDNUris.fps && (this._CDNUris.fps !== newCDNUris.fps));
26361
26540
  if (isWChange || isHChange || isFpsChange) {
26362
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26363
- status: RCLoggerStatus.SUCCESSED,
26541
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26364
26542
  eventType: 'onCDNInfoChange',
26365
26543
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26366
26544
  fps: `FPS_${newCDNUris.fps}`,
26367
- }));
26545
+ }), traceId);
26368
26546
  this._callAppListener('onCDNInfoChange', {
26369
26547
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26370
26548
  fps: `FPS_${newCDNUris.fps}`,
@@ -26381,14 +26559,18 @@ class RCAudienceLivingRoom {
26381
26559
  * _CDNUris 无 url 时,说明未开启 CDN 推送
26382
26560
  * @returns CDNPlayUrl
26383
26561
  */
26384
- _getCDNPlayUrl(params) {
26385
- var _a, _b, _c, _d, _e, _f;
26562
+ _getCDNPlayUrl(params, traceId) {
26563
+ var _a, _b;
26386
26564
  return __awaiter(this, void 0, void 0, function* () {
26387
26565
  const { w, h, fps } = params;
26388
26566
  const kind = this._initOptions.pullInnerCDNProtocol || RCInnerCDNPullKind.FLV;
26389
26567
  const useHttps = (this._initOptions.pullInnerCDNUseHttps === RCInnerCDNPullIsHttps.NOT_HTTPS) ? RCInnerCDNPullIsHttps.NOT_HTTPS : RCInnerCDNPullIsHttps.HTTPS;
26390
26568
  if (!this._CDNUris.url) {
26391
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `cdn_uris url is empty, the anchor need to open or push CDN, code: ${RCRTCCode.CDN_RESOURCE_IS_EMPTY}`);
26569
+ (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R, JSON.stringify({
26570
+ status: RCLoggerStatus.FAILED,
26571
+ code: RCRTCCode.CDN_RESOURCE_IS_EMPTY,
26572
+ msg: 'cdn_uris url is empty, the anchor need to open or push CDN',
26573
+ }), traceId);
26392
26574
  return { code: RCRTCCode.CDN_RESOURCE_IS_EMPTY };
26393
26575
  }
26394
26576
  const headers = {
@@ -26417,12 +26599,10 @@ class RCAudienceLivingRoom {
26417
26599
  const paramsStr = paramsArr.join('&');
26418
26600
  let requestUrl = `${this._CDNUris.url}?`;
26419
26601
  paramsStr && (requestUrl += paramsStr);
26420
- const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl);
26602
+ const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl, traceId);
26421
26603
  if (code !== RCRTCCode.SUCCESS) {
26422
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `getCDNPlayUrl failed: ${code}`);
26423
26604
  return { code };
26424
26605
  }
26425
- (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `getCDNPlayUrl success: ${res === null || res === void 0 ? void 0 : res.data.pull_url}`);
26426
26606
  return {
26427
26607
  code,
26428
26608
  CDNPlayUrl: res === null || res === void 0 ? void 0 : res.data.pull_url,
@@ -26434,28 +26614,27 @@ class RCAudienceLivingRoom {
26434
26614
  * @returns CDNPlayUrl
26435
26615
  */
26436
26616
  getCDNPlayUrl(resolution, fps) {
26437
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26617
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26438
26618
  return __awaiter(this, void 0, void 0, function* () {
26439
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T, JSON.stringify({
26619
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26620
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T, JSON.stringify({
26440
26621
  resolution,
26441
26622
  fps,
26442
- }));
26623
+ }), traceId);
26443
26624
  if (resolution && !isValidResolution(resolution)) {
26444
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, '`resolution` is invalid');
26445
26625
  (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R, JSON.stringify({
26446
26626
  status: RCLoggerStatus.FAILED,
26447
26627
  code: RCRTCCode.PARAMS_ERROR,
26448
26628
  msg: 'params error -> resolution',
26449
- }));
26629
+ }), traceId);
26450
26630
  return { code: RCRTCCode.PARAMS_ERROR };
26451
26631
  }
26452
26632
  if (fps && !isValidFPS(fps)) {
26453
- (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, '`fps` is invalid');
26454
- (_k = (_j = this._context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R, JSON.stringify({
26633
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R, JSON.stringify({
26455
26634
  status: RCLoggerStatus.FAILED,
26456
26635
  code: RCRTCCode.PARAMS_ERROR,
26457
26636
  msg: 'params error -> fps',
26458
- }));
26637
+ }), traceId);
26459
26638
  return { code: RCRTCCode.PARAMS_ERROR };
26460
26639
  }
26461
26640
  const { width, height } = resolution ? transResolution(resolution) : { width: null, height: null };
@@ -26464,12 +26643,7 @@ class RCAudienceLivingRoom {
26464
26643
  width && (params.w = width);
26465
26644
  height && (params.h = height);
26466
26645
  fpsNum && (params.fps = fpsNum);
26467
- (_m = (_l = this._context) === null || _l === void 0 ? void 0 : _l.logger) === null || _m === void 0 ? void 0 : _m.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R, JSON.stringify({
26468
- status: RCLoggerStatus.SUCCESSED,
26469
- resolution,
26470
- fps,
26471
- }));
26472
- return this._getCDNPlayUrl(params);
26646
+ return this._getCDNPlayUrl(params, traceId);
26473
26647
  });
26474
26648
  }
26475
26649
  /**
@@ -26492,33 +26666,34 @@ class RCAudienceLivingRoom {
26492
26666
  __unsubscribe(tracks) {
26493
26667
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26494
26668
  return __awaiter(this, void 0, void 0, function* () {
26495
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T, JSON.stringify({
26669
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26670
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T, JSON.stringify({
26496
26671
  trackIds: tracks.map((track) => track.getTrackId()),
26497
- roomId: this._roomId,
26498
- userId: this._crtUserId,
26499
- }));
26500
- if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26501
- (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, `unsubscribe failed, tracks is invalid -> roomId: ${this._roomId}`);
26672
+ }), traceId);
26673
+ const roomStatusCode = this._assertRoomDestroyed();
26674
+ if (roomStatusCode) {
26502
26675
  (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R, JSON.stringify({
26676
+ status: RCLoggerStatus.FAILED,
26677
+ code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26678
+ msg: 'room destroyed',
26679
+ }), traceId);
26680
+ return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26681
+ }
26682
+ if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26683
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R, JSON.stringify({
26503
26684
  status: RCLoggerStatus.FAILED,
26504
26685
  code: RCRTCCode.PARAMS_ERROR,
26505
26686
  msg: 'params error -> tracks',
26506
- }));
26687
+ }), traceId);
26507
26688
  return { code: RCRTCCode.PARAMS_ERROR };
26508
26689
  }
26509
26690
  // 计算剩余订阅列表
26510
26691
  const crtSubList = this._subscribedList.map((item) => (Object.assign({}, item)))
26511
26692
  .filter((item) => !tracks.includes(item.track));
26512
26693
  // 北极星上报
26513
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26514
- (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R, JSON.stringify({
26515
- status: RCLoggerStatus.SUCCESSED,
26516
- trackIds: tracks.map((track) => track.getTrackId()),
26517
- roomId: this._roomId,
26518
- userId: this._crtUserId,
26519
- }));
26694
+ (_j = this._polarisReport) === null || _j === void 0 ? void 0 : _j.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26520
26695
  recordUnsubscribeCommand(true);
26521
- return this._updateSubListHandle(crtSubList, false);
26696
+ return this._updateSubListHandle(crtSubList, false, traceId);
26522
26697
  });
26523
26698
  }
26524
26699
  /**
@@ -26589,15 +26764,18 @@ class RCAudienceLivingRoom {
26589
26764
  * 断线重连后处理逻辑, SDK 内部处理调用
26590
26765
  */
26591
26766
  __onReconnected() {
26592
- var _a, _b;
26767
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26593
26768
  return __awaiter(this, void 0, void 0, function* () {
26594
26769
  /**
26595
26770
  * 重新加入房间后,从头拉取全量资源
26596
26771
  */
26772
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26773
+ (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T, undefined, traceId);
26597
26774
  const { code } = yield this._context.joinLivingRoomAsAudience(this._roomId, RTCMode.LIVE);
26598
26775
  if (code !== ErrorCode.SUCCESS) {
26599
- (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'join living room error when on reconnected');
26776
+ (_f = (_e = this._context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R, `status: ${RCLoggerStatus.FAILED}`, traceId);
26600
26777
  }
26778
+ (_h = (_g = this._context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
26601
26779
  });
26602
26780
  }
26603
26781
  /**
@@ -26617,8 +26795,7 @@ class RCAudienceLivingRoom {
26617
26795
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
26618
26796
  this._audioLevelReport = new RCAudioLevelReport(this);
26619
26797
  this._audioLevelReport.onAudioLevelChange(handler, gap || 1000);
26620
- (_c = (_b = this._context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_AUDIO_LEVEL_CHANGE_O, JSON.stringify({
26621
- status: RCLoggerStatus.SUCCESSED,
26798
+ (_c = (_b = this._context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O, JSON.stringify({
26622
26799
  handler: handler === null || handler === void 0 ? void 0 : handler.name,
26623
26800
  gap,
26624
26801
  }));
@@ -27897,7 +28074,7 @@ class RCRTCClient extends RCMediaStreamCapture {
27897
28074
  }
27898
28075
  reportSDKInfo() {
27899
28076
  this._context.reportSDKInfo({
27900
- 'plugin-rtc': "5.6.3-alpha.2",
28077
+ 'plugin-rtc': "5.6.3-alpha.5",
27901
28078
  });
27902
28079
  }
27903
28080
  }
@@ -28519,15 +28696,19 @@ class RTCContext {
28519
28696
  * @param valueInfo 全量资源数据
28520
28697
  * @param objectName 全量 URI 消息名
28521
28698
  */
28522
- setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28699
+ setRTCTotalRes(roomId, messageList, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28523
28700
  return __awaiter(this, void 0, void 0, function* () {
28524
28701
  const params = {
28525
28702
  objectName,
28526
- content: this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true),
28703
+ content: [],
28527
28704
  valueInfo: [
28528
28705
  this.codec.encode(RTCPB.RtcValueInfo, { key: 'uris', value: valueInfo }, true),
28529
28706
  ],
28530
28707
  };
28708
+ messageList.forEach((message) => {
28709
+ const encodeData = this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true);
28710
+ params.content.push(encodeData);
28711
+ });
28531
28712
  mcuValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true));
28532
28713
  cdnValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'cdn_uris', value: cdnValInfo }, true));
28533
28714
  const sourceData = this.codec.encode(RTCPB.RtcUserSetDataInput, params);
@@ -28886,7 +29067,7 @@ const installer = {
28886
29067
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28887
29068
  return false;
28888
29069
  }
28889
- VersionManage.add('plugin-rtc', "5.6.3-alpha.2");
29070
+ VersionManage.add('plugin-rtc', "5.6.3-alpha.5");
28890
29071
  if (!VersionManage.validEngine("^5.6.0")) {
28891
29072
  console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
28892
29073
  return false;
@@ -28900,8 +29081,8 @@ const installer = {
28900
29081
  RTCLogger.setLogger(originLogger);
28901
29082
  logger.setLogger(originLogger);
28902
29083
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28903
- 'RCRTC Version': "5.6.3-alpha.2",
28904
- Commit: "2fda2b34be0736183519f005f2d4157acd8a3161",
29084
+ 'RCRTC Version': "5.6.3-alpha.5",
29085
+ Commit: "48fe4c6914037db2dfd263f31aba741834041487",
28905
29086
  'browserInfo.browser': browserInfo.browser,
28906
29087
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28907
29088
  'browserInfo.version': browserInfo.version,