@rongcloud/plugin-rtc 5.6.3-alpha.3 → 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.3
3
- * CommitId - db726c933e72872baf32689bc9690c7a34f2bab2
4
- * Sun Nov 13 2022 23:10:47 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,6 +983,10 @@ 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";
@@ -972,6 +1002,10 @@ var RCLoggerTag;
972
1002
  * 队列任务执行结束
973
1003
  */
974
1004
  RCLoggerTag["L_INVOKER_EXECUTE_R"] = "L-invoker_execute-R";
1005
+ /**
1006
+ * 销毁队列事件
1007
+ */
1008
+ RCLoggerTag["L_INVOKER_DESTROY_O"] = "L-invoker_destroy-R";
975
1009
  })(RCLoggerTag || (RCLoggerTag = {}));
976
1010
  var RCLoggerStatus;
977
1011
  (function (RCLoggerStatus) {
@@ -7175,7 +7209,6 @@ class RCLocalTrack extends RCTrack {
7175
7209
  */
7176
7210
  changed && this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, this, resolve);
7177
7211
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_O, JSON.stringify({
7178
- status: RCLoggerStatus.SUCCESSED,
7179
7212
  enable: bool,
7180
7213
  trackId: this._id,
7181
7214
  }));
@@ -14767,7 +14800,7 @@ const getCommonHeader$1 = () => ({
14767
14800
  'Content-Type': 'application/json;charset=UTF-8',
14768
14801
  'Cache-Control': 'no-cache',
14769
14802
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14770
- ClientVersion: "5.6.3-alpha.3",
14803
+ ClientVersion: "5.6.3-alpha.5",
14771
14804
  'Client-Session-Id': getUUID(),
14772
14805
  'Request-Id': Date.now().toString(),
14773
14806
  });
@@ -14792,8 +14825,6 @@ const getFastMediaUrl = (hosts, runtime, jwt) => __awaiter(void 0, void 0, void
14792
14825
  timeout: PING_REQ_TIMEOUT,
14793
14826
  method: HttpMethod.POST,
14794
14827
  });
14795
- const logger = RTCLogger.getLogger();
14796
- logger === null || logger === void 0 ? void 0 : logger.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `ping res => ${JSON.stringify({ status: res.status, host })}`);
14797
14828
  if (res.status === 200) {
14798
14829
  pingRes.push(host.clusterId);
14799
14830
  }
@@ -14818,7 +14849,7 @@ const parseDetectorServer = (info) => {
14818
14849
  }
14819
14850
  catch (error) {
14820
14851
  const logger = RTCLogger.getLogger();
14821
- 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}`);
14822
14853
  return '';
14823
14854
  }
14824
14855
  if (voipInfo.strategy === 0) {
@@ -15345,7 +15376,7 @@ const getCommonHeader = () => ({
15345
15376
  'Content-Type': 'application/json;charset=UTF-8',
15346
15377
  'Cache-Control': 'no-cache',
15347
15378
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
15348
- ClientVersion: "5.6.3-alpha.3",
15379
+ ClientVersion: "5.6.3-alpha.5",
15349
15380
  'Client-Session-Id': getUUID(),
15350
15381
  'Request-Id': Date.now().toString(),
15351
15382
  });
@@ -15390,7 +15421,6 @@ class RCMediaService {
15390
15421
  }
15391
15422
  }
15392
15423
  detectorMediaSever() {
15393
- var _a, _b;
15394
15424
  const naviInfo = this._context.getNaviInfo();
15395
15425
  RCMediaService.jwtToken = (naviInfo === null || naviInfo === void 0 ? void 0 : naviInfo.jwt) || '';
15396
15426
  // 如果有传入自定义 MediaServer 地址不走探测逻辑
@@ -15400,7 +15430,6 @@ class RCMediaService {
15400
15430
  const nowDate = Date.now();
15401
15431
  const isValid = (RCMediaService.detectValidMinute + RCMediaService.detectorTime > nowDate);
15402
15432
  RCMediaService.isDetector = isValid;
15403
- (_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)}`);
15404
15433
  if (!isValid && naviInfo && notEmptyObject(naviInfo)) {
15405
15434
  this._msList = [];
15406
15435
  this._getDetectorUrls(naviInfo);
@@ -15412,7 +15441,6 @@ class RCMediaService {
15412
15441
  * 拿不到等 IM 链接成功后,再回调中调用开始嗅探
15413
15442
  */
15414
15443
  _getDetectorUrls(naviInfo) {
15415
- var _a, _b, _c, _d;
15416
15444
  return __awaiter(this, void 0, void 0, function* () {
15417
15445
  if (RCMediaService.isDetector) {
15418
15446
  return;
@@ -15427,8 +15455,6 @@ class RCMediaService {
15427
15455
  RCMediaService.msInDetector = fastMediaUrl || [];
15428
15456
  RCMediaService.detectorTime = Date.now();
15429
15457
  RCMediaService.detectValidMinute = clientDetectMinute * 60 * 1000;
15430
- (_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}`);
15431
- (_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}`);
15432
15458
  });
15433
15459
  }
15434
15460
  getNaviMS() {
@@ -15446,20 +15472,18 @@ class RCMediaService {
15446
15472
  * ping1 :ping 结果返回最快值
15447
15473
  */
15448
15474
  setMediaServiceList() {
15449
- var _a, _b, _c, _d, _e, _f, _g, _h;
15475
+ var _a, _b;
15450
15476
  let backupMsInDetector = [];
15451
15477
  let backupMsInNavi = [];
15452
15478
  if (this._clusterId) {
15453
15479
  this._clusterId = this._clusterId.replace(/^(https?:\/\/)?/, 'https://');
15454
15480
  this._msList.push(this._clusterId);
15455
15481
  }
15456
- (_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}`);
15457
15482
  if (notEmptyArray(RCMediaService.msInDetector)) {
15458
15483
  RCMediaService.msInDetector = RCMediaService.msInDetector.map((item) => item.replace(/^(https?:\/\/)?/, 'https://'));
15459
15484
  this._msList.push(RCMediaService.msInDetector[0]);
15460
15485
  backupMsInDetector = RCMediaService.msInDetector.concat().splice(1, RCMediaService.msInDetector.length - 1);
15461
15486
  }
15462
- (_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)}`);
15463
15487
  if (this._msInNavi.length === 0) {
15464
15488
  if (this._failedMs.length === 0) {
15465
15489
  this._msInNavi.push(...parseNaviInfo(this._context.getNaviInfo()));
@@ -15469,12 +15493,11 @@ class RCMediaService {
15469
15493
  this._failedMs.length = 0;
15470
15494
  }
15471
15495
  }
15472
- (_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)}`);
15473
15496
  backupMsInNavi = this._msInNavi.concat().splice(1, this._msInNavi.length - 1);
15474
15497
  this._msList.push(this._msInNavi[0]);
15475
15498
  this._msList = [...this._msList, ...backupMsInDetector, ...backupMsInNavi];
15476
15499
  this._msList = [...new Set(this._msList)];
15477
- (_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)}`);
15478
15501
  return this._msList;
15479
15502
  }
15480
15503
  /**
@@ -15553,7 +15576,6 @@ class RCMediaService {
15553
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({
15554
15577
  status: RCLoggerStatus.SUCCESSED,
15555
15578
  url,
15556
- reqId,
15557
15579
  }), traceId);
15558
15580
  return { code: RCRTCCode.SUCCESS, data: resp };
15559
15581
  }
@@ -15660,13 +15682,13 @@ class RCMediaService {
15660
15682
  /**
15661
15683
  * 房间内观众获取 CDN 资源信息、拉流地址
15662
15684
  */
15663
- getCDNResourceInfo(headers, url) {
15685
+ getCDNResourceInfo(headers, url, traceId) {
15664
15686
  var _a, _b, _c, _d, _e, _f;
15665
15687
  return __awaiter(this, void 0, void 0, function* () {
15666
15688
  const commonHeader = getCommonHeader();
15667
15689
  const mergeHeaders = Object.assign(Object.assign({}, commonHeader), headers);
15668
15690
  const reqId = commonHeader['Request-Id'];
15669
- (_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);
15670
15692
  const { status, data: resStr } = yield this._runtime.httpReq({
15671
15693
  url,
15672
15694
  headers: mergeHeaders,
@@ -15676,15 +15698,14 @@ class RCMediaService {
15676
15698
  const data = JSON.parse(resStr);
15677
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({
15678
15700
  status: RCLoggerStatus.SUCCESSED,
15679
- reqId: commonHeader['Request-Id'],
15680
- }));
15701
+ cdnPlayerUrl: data === null || data === void 0 ? void 0 : data.data.pull_url,
15702
+ }), traceId);
15681
15703
  return { code: data.resultCode, res: data };
15682
15704
  }
15683
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({
15684
15706
  status: RCLoggerStatus.FAILED,
15685
15707
  code: RCRTCCode.REQUEST_FAILED,
15686
- msg: `request error -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}, url: ${url}`,
15687
- }));
15708
+ }), traceId);
15688
15709
  return { code: RCRTCCode.REQUEST_FAILED };
15689
15710
  });
15690
15711
  }
@@ -16875,11 +16896,6 @@ class ASdpBuilder {
16875
16896
  * @param {IRCTrackBitrate} bitrate - 以 kbps 为单位的比特率。
16876
16897
  */
16877
16898
  setAudiosBitrate(bitrate) {
16878
- var _a;
16879
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16880
- bitrate,
16881
- msg: 'SDP setAudiosBitrate',
16882
- }));
16883
16899
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => this.setAudioItemBitrate(sdpAudioBlock, bitrate));
16884
16900
  return this;
16885
16901
  }
@@ -16889,12 +16905,6 @@ class ASdpBuilder {
16889
16905
  * @param {string} streamId - 音频流的媒体流 ID。
16890
16906
  */
16891
16907
  setAudioBitrateWithStreamId(bitrate, streamId) {
16892
- var _a;
16893
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16894
- bitrate,
16895
- streamId,
16896
- msg: 'SDP setAudioBitrateWithStreamId',
16897
- }));
16898
16908
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16899
16909
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16900
16910
  // 判断 msid 是否存在
@@ -16911,12 +16921,6 @@ class ASdpBuilder {
16911
16921
  * @param {string} mid - 音频流的媒体流 ID。
16912
16922
  */
16913
16923
  setAudioBitrateWithMid(bitrate, mid) {
16914
- var _a;
16915
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16916
- bitrate,
16917
- mid,
16918
- msg: 'SDP setAudioBitrateWithMid',
16919
- }));
16920
16924
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16921
16925
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
16922
16926
  // 判断 msid 是否存在
@@ -16965,11 +16969,6 @@ class ASdpBuilder {
16965
16969
  * @param bitrate
16966
16970
  */
16967
16971
  setVideosBitrate(bitrate) {
16968
- var _a;
16969
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16970
- bitrate,
16971
- msg: 'SDP setVideosBitrate',
16972
- }));
16973
16972
  // 找到 profile-level-id 行在后面添加 ;x-google--bitrate ;x-google--bitrate=
16974
16973
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => this.setVideoItemBitrate(sdpVideoBlock, bitrate));
16975
16974
  return this;
@@ -16980,12 +16979,6 @@ class ASdpBuilder {
16980
16979
  * @param {string} streamId - 媒体流 ID。
16981
16980
  */
16982
16981
  setVideoBitrateWithStreamId(bitrate, streamId) {
16983
- var _a;
16984
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16985
- bitrate,
16986
- streamId,
16987
- msg: 'SDP setVideoBitrateWithStreamId',
16988
- }));
16989
16982
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
16990
16983
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16991
16984
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17001,12 +16994,6 @@ class ASdpBuilder {
17001
16994
  * @param {string} streamId - 媒体流 ID。
17002
16995
  */
17003
16996
  setVideoBitrateWithMid(bitrate, mid) {
17004
- var _a;
17005
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
17006
- bitrate,
17007
- mid,
17008
- msg: 'SDP setVideoBitrateWithMid',
17009
- }));
17010
16997
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
17011
16998
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
17012
16999
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17253,7 +17240,7 @@ class PlanBSdpBuilder extends ASdpBuilder {
17253
17240
  */
17254
17241
  setAudioBitrateWithStreamId(bitrate, streamId) {
17255
17242
  var _a;
17256
- (_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');
17257
17244
  return this;
17258
17245
  }
17259
17246
  /**
@@ -17261,7 +17248,7 @@ class PlanBSdpBuilder extends ASdpBuilder {
17261
17248
  */
17262
17249
  setVideoBitrateWithStreamId(bitrate, streamId) {
17263
17250
  var _a;
17264
- (_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');
17265
17252
  return this;
17266
17253
  }
17267
17254
  }
@@ -17600,7 +17587,7 @@ class UnifiedPlanStrategy extends ASdpStrategy {
17600
17587
  }
17601
17588
  setBitrate(max, min, start) {
17602
17589
  var _a;
17603
- (_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`');
17604
17591
  }
17605
17592
  /**
17606
17593
  * 该函数用于向对等连接添加本地轨道
@@ -18165,16 +18152,12 @@ class RCRTCPeerConnection extends EventEmitter {
18165
18152
  return this._sdpStrategy.getOutboundVideoInfo();
18166
18153
  }
18167
18154
  _onLocalTrackMuted(track, resolve) {
18168
- var _a;
18169
18155
  // 修改已发布的小流状态
18170
18156
  const tinyTrack = this.getLocalTrack(`${track.getTrackId()}_tiny`);
18171
18157
  if (tinyTrack) {
18172
18158
  tinyTrack.__innerGetMediaStreamTrack().enabled = !track.isLocalMuted();
18173
18159
  }
18174
18160
  this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, track, resolve);
18175
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O, JSON.stringify({
18176
- trackId: track.getTrackId(),
18177
- }));
18178
18161
  }
18179
18162
  _onLocalTrackDestroied(track) {
18180
18163
  this.emit(RCLocalTrack.__INNER_EVENT_DESTROY__, track);
@@ -18353,7 +18336,7 @@ class RCRTCPeerConnection extends EventEmitter {
18353
18336
  * 优化 300 人大会议室 https://rc-jira.rongcloud.net/browse/BEEM-289
18354
18337
  * Mac 端卡顿严重, RTCLib 房间超出 32 路流时,不再做北极星质量数据上报,仅取音量数据,以保持 Beem 声音激励功能可用
18355
18338
  */
18356
- 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) {
18357
18340
  return true;
18358
18341
  }
18359
18342
  if (formatData.senders.length || formatData.receivers.length) {
@@ -18701,7 +18684,7 @@ class PolarisReporter {
18701
18684
  * 加入房间
18702
18685
  */
18703
18686
  sendR1() {
18704
- const rtcVersion = "5.6.3-alpha.3";
18687
+ const rtcVersion = "5.6.3-alpha.5";
18705
18688
  const imVersion = this._context.getCoreVersion();
18706
18689
  const platform = 'web';
18707
18690
  const pcName = navigator.platform;
@@ -18851,7 +18834,7 @@ class PolarisHttpReporter {
18851
18834
  _formatR1Data() {
18852
18835
  return {
18853
18836
  joinTime: this._context.userJoinTime || 0,
18854
- rtcVersion: "5.6.3-alpha.3",
18837
+ rtcVersion: "5.6.3-alpha.5",
18855
18838
  imVersion: this._context.getCoreVersion(),
18856
18839
  platform: 'web',
18857
18840
  device: navigator.platform,
@@ -19120,7 +19103,11 @@ class RCRTCPeerCManager {
19120
19103
  /**
19121
19104
  * context
19122
19105
  */
19123
- _initOptions) {
19106
+ _initOptions,
19107
+ /**
19108
+ * 是否是观众
19109
+ */
19110
+ _isAudience) {
19124
19111
  this._useMutilPeerC = _useMutilPeerC;
19125
19112
  this._roomId = _roomId;
19126
19113
  this._reTryExchange = _reTryExchange;
@@ -19128,6 +19115,7 @@ class RCRTCPeerCManager {
19128
19115
  this._polarisReport = _polarisReport;
19129
19116
  this._isRoomAudience = _isRoomAudience;
19130
19117
  this._initOptions = _initOptions;
19118
+ this._isAudience = _isAudience;
19131
19119
  // private _reportListener: {[key: string]: IRCRTCReportListener | null} = {}
19132
19120
  /**
19133
19121
  * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
@@ -19141,6 +19129,12 @@ class RCRTCPeerCManager {
19141
19129
  * 根据 track 判断是否为上行
19142
19130
  */
19143
19131
  _isPub(tracks) {
19132
+ if (this._isAudience) {
19133
+ return false;
19134
+ }
19135
+ if (!this._useMutilPeerC) {
19136
+ return true;
19137
+ }
19144
19138
  // 取消订阅时,剩余订阅资源为空,tracks 会为 []
19145
19139
  if (!tracks.length) {
19146
19140
  return false;
@@ -19214,15 +19208,12 @@ class RCRTCPeerCManager {
19214
19208
  const peerCArr = [];
19215
19209
  // isPublish 判断tracks中的资源是否为本地发布资源 从而区分是订阅与发布
19216
19210
  const isPub = this._isPub(tracks);
19217
- // 不使用多 peerConnection
19218
- if (!this._useMutilPeerC) {
19219
- const pcName = this._genPCName(true);
19220
- peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19221
- return peerCArr;
19222
- }
19223
- // 多 peerConnction 订阅
19224
- if (this._useMutilPeerC && !isPub) {
19225
- const pcName = this._genPCName(false);
19211
+ /**
19212
+ * 不使用多 peerConnection 或
19213
+ * peerConnction 订阅
19214
+ */
19215
+ if (!this._useMutilPeerC || (this._useMutilPeerC && !isPub)) {
19216
+ const pcName = this._genPCName(isPub);
19226
19217
  peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19227
19218
  return peerCArr;
19228
19219
  }
@@ -19828,6 +19819,9 @@ class BaseInvoker {
19828
19819
  if (!hashSubscribTask) {
19829
19820
  return { command, resolve, reject };
19830
19821
  }
19822
+ /**
19823
+ * 倒数第二个任务的 state 改为 middle,最后一个任务的 state 设为 tail
19824
+ */
19831
19825
  const [task] = this._queue.splice(index, 1);
19832
19826
  if (task.command instanceof AsyncCommand) {
19833
19827
  task.command.setState(RCLinkedListPoint.MIDDLE);
@@ -19857,9 +19851,17 @@ class BaseInvoker {
19857
19851
  };
19858
19852
  }
19859
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
+ }));
19860
19858
  return this._isDestroyed;
19861
19859
  }
19862
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
+ }));
19863
19865
  if (this._isDestroyed) {
19864
19866
  return;
19865
19867
  }
@@ -19911,7 +19913,7 @@ class UnpublishPrevCommand extends BaseCommand {
19911
19913
  resource: tmpRes,
19912
19914
  }), traceId);
19913
19915
  // 添加请求队列并等待结果
19914
- 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([]));
19915
19917
  if (code !== ErrorCode.SUCCESS) {
19916
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({
19917
19919
  status: RCLoggerStatus.FAILED,
@@ -20412,14 +20414,18 @@ function createExchangeParams(subscribeList, iceRestart, pc, store) {
20412
20414
  * 扩散 cdn_uris 资源
20413
20415
  */
20414
20416
  function spreadCDNInfo(context, roomId, CDNUris) {
20415
- var _a, _b;
20417
+ var _a, _b, _c, _d;
20416
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);
20417
20423
  const code = yield context.setRTCCDNUris(roomId, RCRTCMessageType.TOTAL_CONTENT_RESOURCE, JSON.stringify([CDNUris]));
20418
20424
  if (code !== ErrorCode.SUCCESS) {
20419
- (_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);
20420
20426
  return { code: RCRTCCode.SIGNAL_ERROR };
20421
20427
  }
20422
- (_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);
20423
20429
  return { code: RCRTCCode.SUCCESS };
20424
20430
  });
20425
20431
  }
@@ -20427,14 +20433,16 @@ function spreadCDNInfo(context, roomId, CDNUris) {
20427
20433
  * 给房间设置 CDN 数据
20428
20434
  */
20429
20435
  function setRoomCDNInfo(context, roomId, CDNUris) {
20430
- var _a, _b;
20436
+ var _a, _b, _c, _d;
20431
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);
20432
20440
  const code = yield context.setRTCData(roomId, 'cdn_uris', JSON.stringify([CDNUris]), true, RTCApiType.ROOM);
20433
20441
  if (code !== ErrorCode.SUCCESS) {
20434
- (_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);
20435
20443
  return { code: RCRTCCode.SIGNAL_ERROR };
20436
20444
  }
20437
- (_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);
20438
20446
  return { code: RCRTCCode.SUCCESS };
20439
20447
  });
20440
20448
  }
@@ -20442,34 +20450,16 @@ function setRoomCDNInfo(context, roomId, CDNUris) {
20442
20450
  * 开启、停用 CDN 推资源后发信令
20443
20451
  */
20444
20452
  function sendCDNInfoSignal(store) {
20445
- var _a, _b, _c, _d, _e, _f;
20446
20453
  return __awaiter(this, void 0, void 0, function* () {
20447
20454
  const { context } = store;
20448
20455
  const { roomId } = store;
20449
20456
  // eslint-disable-next-line
20450
20457
  const CDNUris = Object.assign({}, store.getCDNUris(), { enableInnerCDN: store.getCDNEnable() });
20451
- (_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({
20452
- roomId,
20453
- CDNUris,
20454
- }));
20455
20458
  const resCodeArr = yield Promise.all([
20456
20459
  spreadCDNInfo(context, roomId, CDNUris),
20457
20460
  setRoomCDNInfo(context, roomId, CDNUris),
20458
20461
  ]);
20459
20462
  const isSuccess = resCodeArr.every((item) => item.code === RCRTCCode.SUCCESS);
20460
- if (isSuccess) {
20461
- (_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({
20462
- status: RCLoggerStatus.SUCCESSED,
20463
- CDNUris,
20464
- }));
20465
- }
20466
- else {
20467
- (_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({
20468
- status: RCLoggerStatus.FAILED,
20469
- code: RCRTCCode.SIGNAL_ERROR,
20470
- msg: 'signal error',
20471
- }));
20472
- }
20473
20463
  return isSuccess ? { code: RCRTCCode.SUCCESS } : { code: RCRTCCode.SIGNAL_ERROR };
20474
20464
  });
20475
20465
  }
@@ -20935,17 +20925,18 @@ class ParseRemoteResCommand extends BaseCommand {
20935
20925
  }
20936
20926
 
20937
20927
  class SubscribeCommand extends BaseCommand {
20938
- constructor(tracks, subhook, forceReq) {
20928
+ constructor(tracks, subhook, forceReq, traceId) {
20939
20929
  super();
20940
20930
  this.tracks = tracks;
20941
20931
  this.subhook = subhook;
20942
20932
  this.forceReq = forceReq;
20933
+ this.traceId = traceId;
20943
20934
  }
20944
20935
  get kind() {
20945
20936
  return RCCommandKind.SUBSCRIBE;
20946
20937
  }
20947
20938
  execute(store, invoker) {
20948
- var _a, _b, _c, _d, _e, _f, _g, _h;
20939
+ var _a, _b, _c, _d, _e, _f;
20949
20940
  return __awaiter(this, void 0, void 0, function* () {
20950
20941
  // 取消房间状态检查,房间销毁后,invoker 应直接清空,避免后续执行动作
20951
20942
  // const roomStatusCode = this._assertRoomDestroyed()
@@ -20954,17 +20945,16 @@ class SubscribeCommand extends BaseCommand {
20954
20945
  // return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED }
20955
20946
  // }
20956
20947
  const { tracks, forceReq } = this;
20957
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
20958
- (_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({
20959
20949
  trackIds: tracks.map(getTrackIdFromAttr),
20960
20950
  forceReq,
20961
- }), traceId);
20951
+ }), this.traceId);
20962
20952
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
20963
- (_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({
20964
20954
  status: RCLoggerStatus.FAILED,
20965
20955
  code: RCRTCCode.PARAMS_ERROR,
20966
20956
  msg: 'params error -> tracks',
20967
- }), traceId);
20957
+ }), this.traceId);
20968
20958
  return { code: RCRTCCode.PARAMS_ERROR };
20969
20959
  }
20970
20960
  const crtSubList = store.getSubscribedList().map((item) => (Object.assign({}, item)));
@@ -20987,16 +20977,16 @@ class SubscribeCommand extends BaseCommand {
20987
20977
  changed = true;
20988
20978
  });
20989
20979
  if (!changed && !forceReq) {
20990
- (_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({
20991
20981
  status: RCLoggerStatus.SUCCESSED,
20992
20982
  msg: 'repeat subscribe',
20993
- }), traceId);
20983
+ }), this.traceId);
20994
20984
  return { code: RCRTCCode.SUCCESS };
20995
20985
  }
20996
20986
  // 北极星上报
20997
20987
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
20998
20988
  recordSubscribeCommand(true);
20999
- return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, traceId).execute(store, invoker);
20989
+ return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, this.traceId).execute(store, invoker);
21000
20990
  });
21001
20991
  }
21002
20992
  }
@@ -21264,7 +21254,7 @@ class PublishCommand extends BaseCommand {
21264
21254
  // 通知房间成员
21265
21255
  // 连通率相关埋点-统计扩散耗时
21266
21256
  recordPublishSignalTotalData();
21267
- 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);
21268
21258
  // TIPS: 通知房间成员失败,对信息进行重试操作
21269
21259
  if (errorCode !== ErrorCode.SUCCESS) {
21270
21260
  const RetrySignal = RetrySignaling.handler();
@@ -21274,7 +21264,7 @@ class PublishCommand extends BaseCommand {
21274
21264
  if ((new Date()).valueOf() - startTime > this.signalRetryTime) {
21275
21265
  return errorCode;
21276
21266
  }
21277
- 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));
21278
21268
  if (code !== ErrorCode.SUCCESS) {
21279
21269
  yield RetrySignal.task(loop);
21280
21270
  }
@@ -21497,7 +21487,7 @@ class UnpublishCommand extends BaseCommand {
21497
21487
  const dList = publishedList.filter((item) => !unpublishList.includes(item));
21498
21488
  // 通知房间内成员
21499
21489
  recordUnpublishSignalTotalData();
21500
- 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));
21501
21491
  if (singalCode !== ErrorCode.SUCCESS) {
21502
21492
  reportQualityUnpublishSignalTotalData(publishedList, singalCode);
21503
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({
@@ -21589,16 +21579,20 @@ class LocalTrackMuteCommand extends BaseCommand {
21589
21579
  return RCCommandKind.LOCAL_TRACK_MUTE;
21590
21580
  }
21591
21581
  execute(store, invoker) {
21592
- var _a, _b, _c, _d;
21582
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21593
21583
  return __awaiter(this, void 0, void 0, function* () {
21594
21584
  const { localTrack } = this;
21595
21585
  const trackId = localTrack.getTrackId();
21596
21586
  const { crtUserId, roomId } = store;
21597
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);
21598
21593
  // 本地资源,需同步房间状态
21599
21594
  const localResource = [{ resourceId: trackId, enabled }];
21600
21595
  // 计算更新后的全量资源数据
21601
- // const publishedList = this._roomResources[crtUserId] || []
21602
21596
  const publishedList = store.getResourcesByUserId(crtUserId);
21603
21597
  // 增量数据
21604
21598
  const plusList = [];
@@ -21613,23 +21607,19 @@ class LocalTrackMuteCommand extends BaseCommand {
21613
21607
  break;
21614
21608
  }
21615
21609
  }
21616
- 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);
21617
21611
  // 执行 localTrack.mute 传入的 resolve,并返回 signal 扩散的 code 码
21618
21612
  this._recvSignalResultFn(code);
21619
21613
  if (code !== ErrorCode.SUCCESS) {
21620
- (_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({
21621
21615
  status: RCLoggerStatus.FAILED,
21622
21616
  code,
21623
- enabled,
21624
- trackId: this.localTrack.getTrackId(),
21625
21617
  msg: 'signal error',
21626
- }));
21618
+ }), traceId);
21627
21619
  }
21628
- (_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({
21629
21621
  status: RCLoggerStatus.SUCCESSED,
21630
- enabled,
21631
- trackId: this.localTrack.getTrackId(),
21632
- }));
21622
+ }), traceId);
21633
21623
  });
21634
21624
  }
21635
21625
  }
@@ -21648,9 +21638,12 @@ class RetryExchangeCommand extends BaseCommand {
21648
21638
  return CommandPriority.HIGH;
21649
21639
  }
21650
21640
  execute(store, invoker) {
21651
- var _a, _b;
21641
+ var _a, _b, _c, _d, _e;
21652
21642
  return __awaiter(this, void 0, void 0, function* () {
21653
- (_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();
21654
21647
  const { pcName, isPub } = this;
21655
21648
  const { useMutilPeerC } = store;
21656
21649
  const { pc } = store.peerMgr.getPCItemByPCName(pcName);
@@ -21665,17 +21658,91 @@ class RetryExchangeCommand extends BaseCommand {
21665
21658
  // 发送 /exchange 请求
21666
21659
  const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
21667
21660
  if (resp.code !== RCRTCCode.SUCCESS) {
21668
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resp.code}, pcName: ${pcName}`, traceId);
21669
21661
  return;
21670
21662
  }
21671
21663
  const { sdp: answer, resultCode } = resp.data;
21672
21664
  if (resultCode !== RCRTCCode.SUCCESS) {
21673
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resultCode}, pcName: ${pcName}`, traceId);
21674
21665
  return;
21675
21666
  }
21676
21667
  // 请求成功,清除 ice 断线重连的定时器
21677
21668
  pc.clearReTryExchangeTimer();
21678
- 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
+ }
21679
21746
  });
21680
21747
  }
21681
21748
  }
@@ -21756,7 +21823,7 @@ class OnSignalReconnectedCommand extends BaseCommand {
21756
21823
  return;
21757
21824
  }
21758
21825
  if (!data) {
21759
- (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.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({
21760
21827
  status: RCLoggerStatus.FAILED,
21761
21828
  msg: 'im reconnect joinRTCRoom, roomData is empty',
21762
21829
  }), traceId);
@@ -21818,11 +21885,9 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21818
21885
  return RCCommandKind.ASYNC_COMMAND;
21819
21886
  }
21820
21887
  execute(store, invoker) {
21821
- var _a, _b, _c, _d;
21888
+ var _a, _b, _c;
21822
21889
  return __awaiter(this, void 0, void 0, function* () {
21823
21890
  const { tracks } = this;
21824
- const { roomId } = store;
21825
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `unsubscribe -> roomId: ${roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
21826
21891
  if (this.state === RCLinkedListPoint.NORMAL) {
21827
21892
  // 获取原订阅列表
21828
21893
  const originTracks = store.getSubscribedList().slice();
@@ -21831,7 +21896,7 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21831
21896
  const subscribedTracks = store.getSubscribedList().slice();
21832
21897
  // 计算订阅列表 Diff
21833
21898
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21834
- (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21899
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21835
21900
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21836
21901
  });
21837
21902
  return { code: updateSuscribeCode, failedList };
@@ -21847,14 +21912,14 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21847
21912
  // 自执行一次,计算出最终的 collectSubscribeList
21848
21913
  const { code: updateSuscribeCode, failedList } = yield new UpdateSubscribeListCommand(tracks, this.subhook, true).execute(store, invoker);
21849
21914
  if (updateSuscribeCode !== RCRTCCode.SUCCESS) {
21850
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21915
+ (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21851
21916
  code: updateSuscribeCode, subscribe: [], unsubscribe: [], failedList,
21852
21917
  });
21853
21918
  return { code: updateSuscribeCode, failedList };
21854
21919
  }
21855
21920
  const subscribedTracks = store.getSubscribedList().slice(0);
21856
21921
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21857
- (_d = this.callbacks) === null || _d === void 0 ? void 0 : _d.onTaskCompleted({
21922
+ (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21858
21923
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21859
21924
  });
21860
21925
  return { code: updateSuscribeCode, failedList };
@@ -21874,25 +21939,25 @@ class AsyncUpdateSubscribeListCommand extends AsyncCommand {
21874
21939
  }
21875
21940
 
21876
21941
  class AsyncSubscribeCommand extends AsyncCommand {
21877
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
21942
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21878
21943
  super(state);
21879
21944
  this.tracks = tracks;
21880
21945
  this.subhook = subhook;
21881
21946
  this.callbacks = callbacks;
21947
+ this.traceId = traceId;
21882
21948
  }
21883
21949
  get kind() {
21884
21950
  return RCCommandKind.ASYNC_COMMAND;
21885
21951
  }
21886
21952
  execute(store, invoker) {
21887
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21953
+ var _a, _b, _c, _d, _e;
21888
21954
  return __awaiter(this, void 0, void 0, function* () {
21889
21955
  const { tracks } = this;
21890
- const { roomId } = store;
21891
21956
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21892
21957
  if (this.state === RCLinkedListPoint.NORMAL) {
21893
21958
  // 获取原订阅列表
21894
21959
  const originTracks = store.getSubscribedList().slice();
21895
- 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);
21896
21961
  // 获取新的订阅列表
21897
21962
  const subscribedTracks = store.getSubscribedList().slice();
21898
21963
  // 计算订阅列表 Diff
@@ -21902,16 +21967,15 @@ class AsyncSubscribeCommand extends AsyncCommand {
21902
21967
  });
21903
21968
  return { code: subscribeCode, failedList };
21904
21969
  }
21905
- const traceId = (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.createTraceId();
21906
- (_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({
21907
21971
  trackIds: tracks.map(getTrackIdFromAttr),
21908
- }), traceId);
21972
+ }), this.traceId);
21909
21973
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
21910
- (_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({
21911
21975
  status: RCLoggerStatus.FAILED,
21912
21976
  code: RCRTCCode.PARAMS_ERROR,
21913
21977
  msg: 'params error -> tracks',
21914
- }));
21978
+ }), this.traceId);
21915
21979
  return { code: RCRTCCode.PARAMS_ERROR };
21916
21980
  }
21917
21981
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item)));
@@ -21935,16 +21999,12 @@ class AsyncSubscribeCommand extends AsyncCommand {
21935
21999
  });
21936
22000
  // 北极星上报
21937
22001
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
21938
- (_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({
21939
- trackIds: tracks.map(getTrackIdFromAttr),
21940
- roomId,
21941
- }));
21942
22002
  if (this.state === RCLinkedListPoint.TAIL) {
21943
- 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);
21944
22004
  if (subscribeCode === RCRTCCode.SUCCESS) {
21945
22005
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21946
22006
  const tracks = store.getCollectSubscribeList().slice(0);
21947
- 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);
21948
22008
  }
21949
22009
  return { code: subscribeCode };
21950
22010
  }
@@ -21971,63 +22031,58 @@ class AsyncSubscribeCommand extends AsyncCommand {
21971
22031
  }
21972
22032
 
21973
22033
  class AsyncUnsubscribeCommand extends AsyncCommand {
21974
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
22034
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21975
22035
  super(state);
21976
22036
  this.tracks = tracks;
21977
22037
  this.subhook = subhook;
21978
22038
  this.callbacks = callbacks;
22039
+ this.traceId = traceId;
21979
22040
  }
21980
22041
  get kind() {
21981
22042
  return RCCommandKind.ASYNC_COMMAND;
21982
22043
  }
21983
22044
  execute(store, invoker) {
21984
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22045
+ var _a, _b, _c, _d, _e;
21985
22046
  return __awaiter(this, void 0, void 0, function* () {
21986
22047
  const { tracks } = this;
21987
- const { roomId } = store;
21988
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21989
22048
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21990
22049
  if (this.state === RCLinkedListPoint.NORMAL) {
21991
22050
  // 获取原订阅列表
21992
22051
  const originTracks = store.getSubscribedList().slice();
21993
- 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);
21994
22053
  // 获取新的订阅列表
21995
22054
  const subscribedTracks = store.getSubscribedList().slice();
21996
22055
  // 计算出 Diff
21997
22056
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21998
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
22057
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21999
22058
  code: unsubscribeCode, subscribe, unsubscribe, failedList,
22000
22059
  });
22001
22060
  return { code: unsubscribeCode, failedList };
22002
22061
  }
22003
- (_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({
22004
22063
  trackIds: tracks.map(getTrackIdFromAttr),
22005
- }));
22064
+ }), this.traceId);
22006
22065
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
22007
- (_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({
22008
22067
  status: RCLoggerStatus.FAILED,
22009
22068
  code: RCRTCCode.PARAMS_ERROR,
22010
22069
  msg: 'params error -> tracks',
22011
- }));
22070
+ }), this.traceId);
22012
22071
  return { code: RCRTCCode.PARAMS_ERROR };
22013
22072
  }
22014
22073
  // 计算剩余订阅列表, 如果资源在取消订阅列表内则排除它
22015
22074
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item))).filter((item) => !tracks.includes(item.track));
22016
22075
  // 北极星上报
22017
22076
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
22018
- (_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({
22019
- trackIds: tracks.map(getTrackIdFromAttr),
22020
- roomId,
22021
- }));
22022
22077
  if (this.state === RCLinkedListPoint.TAIL) {
22023
22078
  // 自执行一次,计算出最终的 collectSubscribeList
22024
- 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);
22025
22080
  // 拥塞队列处理完成的数据
22026
22081
  if (unsubscribeCode === RCRTCCode.SUCCESS) {
22027
22082
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
22028
22083
  const tracks = store.getCollectSubscribeList().slice(0).map((item) => item.track);
22029
22084
  // 自执行一次,计算出最终的 collectSubscribeList
22030
- 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);
22031
22086
  }
22032
22087
  return { code: unsubscribeCode };
22033
22088
  }
@@ -22203,8 +22258,18 @@ class RCAbstractRoom extends EventEmitter {
22203
22258
  this._peerCManager.setStore(this._store);
22204
22259
  // 注册监听 rtc_ntf 信令数据,收到通知时拉取房间数据
22205
22260
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
22206
- var _a, _b, _c, _d;
22261
+ var _a, _b, _c, _d, _e, _f;
22207
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
+ }
22208
22273
  switch (type) {
22209
22274
  case 2:
22210
22275
  if (roomId !== this._roomId) {
@@ -22212,8 +22277,8 @@ class RCAbstractRoom extends EventEmitter {
22212
22277
  }
22213
22278
  // 拉取房间数据
22214
22279
  // eslint-disable-next-line no-case-declarations
22215
- const tracId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
22216
- (_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);
22217
22282
  this._startPullRTCRoomStatus(roomId, tracId);
22218
22283
  break;
22219
22284
  }
@@ -22877,15 +22942,11 @@ class RCAbstractRoom extends EventEmitter {
22877
22942
  });
22878
22943
  }
22879
22944
  _getRTCReqestHeaders(pcName) {
22880
- const heasers = {
22881
- 'App-Key': this._context.getAppkey(),
22882
- RoomId: this._roomId,
22883
- Token: this._store.getToken(),
22884
- RoomType: this._store.roomMode,
22885
- UserId: this._context.getCurrentId(),
22886
- 'Client-Session-Id': this._clientSessionId,
22887
- 'Peer-Connection-Id': pcName,
22888
- };
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);
22889
22950
  return heasers;
22890
22951
  }
22891
22952
  /**
@@ -22954,9 +23015,11 @@ class RCAbstractRoom extends EventEmitter {
22954
23015
  * @returns 一个用代码和失败列表解析为对象的承诺。
22955
23016
  */
22956
23017
  addSubscribeTask(tracks) {
23018
+ var _a;
23019
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22957
23020
  this._invoker.push(new AsyncSubscribeCommand(tracks, this._subhook.bind(this), {
22958
23021
  onTaskCompleted: this._onTaskCompleted.bind(this),
22959
- }));
23022
+ }, RCLinkedListPoint.NORMAL, traceId));
22960
23023
  }
22961
23024
  /**
22962
23025
  * 取消订阅资源
@@ -22976,9 +23039,11 @@ class RCAbstractRoom extends EventEmitter {
22976
23039
  * @returns 一个用代码和失败列表解析为对象的承诺。
22977
23040
  */
22978
23041
  addUnsubscribeTask(tracks) {
23042
+ var _a;
23043
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22979
23044
  this._invoker.push(new AsyncUnsubscribeCommand(tracks, this._subhook.bind(this), {
22980
23045
  onTaskCompleted: this._onTaskCompleted.bind(this),
22981
- }));
23046
+ }, RCLinkedListPoint.NORMAL, traceId));
22982
23047
  }
22983
23048
  /**
22984
23049
  * 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
@@ -24164,23 +24229,28 @@ var RCInnerCDNPushMode;
24164
24229
  })(RCInnerCDNPushMode || (RCInnerCDNPushMode = {}));
24165
24230
 
24166
24231
  class ExchangeWithPushOtherRoomCommand extends BaseCommand {
24167
- constructor(roomId, hooks, roomPKHandler) {
24232
+ constructor(roomId, hooks, roomPKHandler, traceId) {
24168
24233
  super();
24169
24234
  this.roomId = roomId;
24170
24235
  this.hooks = hooks;
24171
24236
  this.roomPKHandler = roomPKHandler;
24237
+ this.traceId = traceId;
24172
24238
  }
24173
24239
  /**
24174
24240
  * 携带 pushOtherRooms 与 mediaServer 重新交互
24175
24241
  */
24176
24242
  _exchangeWithPushOtherRoom(store, invoker) {
24177
- var _a, _b, _c, _d;
24243
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24178
24244
  return __awaiter(this, void 0, void 0, function* () {
24179
24245
  /**
24180
24246
  * 如果己方未发布过资源,无需发请求
24181
24247
  */
24182
24248
  const pubTracks = store.getLocalTracks();
24183
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);
24184
24254
  return;
24185
24255
  }
24186
24256
  const mutilPeerCList = Object.values(store.peerMgr.getMutilPeerCData());
@@ -24191,16 +24261,28 @@ class ExchangeWithPushOtherRoomCommand extends BaseCommand {
24191
24261
  const reqBody = yield createExchangeParams(subscribeList, false, pc, store);
24192
24262
  const { pushOtherRooms, headers } = this.hooks(pcNameList[index]);
24193
24263
  reqBody.pushOtherRooms = pushOtherRooms;
24194
- const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
24264
+ const resp = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
24195
24265
  if (resp.code !== RCRTCCode.SUCCESS) {
24196
- (_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);
24197
24271
  return;
24198
24272
  }
24199
24273
  const { sdp: answer, resultCode } = resp.data;
24200
24274
  if (resultCode !== RCRTCCode.SUCCESS) {
24201
- (_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);
24202
24280
  return;
24203
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);
24204
24286
  pc.setRemoteAnswer(answer.sdp);
24205
24287
  }
24206
24288
  });
@@ -24209,45 +24291,35 @@ class ExchangeWithPushOtherRoomCommand extends BaseCommand {
24209
24291
  return RCCommandKind.EXCHANGE_WITH_PUSH_OTHER_ROOM;
24210
24292
  }
24211
24293
  execute(store, invoker) {
24212
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24294
+ var _a, _b, _c, _d, _e, _f;
24213
24295
  return __awaiter(this, void 0, void 0, function* () {
24214
24296
  const { roomId } = this;
24215
- (_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({
24216
24298
  roomId,
24217
- userId: store.crtUserId,
24218
24299
  }));
24219
24300
  // 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
24220
24301
  if (!this.roomPKHandler) {
24221
- (_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({
24222
24303
  status: RCLoggerStatus.FAILED,
24223
- code: '',
24224
24304
  msg: '_roomPKHandler not exist',
24225
- }));
24305
+ }), this.traceId);
24226
24306
  return;
24227
24307
  }
24228
24308
  const PKInfo = this.roomPKHandler.getPKInfo(roomId);
24229
24309
  if (!PKInfo) {
24230
- (_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}`);
24231
- (_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({
24232
24311
  status: RCLoggerStatus.FAILED,
24233
- code: '',
24234
24312
  msg: 'PKInfo not exist',
24235
- }));
24313
+ }), this.traceId);
24236
24314
  return;
24237
24315
  }
24238
24316
  yield this._exchangeWithPushOtherRoom(store, invoker);
24239
- (_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({
24240
- status: RCLoggerStatus.SUCCESSED,
24241
- roomId,
24242
- userId: store.crtUserId,
24243
- PKInfo,
24244
- }));
24245
24317
  });
24246
24318
  }
24247
24319
  }
24248
24320
 
24249
24321
  class LeaveOtherRoomCommand extends BaseCommand {
24250
- constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK) {
24322
+ constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK, traceId) {
24251
24323
  super();
24252
24324
  this.pkHandler = pkHandler;
24253
24325
  this.room = room;
@@ -24255,6 +24327,7 @@ class LeaveOtherRoomCommand extends BaseCommand {
24255
24327
  this.hooks = hooks;
24256
24328
  this._joinedPKRooms = _joinedPKRooms;
24257
24329
  this.isQuitPK = isQuitPK;
24330
+ this.traceId = traceId;
24258
24331
  }
24259
24332
  get kind() {
24260
24333
  return RCCommandKind.LEAVE_OTHER_ROOM;
@@ -24263,10 +24336,12 @@ class LeaveOtherRoomCommand extends BaseCommand {
24263
24336
  * 结束跨房间连麦
24264
24337
  * @param roomId 需要结束连麦的房间 roomId
24265
24338
  */
24266
- quitRoomPK(roomId, store) {
24267
- var _a, _b, _c, _d, _e, _f;
24339
+ quitRoomPK(roomId, store, traceId) {
24340
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24268
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);
24269
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);
24270
24345
  return;
24271
24346
  }
24272
24347
  const { inviterRoomId, inviteeRoomId, inviterUserId, inviteSessionId, } = this._PKInfo[roomId];
@@ -24282,40 +24357,34 @@ class LeaveOtherRoomCommand extends BaseCommand {
24282
24357
  content: JSON.stringify(content),
24283
24358
  keys: [`${inviterRoomId}|${inviterUserId}`],
24284
24359
  };
24285
- (_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)}`);
24286
24360
  const code = yield store.context.endRoomPK(params);
24287
24361
  if (code !== ErrorCode.SUCCESS) {
24288
- (_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);
24289
24363
  return { code: RCRTCCode.SIGNAL_ERROR };
24290
24364
  }
24291
- (_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);
24292
24366
  delete this._PKInfo[roomId];
24293
24367
  return { code: RCRTCCode.SUCCESS };
24294
24368
  });
24295
24369
  }
24296
24370
  execute(store, invoker) {
24297
- var _a, _b, _c, _d, _e, _f;
24371
+ var _a, _b, _c, _d;
24298
24372
  return __awaiter(this, void 0, void 0, function* () {
24299
24373
  const { room, isQuitPK } = this;
24300
24374
  const roomId = room.getRoomId();
24301
- (_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}`);
24302
- (_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({
24303
24376
  roomId,
24304
- userId: store.crtUserId,
24305
24377
  isQuitPK,
24306
- }));
24378
+ }), this.traceId);
24307
24379
  yield room.__destroy(true);
24308
24380
  // 回调主直播房间离开 PK 房间
24309
24381
  delete this._joinedPKRooms[roomId];
24310
- 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);
24311
24383
  // isQuitPK 为 true 时,结束连麦
24312
- isQuitPK && this.quitRoomPK(roomId, store);
24313
- (_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({
24314
24386
  status: RCLoggerStatus.SUCCESSED,
24315
- roomId,
24316
- userId: store.crtUserId,
24317
- isQuitPK,
24318
- }));
24387
+ }), this.traceId);
24319
24388
  return { code: RCRTCCode.SUCCESS };
24320
24389
  });
24321
24390
  }
@@ -24357,9 +24426,8 @@ class RCLivingPKHandler {
24357
24426
  this._mainRoomId = this._mainLivingRoom.getRoomId();
24358
24427
  }
24359
24428
  _callAppListener(eventType, ...attrs) {
24360
- var _a, _b, _c, _d, _e;
24361
- (_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)}`);
24362
- 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];
24363
24431
  if (!handle) {
24364
24432
  return;
24365
24433
  }
@@ -24367,7 +24435,7 @@ class RCLivingPKHandler {
24367
24435
  handle(...attrs);
24368
24436
  }
24369
24437
  catch (error) {
24370
- (_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));
24371
24439
  }
24372
24440
  }
24373
24441
  /**
@@ -24383,8 +24451,7 @@ class RCLivingPKHandler {
24383
24451
  extra,
24384
24452
  };
24385
24453
  this._PKInfo[inviterRoomId] = inviteInfo;
24386
- (_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({
24387
- 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({
24388
24455
  eventType: 'onRequestJoinOtherRoom',
24389
24456
  info,
24390
24457
  }));
@@ -24402,8 +24469,7 @@ class RCLivingPKHandler {
24402
24469
  extra,
24403
24470
  };
24404
24471
  delete this._PKInfo[inviterRoomId];
24405
- (_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({
24406
- 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({
24407
24473
  eventType: 'onCancelRequestOtherRoom',
24408
24474
  cancelInfo,
24409
24475
  }));
@@ -24438,21 +24504,20 @@ class RCLivingPKHandler {
24438
24504
  inviteeRoomId,
24439
24505
  };
24440
24506
  this._PKInfo[inviteeRoomId].inviteeUserAutoMix = inviteeUserAutoMix;
24441
- (_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({
24442
- 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({
24443
24508
  eventType: 'onResponseJoinOtherRoom',
24444
24509
  answerInfo,
24445
24510
  }));
24446
24511
  this._callAppListener('onResponseJoinOtherRoom', answerInfo);
24447
24512
  }
24448
- createLeaveOtherRoomCommand(room, isQuitPK) {
24449
- 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);
24450
24515
  }
24451
24516
  /**
24452
24517
  * 收到连麦结束
24453
24518
  */
24454
24519
  _onPKEnd(content) {
24455
- var _a, _b;
24520
+ var _a, _b, _c, _d, _e, _f;
24456
24521
  return __awaiter(this, void 0, void 0, function* () {
24457
24522
  const { inviteeRoomId, inviterRoomId, userId } = content.inviteInfo;
24458
24523
  const roomId = inviterRoomId === this._mainRoomId ? inviteeRoomId : inviterRoomId;
@@ -24462,10 +24527,11 @@ class RCLivingPKHandler {
24462
24527
  };
24463
24528
  // 兼容先退出房间,再收到 pk 结束的情况
24464
24529
  const room = this._joinedPKRooms[roomId];
24465
- 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)));
24466
24533
  delete this._PKInfo[roomId];
24467
- (_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({
24468
- 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({
24469
24535
  eventType: 'onFinishOtherRoom',
24470
24536
  endInfo,
24471
24537
  }));
@@ -24501,7 +24567,6 @@ class RCLivingPKHandler {
24501
24567
  registerRoomPKEventListener(listener) {
24502
24568
  var _a, _b;
24503
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({
24504
- status: RCLoggerStatus.SUCCESSED,
24505
24570
  listener: listener && Object.keys(listener),
24506
24571
  }));
24507
24572
  this._appListener = listener;
@@ -24514,23 +24579,23 @@ class RCLivingPKHandler {
24514
24579
  * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
24515
24580
  */
24516
24581
  requestJoinOtherRoom(inviteeRoomId, inviteeUserId, options) {
24517
- 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;
24518
24583
  return __awaiter(this, void 0, void 0, function* () {
24519
- (_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({
24520
24586
  inviteeRoomId,
24521
24587
  inviteeUserId,
24522
24588
  options,
24523
- }));
24589
+ }), traceId);
24524
24590
  if (!(validate('inviteeRoomId', inviteeRoomId, notEmptyString, true)
24525
24591
  && validate('inviteeUserId', inviteeUserId, notEmptyString, true))) {
24526
- (_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({
24527
24593
  status: RCLoggerStatus.FAILED,
24528
24594
  code: RCRTCCode.PARAMS_ERROR,
24529
- msg: 'params error -> inviteeRoomId inviteeUserId',
24530
- }));
24595
+ msg: 'params error -> inviteeRoomId or inviteeUserId',
24596
+ }), traceId);
24531
24597
  return { code: RCRTCCode.PARAMS_ERROR };
24532
24598
  }
24533
- (_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 || {})}`);
24534
24599
  const inviteSessionId = getUUID();
24535
24600
  const autoMix = isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24536
24601
  const inviteInfo = {
@@ -24551,18 +24616,14 @@ class RCLivingPKHandler {
24551
24616
  inviteInfo: JSON.stringify(inviteInfo),
24552
24617
  inviteSessionId,
24553
24618
  };
24554
- (_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)}`);
24555
24619
  const code = yield this._context.requestRoomPK(params);
24556
24620
  if (code !== ErrorCode.SUCCESS) {
24557
- (_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}`);
24558
- (_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({
24559
24622
  status: RCLoggerStatus.FAILED,
24560
24623
  code,
24561
- msg: '',
24562
- }));
24624
+ }), traceId);
24563
24625
  return { code };
24564
24626
  }
24565
- (_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');
24566
24627
  this._PKInfo[inviteeRoomId] = {
24567
24628
  inviteSessionId,
24568
24629
  inviterRoomId: this._mainRoomId,
@@ -24570,11 +24631,9 @@ class RCLivingPKHandler {
24570
24631
  inviterUserAutoMix: autoMix,
24571
24632
  inviteeRoomId,
24572
24633
  };
24573
- (_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({
24574
- inviteeRoomId,
24575
- inviteeUserId,
24576
- options,
24577
- }));
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);
24578
24637
  return { code: RCRTCCode.SUCCESS };
24579
24638
  });
24580
24639
  }
@@ -24585,34 +24644,31 @@ class RCLivingPKHandler {
24585
24644
  * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
24586
24645
  */
24587
24646
  cancelRequestJoinOtherRoom(inviteeRoomId, inviteeUserId, extra) {
24588
- 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;
24589
24648
  return __awaiter(this, void 0, void 0, function* () {
24590
- (_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({
24591
24651
  inviteeRoomId,
24592
24652
  inviteeUserId,
24593
24653
  extra,
24594
- userId: this._context.getCurrentId(),
24595
- roomId: this._mainRoomId,
24596
- }));
24654
+ }), traceId);
24597
24655
  if (!(validate('inviteeRoomId', inviteeRoomId, notEmptyString, true)
24598
24656
  && validate('inviteeUserId', inviteeUserId, notEmptyString, true))) {
24599
- (_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({
24600
24658
  status: RCLoggerStatus.FAILED,
24601
24659
  code: RCRTCCode.PARAMS_ERROR,
24602
24660
  msg: 'params error -> inviteeRoomId or inviteeUserId',
24603
- }));
24661
+ }), traceId);
24604
24662
  return { code: RCRTCCode.PARAMS_ERROR };
24605
24663
  }
24606
24664
  if (!this._PKInfo[inviteeRoomId]) {
24607
- (_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`);
24608
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({
24609
24666
  status: RCLoggerStatus.FAILED,
24610
24667
  code: RCRTCCode.PARAMS_ERROR,
24611
24668
  msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24612
- }));
24669
+ }), traceId);
24613
24670
  return { code: RCRTCCode.PARAMS_ERROR };
24614
24671
  }
24615
- (_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}`);
24616
24672
  const inviteInfo = {
24617
24673
  inviterRoomId: this._mainRoomId,
24618
24674
  inviterUserId: this._context.getCurrentId(),
@@ -24627,24 +24683,17 @@ class RCLivingPKHandler {
24627
24683
  inviteSessionId: this._PKInfo[inviteeRoomId].inviteSessionId,
24628
24684
  inviteInfo: JSON.stringify(inviteInfo),
24629
24685
  };
24630
- (_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)}`);
24631
24686
  const code = yield this._context.cancelRoomPK(params);
24632
24687
  if (code !== ErrorCode.SUCCESS) {
24633
- (_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}`);
24634
- (_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({
24635
24689
  status: RCLoggerStatus.FAILED,
24636
24690
  code,
24637
- msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24638
- }));
24691
+ }), traceId);
24639
24692
  return { code };
24640
24693
  }
24641
- (_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');
24642
- (_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({
24643
24695
  status: RCLoggerStatus.SUCCESSED,
24644
- inviteeRoomId,
24645
- inviteeUserId,
24646
- extra,
24647
- }));
24696
+ }), traceId);
24648
24697
  delete this._PKInfo[inviteeRoomId];
24649
24698
  return { code: RCRTCCode.SUCCESS };
24650
24699
  });
@@ -24658,35 +24707,32 @@ class RCLivingPKHandler {
24658
24707
  * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
24659
24708
  */
24660
24709
  responseJoinOtherRoom(inviterRoomId, inviterUserId, agree, options) {
24661
- 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;
24662
24711
  return __awaiter(this, void 0, void 0, function* () {
24663
- (_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({
24664
24714
  inviterRoomId,
24665
24715
  inviterUserId,
24666
24716
  agree,
24667
24717
  options,
24668
- userId: this._context.getCurrentId(),
24669
- roomId: this._mainRoomId,
24670
- }));
24718
+ }), traceId);
24671
24719
  if (!(validate('inviterRoomId', inviterRoomId, notEmptyString, true)
24672
24720
  && validate('inviterUserId', inviterUserId, notEmptyString, true))) {
24673
- (_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({
24674
24722
  status: RCLoggerStatus.FAILED,
24675
24723
  code: RCRTCCode.PARAMS_ERROR,
24676
24724
  msg: 'params error -> inviterRoomId or inviterUserId',
24677
- }));
24725
+ }), traceId);
24678
24726
  return { code: RCRTCCode.PARAMS_ERROR };
24679
24727
  }
24680
24728
  if (!this._PKInfo[inviterRoomId]) {
24681
- (_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`);
24682
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({
24683
24730
  status: RCLoggerStatus.FAILED,
24684
24731
  code: RCRTCCode.PARAMS_ERROR,
24685
24732
  msg: `User ${inviterUserId} in room ${inviterRoomId} did not send a request for connection`,
24686
- }));
24733
+ }), traceId);
24687
24734
  return { code: RCRTCCode.PARAMS_ERROR };
24688
24735
  }
24689
- (_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 || {})}`);
24690
24736
  const { inviteSessionId, inviterUserAutoMix } = this._PKInfo[inviterRoomId];
24691
24737
  const autoMix = isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24692
24738
  const value = {
@@ -24716,27 +24762,17 @@ class RCLivingPKHandler {
24716
24762
  key: `${inviterRoomId}|${this._mainRoomId}`,
24717
24763
  value: JSON.stringify(value),
24718
24764
  };
24719
- (_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)}`);
24720
24765
  const code = yield this._context.responseRoomPK(params);
24721
24766
  if (code !== ErrorCode.SUCCESS) {
24722
- (_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}`);
24723
- (_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({
24724
24768
  status: RCLoggerStatus.FAILED,
24725
24769
  code,
24726
- msg: '',
24727
- }));
24770
+ }), traceId);
24728
24771
  return { code };
24729
24772
  }
24730
- (_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');
24731
- (_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({
24732
24774
  status: RCLoggerStatus.SUCCESSED,
24733
- inviterRoomId,
24734
- inviterUserId,
24735
- agree,
24736
- options,
24737
- userId: this._context.getCurrentId(),
24738
- roomId: this._mainRoomId,
24739
- }));
24775
+ }), traceId);
24740
24776
  this._PKInfo[inviterRoomId].inviteeUserAutoMix = autoMix;
24741
24777
  return { code: RCRTCCode.SUCCESS };
24742
24778
  });
@@ -24746,35 +24782,34 @@ class RCLivingPKHandler {
24746
24782
  * @roomId 副房间的 roomId
24747
24783
  */
24748
24784
  joinOtherRoom(roomId) {
24749
- 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;
24750
24786
  return __awaiter(this, void 0, void 0, function* () {
24751
- (_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({
24752
24789
  roomId,
24753
- userId: this._context.getCurrentId(),
24754
- }));
24790
+ }), traceId);
24755
24791
  if (!(validate('roomId', roomId, notEmptyString, true))) {
24756
- (_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({
24757
24793
  status: RCLoggerStatus.FAILED,
24758
24794
  code: RCRTCCode.PARAMS_ERROR,
24759
24795
  msg: 'params error -> roomId',
24760
- }));
24796
+ }), traceId);
24761
24797
  return { code: RCRTCCode.PARAMS_ERROR };
24762
24798
  }
24763
24799
  if (this._context.getConnectionStatus() !== ConnectionStatus.CONNECTED) {
24764
- (_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({
24765
24801
  status: RCLoggerStatus.FAILED,
24766
24802
  code: RCRTCCode.SIGNAL_DISCONNECTED,
24767
24803
  msg: 'IM disconnected',
24768
- }));
24804
+ }), traceId);
24769
24805
  return { code: RCRTCCode.SIGNAL_DISCONNECTED };
24770
24806
  }
24771
- (_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}`);
24772
24807
  if (this._joinedPKRooms[roomId]) {
24773
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({
24774
24809
  status: RCLoggerStatus.FAILED,
24775
24810
  code: RCRTCCode.REPERT_JOIN_ROOM,
24776
24811
  msg: 'Join the room repeatedly',
24777
- }));
24812
+ }), traceId);
24778
24813
  return { code: RCRTCCode.REPERT_JOIN_ROOM };
24779
24814
  }
24780
24815
  const livingType = RCLivingType.VIDEO; // signal 不处理 livingType 故写死 RCLivingType.VIDEO
@@ -24785,23 +24820,18 @@ class RCLivingPKHandler {
24785
24820
  const room = new RCLivingRoom(this._context, this._runtime, roomId, this._service, this._initOptions, livingType, false, false, false, this._clientSessionId);
24786
24821
  const { code, data } = yield room.__innerInit(RTCMode.LIVE, undefined, livingType, innerUserData);
24787
24822
  if (code !== RCRTCCode.SUCCESS) {
24788
- (_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}`);
24789
- (_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({
24790
24824
  status: RCLoggerStatus.FAILED,
24791
24825
  code,
24792
- msg: '',
24793
- }));
24826
+ }), traceId);
24794
24827
  return { code: code };
24795
24828
  }
24796
- (_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)}`);
24797
24829
  // 回调主直播房间,已加入 PK 房间
24798
24830
  this._joinedPKRooms[roomId] = room;
24799
- yield this._onJoinedPKRoom(roomId, room);
24800
- (_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({
24801
24833
  status: RCLoggerStatus.SUCCESSED,
24802
- roomId,
24803
- userId: this._context.getCurrentId(),
24804
- }));
24834
+ }), traceId);
24805
24835
  return {
24806
24836
  room, code: RCRTCCode.SUCCESS, userIds: room.getRemoteUserIds(), tracks: room.getRemoteTracks(),
24807
24837
  };
@@ -24813,8 +24843,11 @@ class RCLivingPKHandler {
24813
24843
  * @param isQuitPK 是否要结束连麦
24814
24844
  */
24815
24845
  leaveOtherRoom(room, isQuitPK) {
24846
+ var _a, _b, _c, _d;
24816
24847
  return __awaiter(this, void 0, void 0, function* () {
24817
- 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));
24818
24851
  });
24819
24852
  }
24820
24853
  /**
@@ -25098,9 +25131,8 @@ class RCLivingRoom extends RCAbstractRoom {
25098
25131
  var _a;
25099
25132
  const { userId } = parseTrackId(resourceId);
25100
25133
  // 是否是主房间资源
25101
- // const isHostRoomResource = !!this._roomResources[userId]?.find(item => getTrackId(item) === resourceId)
25102
25134
  const isHostRoomResource = !!((_a = this._store.getResourcesByUserId(userId)) === null || _a === void 0 ? void 0 : _a.find((item) => getTrackId(item) === resourceId));
25103
- // 是否是主房间资源
25135
+ // 是否是副房间资源
25104
25136
  let isPKRoomResource = false;
25105
25137
  /**
25106
25138
  * 无副房间时,只验证是否为主房间资源
@@ -25132,7 +25164,7 @@ class RCLivingRoom extends RCAbstractRoom {
25132
25164
  * 副房间不可调用
25133
25165
  */
25134
25166
  if (!this._store.isMainRoom) {
25135
- (_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');
25136
25168
  return { code: RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM };
25137
25169
  }
25138
25170
  return this._mcuConfigBuilder;
@@ -25222,7 +25254,7 @@ class RCLivingRoom extends RCAbstractRoom {
25222
25254
  * @override
25223
25255
  * 加入 PK 房间回调
25224
25256
  */
25225
- _onJoinedPKRoom(roomId, room) {
25257
+ _onJoinedPKRoom(roomId, traceId) {
25226
25258
  return __awaiter(this, void 0, void 0, function* () {
25227
25259
  /**
25228
25260
  * 加入副房间之后,如果己方发布过资源,且参与连麦,
@@ -25231,8 +25263,7 @@ class RCLivingRoom extends RCAbstractRoom {
25231
25263
  this._invoker.push(new ExchangeWithPushOtherRoomCommand(roomId, (pcName) => ({
25232
25264
  pushOtherRooms: this._getPushOtherRoomsParams(),
25233
25265
  headers: this._getRTCReqestHeaders(pcName),
25234
- }), this._roomPKHandler));
25235
- // push(async () => this._onLeavePKRoom(roomId))
25266
+ }), this._roomPKHandler, traceId));
25236
25267
  });
25237
25268
  }
25238
25269
  /**
@@ -25421,7 +25452,7 @@ class RCAudienceClient {
25421
25452
  this._appListener = null;
25422
25453
  this._crtUserId = this._context.getCurrentId();
25423
25454
  this._service = new RCMediaService(runtime, _context, _initOption.mediaServer);
25424
- 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);
25425
25456
  /**
25426
25457
  * 利用 store 存储数据
25427
25458
  */
@@ -25429,7 +25460,6 @@ class RCAudienceClient {
25429
25460
  this._peerCManager.setStore(this._store);
25430
25461
  }
25431
25462
  _getReqHeaders(livingType) {
25432
- var _a, _b;
25433
25463
  return __awaiter(this, void 0, void 0, function* () {
25434
25464
  // 直播观众端 RoomId 与 UserId 保持一致
25435
25465
  const roomId = this._crtUserId;
@@ -25437,22 +25467,17 @@ class RCAudienceClient {
25437
25467
  if (!this._rtcToken) {
25438
25468
  const { code, data } = yield this._context.getRTCToken(roomId, RTCMode.LIVE, livingType);
25439
25469
  if (code !== ErrorCode.SUCCESS) {
25440
- (_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}`);
25441
25470
  return { code: RCRTCCode.SIGNAL_ERROR };
25442
25471
  }
25443
25472
  this._rtcToken = data.rtcToken;
25444
25473
  }
25474
+ /**
25475
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
25476
+ */
25477
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
25445
25478
  return {
25446
25479
  code: RCRTCCode.SUCCESS,
25447
- headers: {
25448
- 'App-Key': this._context.getAppkey(),
25449
- UserId: this._crtUserId,
25450
- RoomId: roomId,
25451
- RoomType: RTCMode.LIVE,
25452
- Token: this._rtcToken,
25453
- 'Peer-Connection-Id': this._pcName,
25454
- 'Client-Session-Id': this._clientSessionId,
25455
- },
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),
25456
25481
  };
25457
25482
  });
25458
25483
  }
@@ -25489,7 +25514,7 @@ class RCAudienceClient {
25489
25514
  });
25490
25515
  }
25491
25516
  __subscribe(liveUrl, livingType, mediaType, subTiny = false) {
25492
- 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;
25493
25518
  return __awaiter(this, void 0, void 0, function* () {
25494
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({
25495
25520
  liveUrl,
@@ -25510,8 +25535,7 @@ class RCAudienceClient {
25510
25535
  !this._fromRetry && ((_e = this._pc) === null || _e === void 0 ? void 0 : _e.clearReTryExchangeTimer());
25511
25536
  this._fromRetry = false;
25512
25537
  if (!isString(liveUrl)) {
25513
- (_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}`);
25514
- (_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({
25515
25539
  status: RCLoggerStatus.FAILED,
25516
25540
  code: RCRTCCode.PARAMS_ERROR,
25517
25541
  msg: `params error -> liveUrl: ${liveUrl}`,
@@ -25519,8 +25543,8 @@ class RCAudienceClient {
25519
25543
  return { code: RCRTCCode.PARAMS_ERROR, tracks };
25520
25544
  }
25521
25545
  if (![RCLivingType.AUDIO, RCLivingType.VIDEO].includes(livingType)) {
25522
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.error(`livingType is invalid: ${livingType}`);
25523
- (_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({
25524
25548
  status: RCLoggerStatus.FAILED,
25525
25549
  code: RCRTCCode.PARAMS_ERROR,
25526
25550
  msg: `params error -> livingType: ${livingType}`,
@@ -25528,8 +25552,7 @@ class RCAudienceClient {
25528
25552
  return { code: RCRTCCode.PARAMS_ERROR, tracks };
25529
25553
  }
25530
25554
  if (![RCMediaType.AUDIO_ONLY, RCMediaType.VIDEO_ONLY, RCMediaType.AUDIO_VIDEO].includes(mediaType)) {
25531
- (_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}`);
25532
- (_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({
25533
25556
  status: RCLoggerStatus.FAILED,
25534
25557
  code: RCRTCCode.PARAMS_ERROR,
25535
25558
  msg: `params error -> -> mediaType: ${mediaType}`,
@@ -25538,7 +25561,7 @@ class RCAudienceClient {
25538
25561
  }
25539
25562
  // 允许观众动态切换大小流订阅,或重复订阅同一资源
25540
25563
  if (this._liveUrl && this._liveUrl !== liveUrl) {
25541
- (_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({
25542
25565
  status: RCLoggerStatus.FAILED,
25543
25566
  code: RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,
25544
25567
  msg: 'repeat subscribe',
@@ -25562,10 +25585,10 @@ class RCAudienceClient {
25562
25585
  // 构建 http req headers
25563
25586
  const { code, headers } = yield this._getReqHeaders(livingType);
25564
25587
  if (code !== RCRTCCode.SUCCESS) {
25565
- (_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({
25566
25589
  status: RCLoggerStatus.FAILED,
25567
25590
  code,
25568
- msg: '',
25591
+ msg: 'getRTCToken failed',
25569
25592
  }));
25570
25593
  return { code, tracks };
25571
25594
  }
@@ -25589,25 +25612,21 @@ class RCAudienceClient {
25589
25612
  };
25590
25613
  const resp = yield this._service.broadcastSubscribe(headers, body);
25591
25614
  if (resp.code !== RCRTCCode.SUCCESS) {
25592
- (_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}`);
25593
- (_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({
25594
25616
  status: RCLoggerStatus.FAILED,
25595
25617
  code: resp.code,
25596
- msg: `andience subscribe failed: ${resp.code}`,
25597
25618
  }));
25598
25619
  return { code: resp.code, tracks };
25599
25620
  }
25600
25621
  const data = resp.data;
25601
25622
  if (data.resultCode !== RCRTCCode.SUCCESS) {
25602
- (_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}`);
25603
- (_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({
25604
25624
  status: RCLoggerStatus.FAILED,
25605
25625
  code: data.resultCode,
25606
- msg: `andience subscribe failed! code: ${data.resultCode}; message: ${data.message}`,
25626
+ msg: data.message,
25607
25627
  }));
25608
25628
  return { code: data.resultCode, tracks };
25609
25629
  }
25610
- (_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}`);
25611
25630
  this._livingType = livingType;
25612
25631
  this._mediaType = mediaType;
25613
25632
  this._subTiny = subTiny;
@@ -25626,7 +25645,7 @@ class RCAudienceClient {
25626
25645
  readyTracks && this._updateTrackIdSSRCMap(answer.sdp, readyTracks);
25627
25646
  // 缓存订阅资源的ssrc和msid
25628
25647
  // AbstractStatParser.formatSourceIdMapFromSdp(answer.sdp, 'subscribe');
25629
- (_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({
25630
25649
  status: RCLoggerStatus.SUCCESSED,
25631
25650
  liveUrl,
25632
25651
  }));
@@ -25655,7 +25674,7 @@ class RCAudienceClient {
25655
25674
  });
25656
25675
  }
25657
25676
  __unsubscribe() {
25658
- 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;
25659
25678
  return __awaiter(this, void 0, void 0, function* () {
25660
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({
25661
25680
  liveUrl: this._liveUrl,
@@ -25674,19 +25693,15 @@ class RCAudienceClient {
25674
25693
  const { headers } = yield this._getReqHeaders();
25675
25694
  const { code } = yield this._service.broadcastExit(headers);
25676
25695
  if (code !== RCRTCCode.SUCCESS) {
25677
- (_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}`);
25678
- (_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({
25679
25697
  status: RCLoggerStatus.FAILED,
25680
25698
  code,
25681
- msg: `broadcast unsubscribe failed: ${code}`,
25682
25699
  }));
25683
25700
  }
25684
25701
  else {
25685
- (_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');
25686
- (_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({
25687
25703
  status: RCLoggerStatus.SUCCESSED,
25688
25704
  liveUrl: this._liveUrl,
25689
- msg: 'broadcast unsubscribe success',
25690
25705
  }));
25691
25706
  this._subscribedList = [];
25692
25707
  }
@@ -25710,16 +25725,17 @@ class RCAudienceClient {
25710
25725
  this._appListener = listener;
25711
25726
  }
25712
25727
  _onTrackReady(evt) {
25713
- var _a, _b, _c, _d;
25728
+ var _a, _b, _c, _d, _e, _f;
25714
25729
  const { track } = evt.receiver;
25715
25730
  const mediaType = track.kind === 'audio' ? RCMediaType.AUDIO_ONLY : RCMediaType.VIDEO_ONLY;
25716
25731
  const rTrack = this._subTracks[mediaType];
25717
25732
  rTrack.__innerSetMediaStreamTrack(track);
25718
25733
  try {
25719
- (_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);
25720
25736
  }
25721
25737
  catch (error) {
25722
- (_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));
25723
25739
  }
25724
25740
  }
25725
25741
  }
@@ -25785,14 +25801,12 @@ class RCAudienceLivingRoom {
25785
25801
  // 北极星数据
25786
25802
  this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this, PolarisRole.Audience);
25787
25803
  this._polarisReport.sendR1();
25788
- 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);
25789
25805
  // 注册监听 rtc_ntf 信令数据,解码后拉取指定房间数据
25790
25806
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
25791
- var _a, _b;
25792
25807
  // 1. 拉取数据,非本房间可不拉取
25793
25808
  // 2. 拉取完成后调用原通知方法 this.singalDataChange(_roomId)
25794
25809
  const { time, type, roomId } = this._context.decodeRtcNotify(buffer);
25795
- (_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 })}`);
25796
25810
  switch (type) {
25797
25811
  case 1:
25798
25812
  // RTC KV拉取
@@ -25809,7 +25823,7 @@ class RCAudienceLivingRoom {
25809
25823
  this._setInitData();
25810
25824
  }
25811
25825
  _startPull(roomId, timestamp) {
25812
- var _a, _b;
25826
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25813
25827
  return __awaiter(this, void 0, void 0, function* () {
25814
25828
  if (this._isPulling) {
25815
25829
  return;
@@ -25820,14 +25834,17 @@ class RCAudienceLivingRoom {
25820
25834
  this._isPulling = false;
25821
25835
  return;
25822
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);
25823
25839
  const { code, data } = yield this._context.pullRTCRoomEntry(roomId);
25824
25840
  if (code === ErrorCode.SUCCESS) {
25825
25841
  this._isPulling = false;
25826
25842
  this._pullTime = data.syncTime || 0;
25827
25843
  const kvEntries = (data === null || data === void 0 ? void 0 : data.kvEntries) || [];
25828
- (_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)}`);
25829
- 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);
25830
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);
25831
25848
  });
25832
25849
  }
25833
25850
  /**
@@ -25889,10 +25906,7 @@ class RCAudienceLivingRoom {
25889
25906
  });
25890
25907
  }
25891
25908
  _assertRoomDestroyed() {
25892
- var _a, _b;
25893
25909
  if (this._destroyed) {
25894
- const msg = 'This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.';
25895
- (_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);
25896
25910
  return RCRTCCode.ROOM_HAS_BEEN_DESTROYED;
25897
25911
  }
25898
25912
  }
@@ -25905,26 +25919,18 @@ class RCAudienceLivingRoom {
25905
25919
  * * key RC_RTC_SESSIONID value: sessionId
25906
25920
  * * key RC_CDN value: CDN 资源数据
25907
25921
  */
25908
- singalDataChange(singalData, roomId) {
25909
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
25910
- (_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({
25911
- singalData,
25912
- roomId,
25913
- userId: this._crtUserId,
25914
- }));
25922
+ singalDataChange(singalData, roomId, traceId) {
25923
+ var _a, _b, _c;
25915
25924
  if (roomId !== this._roomId) {
25916
- (_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}`);
25917
- (_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({
25918
25926
  status: RCLoggerStatus.FAILED,
25919
- code: '',
25920
- msg: `id inconsistency -> params id:${roomId},current id:${this._roomId}`,
25921
- }));
25927
+ msg: `roomId inconsistency -> params roomId:${roomId}, current roomId:${this._roomId}`,
25928
+ }), traceId);
25922
25929
  return;
25923
25930
  }
25924
- (_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 || {})}`);
25925
25931
  const allMcuUris = [];
25926
- const CDNUrisStr = (_j = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _j === void 0 ? void 0 : _j.value;
25927
- 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);
25928
25934
  singalData.forEach((data) => {
25929
25935
  const { key, value, timestamp, uid, } = data;
25930
25936
  const isResKey = key.indexOf('RC_RES_') !== -1;
@@ -25934,7 +25940,7 @@ class RCAudienceLivingRoom {
25934
25940
  const anchorUris = JSON.parse(serverUris.uris || '[]');
25935
25941
  allMcuUris.push(...mcuUris);
25936
25942
  // 处理主播发布的分流资源
25937
- this._diffAnchorResource(anchorUris, uid);
25943
+ this._diffAnchorResource(anchorUris, uid, traceId);
25938
25944
  return;
25939
25945
  }
25940
25946
  // 处理主播列表
@@ -25942,21 +25948,15 @@ class RCAudienceLivingRoom {
25942
25948
  const anchorUserIds = JSON.parse(value || '[]');
25943
25949
  const { joinUserIds, leftUserIds } = this._diffAnchorList(anchorUserIds);
25944
25950
  if (joinUserIds.length > 0) {
25945
- this._handleNewJoinedAnchor(joinUserIds);
25951
+ this._handleNewJoinedAnchor(joinUserIds, traceId);
25946
25952
  }
25947
25953
  if (leftUserIds.length > 0) {
25948
- this._handleLeftedAnchor(leftUserIds);
25954
+ this._handleLeftedAnchor(leftUserIds, traceId);
25949
25955
  }
25950
25956
  }
25951
25957
  });
25952
25958
  // 处理直播间 MCU 合流资源资源
25953
- this._diffRoomResource(allMcuUris);
25954
- (_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({
25955
- status: RCLoggerStatus.SUCCESSED,
25956
- singalData,
25957
- roomId,
25958
- userId: this._crtUserId,
25959
- }));
25959
+ this._diffRoomResource(allMcuUris, traceId);
25960
25960
  }
25961
25961
  /**
25962
25962
  * 计算加入离开的主播 ID 列表
@@ -25969,19 +25969,18 @@ class RCAudienceLivingRoom {
25969
25969
  joinUserIds,
25970
25970
  };
25971
25971
  }
25972
- _handleNewJoinedAnchor(list) {
25972
+ _handleNewJoinedAnchor(list, traceId) {
25973
25973
  var _a, _b;
25974
25974
  // 更新 _roomAnchorList
25975
25975
  this._roomAnchorList.push(...list);
25976
25976
  // 触发 app 主播加入监听
25977
- (_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({
25978
- 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({
25979
25978
  eventType: 'onAnchorJoin',
25980
25979
  list,
25981
- }));
25980
+ }), traceId);
25982
25981
  this._callAppListener('onAnchorJoin', list);
25983
25982
  }
25984
- _handleLeftedAnchor(list) {
25983
+ _handleLeftedAnchor(list, traceId) {
25985
25984
  var _a, _b;
25986
25985
  return __awaiter(this, void 0, void 0, function* () {
25987
25986
  // 更新 _roomAnchorList
@@ -25997,18 +25996,17 @@ class RCAudienceLivingRoom {
25997
25996
  tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
25998
25997
  }
25999
25998
  // 触发 app 主播离开监听
26000
- (_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({
26001
- 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({
26002
26000
  eventType: 'onAnchorLeave',
26003
26001
  list,
26004
- }));
26002
+ }), traceId);
26005
26003
  this._callAppListener('onAnchorLeave', list);
26006
26004
  });
26007
26005
  }
26008
26006
  /**
26009
26007
  * 计算新发布和取消发布的合流资源
26010
26008
  */
26011
- _diffRoomResource(uris) {
26009
+ _diffRoomResource(uris, traceId) {
26012
26010
  var _a, _b;
26013
26011
  return __awaiter(this, void 0, void 0, function* () {
26014
26012
  const newPubTracks = [];
@@ -26044,31 +26042,23 @@ class RCAudienceLivingRoom {
26044
26042
  });
26045
26043
  // 通知 APP 新发布的 tracks
26046
26044
  if (newPubTracks.length > 0) {
26047
- (_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({
26048
- 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({
26049
26046
  eventType: 'onTrackPublish',
26050
26047
  trackIds: newPubTracks.map((track) => track.getTrackId()),
26051
- }));
26048
+ }), traceId);
26052
26049
  this._callAppListener('onTrackPublish', newPubTracks);
26053
26050
  }
26054
26051
  if (unpubTracks.length > 0) {
26055
- this._onUserUnpublish(unpubTracks, 'onTrackUnpublish');
26052
+ this._onUserUnpublish(unpubTracks, 'onTrackUnpublish', traceId);
26056
26053
  }
26057
26054
  });
26058
26055
  }
26059
26056
  /**
26060
26057
  * 计算主播发布和取消发布的资源,以及资源的状态变更
26061
26058
  */
26062
- _diffAnchorResource(uris, userId) {
26063
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26059
+ _diffAnchorResource(uris, userId, traceId) {
26060
+ var _a, _b, _c, _d, _e, _f;
26064
26061
  return __awaiter(this, void 0, void 0, function* () {
26065
- /**
26066
- * 设置房间内 RTC 资源 ssrc 和 trackId map
26067
- */
26068
- uris.forEach((res) => {
26069
- const { ssrc, resourceId } = JSON.parse(res.uri);
26070
- this._store.setTrackIdSSRCMap(ssrc, resourceId);
26071
- });
26072
26062
  // 当前资源清单
26073
26063
  const nowRes = this._roomAnchorRes[userId] || (this._roomAnchorRes[userId] = []);
26074
26064
  const { publishedList, unpublishedList, modifiedList } = diffPublishResources(nowRes, uris);
@@ -26106,17 +26096,19 @@ class RCAudienceLivingRoom {
26106
26096
  // 重新订阅二次发布资源
26107
26097
  if (subedTracks.length) {
26108
26098
  const trackIds = subedTracks.map((item) => item.getTrackId());
26109
- (_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)}`);
26110
26099
  const { code } = yield push(() => this._subscribeHandle(subedTracks, true));
26111
26100
  if (code !== RCRTCCode.SUCCESS) {
26112
- (_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
+ }));
26113
26106
  }
26114
26107
  }
26115
- (_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({
26116
- 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({
26117
26109
  eventType: 'onAnchorTrackPublish',
26118
26110
  trackIds: newTracks.map((track) => track.getTrackId()),
26119
- }));
26111
+ }), traceId);
26120
26112
  this._callAppListener('onAnchorTrackPublish', newTracks);
26121
26113
  }
26122
26114
  if (unpublishedList.length) {
@@ -26131,7 +26123,7 @@ class RCAudienceLivingRoom {
26131
26123
  const trackId = getTrackId(item);
26132
26124
  return this._remoteTracks[trackId];
26133
26125
  });
26134
- yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish');
26126
+ yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish', traceId);
26135
26127
  }
26136
26128
  if (modifiedList.length) {
26137
26129
  const resIds = nowRes.map(getTrackId);
@@ -26143,27 +26135,17 @@ class RCAudienceLivingRoom {
26143
26135
  nowRes[index].state = item.state;
26144
26136
  const rTrack = this._remoteTracks[id];
26145
26137
  rTrack.__innerSetRemoteMuted(item.state === 0);
26146
- if (rTrack.isAudioTrack()) {
26147
- (_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({
26148
- status: RCLoggerStatus.SUCCESSED,
26149
- eventType: 'onAudioMuteChange',
26150
- trackId: rTrack.getTrackId(),
26151
- }));
26152
- this._callAppListener('onAudioMuteChange', rTrack);
26153
- }
26154
- else {
26155
- (_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({
26156
- status: RCLoggerStatus.SUCCESSED,
26157
- eventType: 'onVideoMuteChange',
26158
- trackId: rTrack.getTrackId(),
26159
- }));
26160
- this._callAppListener('onVideoMuteChange', rTrack);
26161
- }
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);
26162
26144
  }
26163
26145
  }
26164
26146
  });
26165
26147
  }
26166
- _onUserUnpublish(tracks, eventName) {
26148
+ _onUserUnpublish(tracks, eventName, traceId) {
26167
26149
  var _a, _b;
26168
26150
  return __awaiter(this, void 0, void 0, function* () {
26169
26151
  // 需要替业务层取消订阅,业务层只需关注 UI 变化
@@ -26175,18 +26157,16 @@ class RCAudienceLivingRoom {
26175
26157
  delete this._remoteTracks[item.getTrackId()];
26176
26158
  });
26177
26159
  // 通知 APP 取消发布的 tracks
26178
- (_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({
26179
- 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({
26180
26161
  eventType: eventName,
26181
26162
  trackIds: tracks.map((track) => track.getTrackId()),
26182
- }));
26163
+ }), traceId);
26183
26164
  this._callAppListener(eventName, tracks);
26184
26165
  });
26185
26166
  }
26186
26167
  _callAppListener(eventType, ...attrs) {
26187
- var _a, _b, _c, _d, _e;
26188
- (_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)}`);
26189
- 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];
26190
26170
  if (!handle) {
26191
26171
  return;
26192
26172
  }
@@ -26194,7 +26174,7 @@ class RCAudienceLivingRoom {
26194
26174
  handle(...attrs);
26195
26175
  }
26196
26176
  catch (error) {
26197
- (_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));
26198
26178
  }
26199
26179
  }
26200
26180
  /**
@@ -26203,17 +26183,15 @@ class RCAudienceLivingRoom {
26203
26183
  _reTryExchange() {
26204
26184
  return __awaiter(this, void 0, void 0, function* () {
26205
26185
  push(() => __awaiter(this, void 0, void 0, function* () {
26206
- var _a, _b, _c, _d, _e;
26186
+ var _a;
26207
26187
  const { reqBody } = yield this._createSubscribeParams(this._subscribedList, {}, true);
26208
26188
  // 发送 /exchange 请求
26209
26189
  const resp = yield this._exchangeHandle(reqBody);
26210
26190
  if (resp.code !== RCRTCCode.SUCCESS) {
26211
- (_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}`);
26212
26191
  return { code: resp.code };
26213
26192
  }
26214
26193
  const { sdp: answer, resultCode } = resp.data;
26215
26194
  if (resultCode !== RCRTCCode.SUCCESS) {
26216
- (_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}`);
26217
26195
  return { code: resultCode };
26218
26196
  }
26219
26197
  // 请求成功,清除 ice 断线重连的定时器
@@ -26221,7 +26199,7 @@ class RCAudienceLivingRoom {
26221
26199
  const mcuSubList = this._subscribedList.filter((item) => item.track.isMCUTrack());
26222
26200
  if (mcuSubList.length > 0) {
26223
26201
  const mcuTrackId = mcuSubList[0].track.getTrackId();
26224
- 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;
26225
26203
  const currentMsid = [this._roomId, 'RongCloudRTC'].join('_');
26226
26204
  answer.sdp = answer.sdp.replace(new RegExp(sdpMsid, 'g'), currentMsid);
26227
26205
  }
@@ -26288,23 +26266,28 @@ class RCAudienceLivingRoom {
26288
26266
  });
26289
26267
  }
26290
26268
  _subscribeHandle(tracks, forceReq = false) {
26291
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26269
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26292
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);
26293
26276
  const roomStatusCode = this._assertRoomDestroyed();
26294
26277
  if (roomStatusCode) {
26295
- (_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({
26296
26279
  status: RCLoggerStatus.FAILED,
26297
26280
  code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26298
26281
  msg: 'room destroyed',
26299
- }));
26282
+ }), traceId);
26300
26283
  return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26301
26284
  }
26302
26285
  if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
26303
- (_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({
26304
26287
  status: RCLoggerStatus.FAILED,
26305
26288
  code: RCRTCCode.PARAMS_ERROR,
26306
26289
  msg: 'params error -> tracks',
26307
- }));
26290
+ }), traceId);
26308
26291
  return { code: RCRTCCode.PARAMS_ERROR };
26309
26292
  }
26310
26293
  const { pc, pcName } = this._peerCManager.createPeerCList(tracks)[0];
@@ -26335,23 +26318,15 @@ class RCAudienceLivingRoom {
26335
26318
  trackChanged = true;
26336
26319
  });
26337
26320
  if (!trackChanged && !forceReq) {
26338
- (_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({
26339
- status: RCLoggerStatus.FAILED,
26340
- 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,
26341
26323
  msg: 'repeat subscribe',
26342
- }));
26324
+ }), traceId);
26343
26325
  return { code: RCRTCCode.SUCCESS };
26344
26326
  }
26345
26327
  // 北极星上报
26346
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26347
- (_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({
26348
- status: RCLoggerStatus.SUCCESSED,
26349
- trackIds: tracks.map(getTrackIdFromAttr),
26350
- roomId: this._roomId,
26351
- userId: this._crtUserId,
26352
- forceReq,
26353
- }));
26354
- 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);
26355
26330
  });
26356
26331
  }
26357
26332
  /**
@@ -26365,12 +26340,11 @@ class RCAudienceLivingRoom {
26365
26340
  const trackId = [msid, track.kind === 'audio' ? RCMediaType.AUDIO_ONLY : RCMediaType.VIDEO_ONLY].join('_');
26366
26341
  const rTrack = this._remoteTracks[trackId];
26367
26342
  if (!rTrack) {
26368
- (_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}`);
26369
26344
  return;
26370
26345
  }
26371
26346
  rTrack.__innerSetMediaStreamTrack(track);
26372
- (_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({
26373
- 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({
26374
26348
  eventType: 'onTrackReady',
26375
26349
  trackId: rTrack.getTrackId(),
26376
26350
  }));
@@ -26379,31 +26353,23 @@ class RCAudienceLivingRoom {
26379
26353
  }
26380
26354
  _getReqHeaders() {
26381
26355
  const userId = this._crtUserId;
26356
+ /**
26357
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
26358
+ */
26359
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
26382
26360
  // 直播观众端 RoomId 与 UserId 保持一致
26383
- return {
26384
- 'App-Key': this._context.getAppkey(),
26385
- RoomId: userId,
26386
- Token: this._joinResData.token,
26387
- RoomType: RTCMode.LIVE,
26388
- UserId: userId,
26389
- 'Session-Id': this._sessionId,
26390
- 'Peer-Connection-Id': this._pcName,
26391
- 'Client-Session-Id': this._clientSessionId,
26392
- };
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);
26393
26362
  }
26394
26363
  _exchangeHandle(body) {
26395
26364
  return this._service.broadcastSubscribe(this._getReqHeaders(), body);
26396
26365
  }
26397
- _updateSubListHandle(tracks, forceReq = false) {
26398
- 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;
26399
26368
  return __awaiter(this, void 0, void 0, function* () {
26400
- const roomStatusCode = this._assertRoomDestroyed();
26401
- if (roomStatusCode) {
26402
- return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26403
- }
26404
- if (!validate('resources', tracks, () => isArray(tracks) && tracks.every((res) => res instanceof RCRemoteTrack || res.track instanceof RCRemoteTrack), true)) {
26405
- return { code: RCRTCCode.PARAMS_ERROR };
26406
- }
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);
26407
26373
  let attrs = tracks.map((item) => (item instanceof RCRemoteTrack ? { track: item } : Object.assign({}, item)));
26408
26374
  // resourceId 去重,并做数据深拷贝
26409
26375
  const map = {};
@@ -26438,6 +26404,10 @@ class RCAudienceLivingRoom {
26438
26404
  changed = true;
26439
26405
  }
26440
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);
26441
26411
  return { code: RCRTCCode.SUCCESS };
26442
26412
  }
26443
26413
  }
@@ -26447,12 +26417,6 @@ class RCAudienceLivingRoom {
26447
26417
  // 连通率相关埋点-订阅开始
26448
26418
  recordQualitySubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26449
26419
  recordQualityUnsubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26450
- (_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({
26451
- trackIds: tracks.map(getTrackIdFromAttr),
26452
- roomId: this._roomId,
26453
- userId: this._crtUserId,
26454
- forceReq,
26455
- }));
26456
26420
  // MediaServer 交互
26457
26421
  const { reqBody } = yield this._createSubscribeParams(attrs, {}, false);
26458
26422
  const result = yield this._exchangeHandle(reqBody);
@@ -26462,16 +26426,24 @@ class RCAudienceLivingRoom {
26462
26426
  crtSubList.forEach((item) => {
26463
26427
  resourceIds.push(item.track.getTrackId());
26464
26428
  });
26465
- (_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);
26466
26430
  }
26467
26431
  if (result.code !== RCRTCCode.SUCCESS) {
26468
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);
26469
26437
  return { code: result.code };
26470
26438
  }
26471
26439
  const { sdp: answer, resultCode, message, subscribedList, } = result.data;
26472
26440
  if (resultCode !== RCRTCCode.SUCCESS) {
26473
26441
  reportQualitySubscribeAndUnsubscribeData(attrs, resultCode);
26474
- (_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);
26475
26447
  return { code: resultCode };
26476
26448
  }
26477
26449
  // 修改 answer.sdp 中 msid
@@ -26487,6 +26459,11 @@ class RCAudienceLivingRoom {
26487
26459
  const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
26488
26460
  if (resCode !== RCRTCCode.SUCCESS) {
26489
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);
26490
26467
  return { code: resCode };
26491
26468
  }
26492
26469
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
@@ -26509,6 +26486,11 @@ class RCAudienceLivingRoom {
26509
26486
  }
26510
26487
  // 更新本地订阅关系
26511
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);
26512
26494
  return failedList.length ? { code: RCRTCCode.SUCCESS, failedList } : { code: RCRTCCode.SUCCESS };
26513
26495
  });
26514
26496
  }
@@ -26516,17 +26498,16 @@ class RCAudienceLivingRoom {
26516
26498
  * 对比 cdn_uris 资源
26517
26499
  * @param newCDNUris 新的 cdn_uris 数据
26518
26500
  */
26519
- _diffCDNUris(newCDNUris) {
26501
+ _diffCDNUris(newCDNUris, traceId) {
26520
26502
  var _a, _b, _c, _d, _e, _f;
26521
26503
  return __awaiter(this, void 0, void 0, function* () {
26522
26504
  /**
26523
26505
  * CDN 资源减少: 上次 CDNUris 中有 url,变更后无 url
26524
26506
  */
26525
26507
  if (this._CDNUris.url && !newCDNUris.url) {
26526
- (_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({
26527
- 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({
26528
26509
  eventType: 'onCDNInfoDisable',
26529
- }));
26510
+ }), traceId);
26530
26511
  this._callAppListener('onCDNInfoDisable');
26531
26512
  /**
26532
26513
  * 更新内存中存储的 cdn_uris 数据
@@ -26540,12 +26521,11 @@ class RCAudienceLivingRoom {
26540
26521
  * 上次 CDNUris 无 url,变更后有 url
26541
26522
  */
26542
26523
  if (!this._CDNUris || (!this._CDNUris.url && newCDNUris.url)) {
26543
- (_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({
26544
- 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({
26545
26525
  eventType: 'onCDNInfoEnable',
26546
26526
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26547
26527
  fps: `FPS_${newCDNUris.fps}`,
26548
- }));
26528
+ }), traceId);
26549
26529
  this._callAppListener('onCDNInfoEnable', {
26550
26530
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26551
26531
  fps: `FPS_${newCDNUris.fps}`,
@@ -26558,12 +26538,11 @@ class RCAudienceLivingRoom {
26558
26538
  const isHChange = (this._CDNUris.h && newCDNUris.h && (this._CDNUris.h !== newCDNUris.h));
26559
26539
  const isFpsChange = (this._CDNUris.fps && newCDNUris.fps && (this._CDNUris.fps !== newCDNUris.fps));
26560
26540
  if (isWChange || isHChange || isFpsChange) {
26561
- (_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({
26562
- 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({
26563
26542
  eventType: 'onCDNInfoChange',
26564
26543
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26565
26544
  fps: `FPS_${newCDNUris.fps}`,
26566
- }));
26545
+ }), traceId);
26567
26546
  this._callAppListener('onCDNInfoChange', {
26568
26547
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26569
26548
  fps: `FPS_${newCDNUris.fps}`,
@@ -26580,14 +26559,18 @@ class RCAudienceLivingRoom {
26580
26559
  * _CDNUris 无 url 时,说明未开启 CDN 推送
26581
26560
  * @returns CDNPlayUrl
26582
26561
  */
26583
- _getCDNPlayUrl(params) {
26584
- var _a, _b, _c, _d, _e, _f;
26562
+ _getCDNPlayUrl(params, traceId) {
26563
+ var _a, _b;
26585
26564
  return __awaiter(this, void 0, void 0, function* () {
26586
26565
  const { w, h, fps } = params;
26587
26566
  const kind = this._initOptions.pullInnerCDNProtocol || RCInnerCDNPullKind.FLV;
26588
26567
  const useHttps = (this._initOptions.pullInnerCDNUseHttps === RCInnerCDNPullIsHttps.NOT_HTTPS) ? RCInnerCDNPullIsHttps.NOT_HTTPS : RCInnerCDNPullIsHttps.HTTPS;
26589
26568
  if (!this._CDNUris.url) {
26590
- (_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);
26591
26574
  return { code: RCRTCCode.CDN_RESOURCE_IS_EMPTY };
26592
26575
  }
26593
26576
  const headers = {
@@ -26616,12 +26599,10 @@ class RCAudienceLivingRoom {
26616
26599
  const paramsStr = paramsArr.join('&');
26617
26600
  let requestUrl = `${this._CDNUris.url}?`;
26618
26601
  paramsStr && (requestUrl += paramsStr);
26619
- const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl);
26602
+ const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl, traceId);
26620
26603
  if (code !== RCRTCCode.SUCCESS) {
26621
- (_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}`);
26622
26604
  return { code };
26623
26605
  }
26624
- (_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}`);
26625
26606
  return {
26626
26607
  code,
26627
26608
  CDNPlayUrl: res === null || res === void 0 ? void 0 : res.data.pull_url,
@@ -26633,28 +26614,27 @@ class RCAudienceLivingRoom {
26633
26614
  * @returns CDNPlayUrl
26634
26615
  */
26635
26616
  getCDNPlayUrl(resolution, fps) {
26636
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26617
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26637
26618
  return __awaiter(this, void 0, void 0, function* () {
26638
- (_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({
26639
26621
  resolution,
26640
26622
  fps,
26641
- }));
26623
+ }), traceId);
26642
26624
  if (resolution && !isValidResolution(resolution)) {
26643
- (_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');
26644
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({
26645
26626
  status: RCLoggerStatus.FAILED,
26646
26627
  code: RCRTCCode.PARAMS_ERROR,
26647
26628
  msg: 'params error -> resolution',
26648
- }));
26629
+ }), traceId);
26649
26630
  return { code: RCRTCCode.PARAMS_ERROR };
26650
26631
  }
26651
26632
  if (fps && !isValidFPS(fps)) {
26652
- (_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');
26653
- (_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({
26654
26634
  status: RCLoggerStatus.FAILED,
26655
26635
  code: RCRTCCode.PARAMS_ERROR,
26656
26636
  msg: 'params error -> fps',
26657
- }));
26637
+ }), traceId);
26658
26638
  return { code: RCRTCCode.PARAMS_ERROR };
26659
26639
  }
26660
26640
  const { width, height } = resolution ? transResolution(resolution) : { width: null, height: null };
@@ -26663,12 +26643,7 @@ class RCAudienceLivingRoom {
26663
26643
  width && (params.w = width);
26664
26644
  height && (params.h = height);
26665
26645
  fpsNum && (params.fps = fpsNum);
26666
- (_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({
26667
- status: RCLoggerStatus.SUCCESSED,
26668
- resolution,
26669
- fps,
26670
- }));
26671
- return this._getCDNPlayUrl(params);
26646
+ return this._getCDNPlayUrl(params, traceId);
26672
26647
  });
26673
26648
  }
26674
26649
  /**
@@ -26691,33 +26666,34 @@ class RCAudienceLivingRoom {
26691
26666
  __unsubscribe(tracks) {
26692
26667
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26693
26668
  return __awaiter(this, void 0, void 0, function* () {
26694
- (_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({
26695
26671
  trackIds: tracks.map((track) => track.getTrackId()),
26696
- roomId: this._roomId,
26697
- userId: this._crtUserId,
26698
- }));
26699
- if (!validate('tracks', tracks, () => isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26700
- (_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) {
26701
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({
26702
26684
  status: RCLoggerStatus.FAILED,
26703
26685
  code: RCRTCCode.PARAMS_ERROR,
26704
26686
  msg: 'params error -> tracks',
26705
- }));
26687
+ }), traceId);
26706
26688
  return { code: RCRTCCode.PARAMS_ERROR };
26707
26689
  }
26708
26690
  // 计算剩余订阅列表
26709
26691
  const crtSubList = this._subscribedList.map((item) => (Object.assign({}, item)))
26710
26692
  .filter((item) => !tracks.includes(item.track));
26711
26693
  // 北极星上报
26712
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26713
- (_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({
26714
- status: RCLoggerStatus.SUCCESSED,
26715
- trackIds: tracks.map((track) => track.getTrackId()),
26716
- roomId: this._roomId,
26717
- userId: this._crtUserId,
26718
- }));
26694
+ (_j = this._polarisReport) === null || _j === void 0 ? void 0 : _j.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26719
26695
  recordUnsubscribeCommand(true);
26720
- return this._updateSubListHandle(crtSubList, false);
26696
+ return this._updateSubListHandle(crtSubList, false, traceId);
26721
26697
  });
26722
26698
  }
26723
26699
  /**
@@ -26788,15 +26764,18 @@ class RCAudienceLivingRoom {
26788
26764
  * 断线重连后处理逻辑, SDK 内部处理调用
26789
26765
  */
26790
26766
  __onReconnected() {
26791
- var _a, _b;
26767
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26792
26768
  return __awaiter(this, void 0, void 0, function* () {
26793
26769
  /**
26794
26770
  * 重新加入房间后,从头拉取全量资源
26795
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);
26796
26774
  const { code } = yield this._context.joinLivingRoomAsAudience(this._roomId, RTCMode.LIVE);
26797
26775
  if (code !== ErrorCode.SUCCESS) {
26798
- (_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);
26799
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);
26800
26779
  });
26801
26780
  }
26802
26781
  /**
@@ -26816,8 +26795,7 @@ class RCAudienceLivingRoom {
26816
26795
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
26817
26796
  this._audioLevelReport = new RCAudioLevelReport(this);
26818
26797
  this._audioLevelReport.onAudioLevelChange(handler, gap || 1000);
26819
- (_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({
26820
- 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({
26821
26799
  handler: handler === null || handler === void 0 ? void 0 : handler.name,
26822
26800
  gap,
26823
26801
  }));
@@ -28096,7 +28074,7 @@ class RCRTCClient extends RCMediaStreamCapture {
28096
28074
  }
28097
28075
  reportSDKInfo() {
28098
28076
  this._context.reportSDKInfo({
28099
- 'plugin-rtc': "5.6.3-alpha.3",
28077
+ 'plugin-rtc': "5.6.3-alpha.5",
28100
28078
  });
28101
28079
  }
28102
28080
  }
@@ -28718,15 +28696,19 @@ class RTCContext {
28718
28696
  * @param valueInfo 全量资源数据
28719
28697
  * @param objectName 全量 URI 消息名
28720
28698
  */
28721
- setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28699
+ setRTCTotalRes(roomId, messageList, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28722
28700
  return __awaiter(this, void 0, void 0, function* () {
28723
28701
  const params = {
28724
28702
  objectName,
28725
- content: this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true),
28703
+ content: [],
28726
28704
  valueInfo: [
28727
28705
  this.codec.encode(RTCPB.RtcValueInfo, { key: 'uris', value: valueInfo }, true),
28728
28706
  ],
28729
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
+ });
28730
28712
  mcuValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true));
28731
28713
  cdnValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'cdn_uris', value: cdnValInfo }, true));
28732
28714
  const sourceData = this.codec.encode(RTCPB.RtcUserSetDataInput, params);
@@ -29085,7 +29067,7 @@ const installer = {
29085
29067
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
29086
29068
  return false;
29087
29069
  }
29088
- VersionManage.add('plugin-rtc', "5.6.3-alpha.3");
29070
+ VersionManage.add('plugin-rtc', "5.6.3-alpha.5");
29089
29071
  if (!VersionManage.validEngine("^5.6.0")) {
29090
29072
  console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
29091
29073
  return false;
@@ -29099,8 +29081,8 @@ const installer = {
29099
29081
  RTCLogger.setLogger(originLogger);
29100
29082
  logger.setLogger(originLogger);
29101
29083
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
29102
- 'RCRTC Version': "5.6.3-alpha.3",
29103
- Commit: "db726c933e72872baf32689bc9690c7a34f2bab2",
29084
+ 'RCRTC Version': "5.6.3-alpha.5",
29085
+ Commit: "48fe4c6914037db2dfd263f31aba741834041487",
29104
29086
  'browserInfo.browser': browserInfo.browser,
29105
29087
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
29106
29088
  'browserInfo.version': browserInfo.version,