@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.umd.js CHANGED
@@ -1,7 +1,7 @@
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
  (function (global, factory) {
@@ -10,7 +10,7 @@
10
10
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RCRTC = {}, global.RCEngine));
11
11
  })(this, (function (exports, engine) { 'use strict';
12
12
 
13
- /*! *****************************************************************************
13
+ /******************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
15
15
 
16
16
  Permission to use, copy, modify, and/or distribute this software for any
@@ -250,10 +250,14 @@
250
250
  */
251
251
  RCLoggerTag["L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R"] = "L-rtc_client_downgrade_to_audience_room-R";
252
252
  /**
253
- * 加入房间的动作、结果
253
+ * 业务层获取房间信息的动作、结果
254
254
  */
255
255
  RCLoggerTag["L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T"] = "L-rtc_client_get_joined_room_info-T";
256
256
  RCLoggerTag["L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R"] = "L-rtc_client_get_joined_room_info-R";
257
+ /**
258
+ * 观众不加房间触发应用层 onTrackReady 事件
259
+ */
260
+ RCLoggerTag["L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O"] = "L-audinence_client_call_onTrackReady-O";
257
261
  /**
258
262
  * 观众订阅资源任务
259
263
  */
@@ -375,11 +379,11 @@
375
379
  */
376
380
  RCLoggerTag["L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O"] = "L-abstract_room_register_room_event_listener-O";
377
381
  /**
378
- * 房间注册上报事件
382
+ * 房间注册质量数据上报事件
379
383
  */
380
384
  RCLoggerTag["L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O"] = "L-abstract_room_register_report_listener-O";
381
385
  /**
382
- * 房间音频等级变更
386
+ * 注册音量变更事件
383
387
  */
384
388
  RCLoggerTag["L_ABSTRACT_ROOM_AUDIO_LEVEL_O"] = "L-abstract_room_audio_level-O";
385
389
  /**
@@ -427,13 +431,18 @@
427
431
  */
428
432
  RCLoggerTag["L_LIVING_ROOM_ENABLE_INNER_CDN_R"] = "L-living_room_enable_inner_cdn-R";
429
433
  /**
430
- * livingroom扩散cdn内容的任务
434
+ * livingroom 扩散 cdn 内容的任务
431
435
  */
432
436
  RCLoggerTag["L_LIVING_ROOM_SPREAD_CDN_INFO_T"] = "L-living_room_spread_cdn_info-T";
433
437
  /**
434
- * livingroom扩散cdn内容的结果
438
+ * livingroom 扩散 cdn 内容的结果
435
439
  */
436
440
  RCLoggerTag["L_LIVING_ROOM_SPREAD_CDN_INFO_R"] = "L-living_room_spread_cdn_info-R";
441
+ /**
442
+ * livingroom 设置房间 cdn 信息任务和结果
443
+ */
444
+ RCLoggerTag["L_LIVING_ROOM_SET_ROOM_CDN_INFO_T"] = "L-living_room_set_room_cdn_info-T";
445
+ RCLoggerTag["L_LIVING_ROOM_SET_ROOM_CDN_INFO_R"] = "L-living_room_set_room_cdn_info-R";
437
446
  /**
438
447
  * livingroom加入pk房间的任务
439
448
  */
@@ -451,17 +460,33 @@
451
460
  */
452
461
  RCLoggerTag["L_LIVING_ROOM_LEAVE_PK_ROOM_R"] = "L-living_room_leave_pk_room-R";
453
462
  /**
454
- * livingroom获取pk房间handler
463
+ * 主动离开 pk 房间
464
+ */
465
+ RCLoggerTag["L_APP_CALL_LEAVE_PK_ROOM_O"] = "L-app_call_leave_pk_room-O";
466
+ /**
467
+ * 结束连麦触发离开 pk 房间
468
+ */
469
+ RCLoggerTag["L_QUIT_PK_LEAVE_PK_ROOM_O"] = "L-quit_pk_leave_pk_room-O";
470
+ /**
471
+ * livingroom 获取 pk 房间 handler
455
472
  */
456
473
  RCLoggerTag["L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O"] = "L-living_room_get_room_pk_handler-O";
474
+ /**
475
+ * livingroom 获取 getMCUConfigBuilder
476
+ */
477
+ RCLoggerTag["L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O"] = "L-living_room_get_mcu_config_builder-O";
457
478
  /**
458
479
  * livingroom离开全部pk房间
459
480
  */
460
481
  RCLoggerTag["L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O"] = "L-living_room_quit_all_pk_room-O";
461
482
  /**
462
- * livingpkhandler注册pk房间监听事件
483
+ * livingpkhandler 注册pk房间监听事件
463
484
  */
464
485
  RCLoggerTag["L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O"] = "L-living_pk_handler_register_room_pk_event_listener-O";
486
+ /**
487
+ * livingpkhandler 注册事件执行
488
+ */
489
+ RCLoggerTag["L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O"] = "L-living_pk_handler_call_app_listener-O";
465
490
  /**
466
491
  * livingpkhandler发起跨房间连麦请求的任务
467
492
  */
@@ -503,13 +528,29 @@
503
528
  */
504
529
  RCLoggerTag["L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R"] = "L-living_pk_handler_leave_other_room-R";
505
530
  /**
506
- * AudienceLivingRoom信令数据变化的任务
531
+ * 结束连麦的执行和结果
532
+ */
533
+ RCLoggerTag["L_QUIT_PK_T"] = "L-quit_pk-T";
534
+ RCLoggerTag["L_QUIT_PK_R"] = "L-quit_pk-R";
535
+ /**
536
+ * ExchangeWithPushOtherRoomCommand 执行和结果
537
+ */
538
+ RCLoggerTag["L_EXCHANGE_WITH_PUSHOTHERROOM_T"] = "L-exchange_with_pushotherroom-T";
539
+ RCLoggerTag["L_EXCHANGE_WITH_PUSHOTHERROOM_R"] = "L-exchange_with_pushotherroom-R";
540
+ /**
541
+ * AudienceLivingRoom 触发业务层事件
507
542
  */
508
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_T"] = "L-audience_living_room_singal_data_change-T";
543
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O"] = "L-audience_living_room_call_app_listener-O";
509
544
  /**
510
- * AudienceLivingRoom信令数据变化的结果
545
+ * AudienceLivingRoom 拉 kvEntries
511
546
  */
512
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_R"] = "L-audience_living_room_singal_data_change-R";
547
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O"] = "L-audience_living_room_pull_kvEntries-O";
548
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T"] = "L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T";
549
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R"] = "L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R";
550
+ /**
551
+ * AudienceLivingRoom信令数据变化的结果处理过程
552
+ */
553
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P"] = "L-audience_living_room_singal_data_change-P";
513
554
  /**
514
555
  * AudienceLivingRoom获取cdn播放地址的任务
515
556
  */
@@ -527,17 +568,27 @@
527
568
  */
528
569
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R"] = "L-audience_living_room_subscribe-R";
529
570
  /**
530
- * AudienceLivingRoom取消订阅资源的任务
571
+ * AudienceLivingRoom 取消订阅资源的任务
531
572
  */
532
573
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T"] = "L-audience_living_room_unsubscribe-T";
533
574
  /**
534
- * AudienceLivingRoom取消订阅资源的结果
575
+ * AudienceLivingRoom 取消订阅资源的结果
535
576
  */
536
577
  RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R"] = "L-audience_living_room_unsubscribe-R";
537
578
  /**
538
- * AudienceLivingRoom声音改变
579
+ * AudienceLivingRoom updateSubscribeList 执行和结果
580
+ */
581
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T"] = "L-audience_living_room_update_subscribeList-T";
582
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R"] = "L-audience_living_room_update_subscribeList-R";
583
+ /**
584
+ * AudienceLivingRoom 内部 onTrackReady 触发
539
585
  */
540
- RCLoggerTag["L_AUDIENCE_LIVING_ROOM_AUDIO_LEVEL_CHANGE_O"] = "L-audience_living_room_audio_level_change-O";
586
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O"] = "L-audience_living_room_onTrackReady-O";
587
+ /**
588
+ * AudienceLivingRoom 内部 im 重连
589
+ */
590
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R"] = "L-audience_living_room_im_reconnected-R";
591
+ RCLoggerTag["L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T"] = "L-audience_living_room_im_reconnected-T";
541
592
  /**
542
593
  * MCUConfigBuilder设置音频轨道
543
594
  */
@@ -642,10 +693,6 @@
642
693
  * MCUConfigBuilder重置
643
694
  */
644
695
  RCLoggerTag["L_MCU_CONFIG_BUILDER_RESET_O"] = "L-mcu_config_builder_reset-O";
645
- /**
646
- * MCUConfigBuilder刷新
647
- */
648
- // L_MCU_CONFIG_BUILDER_FLUSH_O = 'L-mcu_config_builder_flush-O',
649
696
  /**
650
697
  * MCUConfigBuilder设置单到流水印
651
698
  */
@@ -674,6 +721,14 @@
674
721
  * MediaService获取CDN资源内容的结果
675
722
  */
676
723
  RCLoggerTag["L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R"] = "L-media_service_get_cnd_resource_info-R";
724
+ /**
725
+ * MediaService 使用的 msList 重新获取、排序
726
+ */
727
+ RCLoggerTag["L_MEDIA_SERVICE_MSLIST_CHANGE_O"] = "L-media_service_msList_change-O";
728
+ /**
729
+ * MediaService 解析 navi callVoip info 数据
730
+ */
731
+ RCLoggerTag["L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O"] = "L-media_service_parse_navi_callvoip_info-O";
677
732
  /**
678
733
  * MediaService发起请求的任务
679
734
  */
@@ -682,10 +737,6 @@
682
737
  * MediaService发起请求的结果
683
738
  */
684
739
  RCLoggerTag["L_MEDIA_SERVICE_REQUEST_R"] = "L-media_service_request-R";
685
- /**
686
- * LocalTrack设置推流详情
687
- */
688
- RCLoggerTag["L_LOCAL_TRACK_INNER_SET_PUBLISHED_O"] = "L-loacl_track_inner_set_published-O";
689
740
  /**
690
741
  * LocalTrack销毁
691
742
  */
@@ -699,9 +750,10 @@
699
750
  */
700
751
  RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_O"] = "L-loacl_track_set_local_muted-O";
701
752
  /**
702
- * LocalTrack 设置禁用/启用动作扩散结果
753
+ * LocalTrack 设置禁用/启用动作扩散动作、结果
703
754
  */
704
- RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_R"] = "L-loacl_track_set_local_muted-R";
755
+ RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T"] = "L-loacl_track_set_local_muted_spread-T";
756
+ RCLoggerTag["L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R"] = "L-loacl_track_set_local_muted_spread-R";
705
757
  /**
706
758
  * Track播放的动作
707
759
  */
@@ -738,14 +790,6 @@
738
790
  * Track可以播放
739
791
  */
740
792
  RCLoggerTag["L_TRACK_CANPLAY_O"] = "L-track_canplay-O";
741
- /**
742
- * Track静音
743
- */
744
- RCLoggerTag["L_TRACK_MUTE_O"] = "L-track_mute-O";
745
- /**
746
- * Track取消静音
747
- */
748
- RCLoggerTag["L_TRACK_UNMUTE_O"] = "L-track_unmute-O";
749
793
  /**
750
794
  * AbstractStatParser格式化状态
751
795
  */
@@ -758,18 +802,10 @@
758
802
  * ASdpStrategy设置远端回答
759
803
  */
760
804
  RCLoggerTag["L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O"] = "L-a_sdp_strategy_set_remote_answer-O";
761
- /**
762
- * RTCPeerConnection获取状态数据
763
- */
764
- RCLoggerTag["L_RTC_PEER_CONNECTION_GET_STATS_DATA_O"] = "L-rtc_peer_connection_get_stats_data-O";
765
805
  /**
766
806
  * RTCPeerConnection设置本地轨道
767
807
  */
768
808
  RCLoggerTag["L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O"] = "L-rtc_peer_connection_add_local_track-O";
769
- /**
770
- * RTCPeerConnection获取本地轨道
771
- */
772
- RCLoggerTag["L_RTC_PEER_CONNECTION_GET_LOCAL_TRACKS_O"] = "L-rtc_peer_connection_get_local_tracks-O";
773
809
  /**
774
810
  * RTCPeerConnection ICE 连接状态改变
775
811
  */
@@ -802,14 +838,6 @@
802
838
  * RTCPeerConnection删除本地轨道
803
839
  */
804
840
  RCLoggerTag["L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O"] = "L-rtc_peer_connection_remove_local_track-O";
805
- /**
806
- * RTCPeerConnection更新远端轨道
807
- */
808
- RCLoggerTag["L_RTC_PEER_CONNECTION_UPDATE_SUB_REMOTE_TRACKS_O"] = "L-rtc_peer_connection_update_sub_remote_tracks-O";
809
- /**
810
- * RTCPeerConnection设置本地声音
811
- */
812
- RCLoggerTag["L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O"] = "L-rtc_peer_connection_local_track_muted-O";
813
841
  /**
814
842
  * RTCPeerConnection销毁
815
843
  */
@@ -818,10 +846,6 @@
818
846
  * 设置码率出错,设置的码率值未在推荐列表
819
847
  */
820
848
  RCLoggerTag["L_RTC_SET_RECOMMEND_BITRATE_O"] = "L_rtc_set_recommend_bitrate_O";
821
- /**
822
- * 设置 SDP 上的码率
823
- */
824
- RCLoggerTag["L_RTC_SDP_BITRATE_O"] = "L_rtc_sdp_bitrate_O";
825
849
  /**
826
850
  * 3A 降噪
827
851
  */
@@ -940,10 +964,12 @@
940
964
  RCLoggerTag["L_UNPUBLISH_PREV_COMMAND_T"] = "L-unpublish_prev_command-T";
941
965
  RCLoggerTag["L_UNPUBLISH_PREV_COMMAND_R"] = "L-unpublish_prev_command-R";
942
966
  /**
943
- * RetryExchangeCommand 任务和结果
967
+ * RetryExchangeCommand 任务
968
+ * RetryExchange 之后执行扩散动作和结果
944
969
  */
945
970
  RCLoggerTag["L_RETRY_EXCHANGE_COMMAND_T"] = "L-retry_exchange_command-T";
946
- RCLoggerTag["L_RETRY_EXCHANGE_COMMAND_R"] = "L-retry_exchange_command-R";
971
+ RCLoggerTag["L_RETRY_EXCHANGE_SPREAD_T"] = "L-retry_exchange_spread-T";
972
+ RCLoggerTag["L_RETRY_EXCHANGE_SPREAD_R"] = "L-retry_exchange_spread-R";
947
973
  /**
948
974
  * ParseUserStateCommand 的结果
949
975
  */
@@ -961,6 +987,10 @@
961
987
  */
962
988
  RCLoggerTag["L_SET_AUDIO_CONSTRAINTS_O"] = "L-set_audio_constraints-O";
963
989
  /**
990
+ * 方法不可用
991
+ */
992
+ RCLoggerTag["L_FUNCTION_IS_UNAVAILABLE"] = "L-function_is_unavailable";
993
+ /*
964
994
  * 取消订阅本地清除的订阅关系列表
965
995
  */
966
996
  RCLoggerTag["L_CLEAR_UNSUBSCRIBE_LIST_O"] = "L-clear_unsubscribe_list-O";
@@ -976,6 +1006,10 @@
976
1006
  * 队列任务执行结束
977
1007
  */
978
1008
  RCLoggerTag["L_INVOKER_EXECUTE_R"] = "L-invoker_execute-R";
1009
+ /**
1010
+ * 销毁队列事件
1011
+ */
1012
+ RCLoggerTag["L_INVOKER_DESTROY_O"] = "L-invoker_destroy-R";
979
1013
  })(RCLoggerTag || (RCLoggerTag = {}));
980
1014
  var RCLoggerStatus;
981
1015
  (function (RCLoggerStatus) {
@@ -7179,7 +7213,6 @@
7179
7213
  */
7180
7214
  changed && this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, this, resolve);
7181
7215
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_O, JSON.stringify({
7182
- status: RCLoggerStatus.SUCCESSED,
7183
7216
  enable: bool,
7184
7217
  trackId: this._id,
7185
7218
  }));
@@ -14771,7 +14804,7 @@
14771
14804
  'Content-Type': 'application/json;charset=UTF-8',
14772
14805
  'Cache-Control': 'no-cache',
14773
14806
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14774
- ClientVersion: "5.6.3-alpha.3",
14807
+ ClientVersion: "5.6.3-alpha.5",
14775
14808
  'Client-Session-Id': getUUID(),
14776
14809
  'Request-Id': Date.now().toString(),
14777
14810
  });
@@ -14796,8 +14829,6 @@
14796
14829
  timeout: PING_REQ_TIMEOUT,
14797
14830
  method: engine.HttpMethod.POST,
14798
14831
  });
14799
- const logger = RTCLogger.getLogger();
14800
- logger === null || logger === void 0 ? void 0 : logger.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `ping res => ${JSON.stringify({ status: res.status, host })}`);
14801
14832
  if (res.status === 200) {
14802
14833
  pingRes.push(host.clusterId);
14803
14834
  }
@@ -14822,7 +14853,7 @@
14822
14853
  }
14823
14854
  catch (error) {
14824
14855
  const logger = RTCLogger.getLogger();
14825
- logger === null || logger === void 0 ? void 0 : logger.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, `parse \`voipCallInfo\` of navi failed: ${info.voipCallInfo}`);
14856
+ 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}`);
14826
14857
  return '';
14827
14858
  }
14828
14859
  if (voipInfo.strategy === 0) {
@@ -15349,7 +15380,7 @@
15349
15380
  'Content-Type': 'application/json;charset=UTF-8',
15350
15381
  'Cache-Control': 'no-cache',
15351
15382
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
15352
- ClientVersion: "5.6.3-alpha.3",
15383
+ ClientVersion: "5.6.3-alpha.5",
15353
15384
  'Client-Session-Id': getUUID(),
15354
15385
  'Request-Id': Date.now().toString(),
15355
15386
  });
@@ -15394,7 +15425,6 @@
15394
15425
  }
15395
15426
  }
15396
15427
  detectorMediaSever() {
15397
- var _a, _b;
15398
15428
  const naviInfo = this._context.getNaviInfo();
15399
15429
  RCMediaService.jwtToken = (naviInfo === null || naviInfo === void 0 ? void 0 : naviInfo.jwt) || '';
15400
15430
  // 如果有传入自定义 MediaServer 地址不走探测逻辑
@@ -15404,7 +15434,6 @@
15404
15434
  const nowDate = Date.now();
15405
15435
  const isValid = (RCMediaService.detectValidMinute + RCMediaService.detectorTime > nowDate);
15406
15436
  RCMediaService.isDetector = isValid;
15407
- (_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)}`);
15408
15437
  if (!isValid && naviInfo && engine.notEmptyObject(naviInfo)) {
15409
15438
  this._msList = [];
15410
15439
  this._getDetectorUrls(naviInfo);
@@ -15416,7 +15445,6 @@
15416
15445
  * 拿不到等 IM 链接成功后,再回调中调用开始嗅探
15417
15446
  */
15418
15447
  _getDetectorUrls(naviInfo) {
15419
- var _a, _b, _c, _d;
15420
15448
  return __awaiter(this, void 0, void 0, function* () {
15421
15449
  if (RCMediaService.isDetector) {
15422
15450
  return;
@@ -15431,8 +15459,6 @@
15431
15459
  RCMediaService.msInDetector = fastMediaUrl || [];
15432
15460
  RCMediaService.detectorTime = Date.now();
15433
15461
  RCMediaService.detectValidMinute = clientDetectMinute * 60 * 1000;
15434
- (_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}`);
15435
- (_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}`);
15436
15462
  });
15437
15463
  }
15438
15464
  getNaviMS() {
@@ -15450,20 +15476,18 @@
15450
15476
  * ping1 :ping 结果返回最快值
15451
15477
  */
15452
15478
  setMediaServiceList() {
15453
- var _a, _b, _c, _d, _e, _f, _g, _h;
15479
+ var _a, _b;
15454
15480
  let backupMsInDetector = [];
15455
15481
  let backupMsInNavi = [];
15456
15482
  if (this._clusterId) {
15457
15483
  this._clusterId = this._clusterId.replace(/^(https?:\/\/)?/, 'https://');
15458
15484
  this._msList.push(this._clusterId);
15459
15485
  }
15460
- (_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}`);
15461
15486
  if (engine.notEmptyArray(RCMediaService.msInDetector)) {
15462
15487
  RCMediaService.msInDetector = RCMediaService.msInDetector.map((item) => item.replace(/^(https?:\/\/)?/, 'https://'));
15463
15488
  this._msList.push(RCMediaService.msInDetector[0]);
15464
15489
  backupMsInDetector = RCMediaService.msInDetector.concat().splice(1, RCMediaService.msInDetector.length - 1);
15465
15490
  }
15466
- (_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)}`);
15467
15491
  if (this._msInNavi.length === 0) {
15468
15492
  if (this._failedMs.length === 0) {
15469
15493
  this._msInNavi.push(...parseNaviInfo(this._context.getNaviInfo()));
@@ -15473,12 +15497,11 @@
15473
15497
  this._failedMs.length = 0;
15474
15498
  }
15475
15499
  }
15476
- (_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)}`);
15477
15500
  backupMsInNavi = this._msInNavi.concat().splice(1, this._msInNavi.length - 1);
15478
15501
  this._msList.push(this._msInNavi[0]);
15479
15502
  this._msList = [...this._msList, ...backupMsInDetector, ...backupMsInNavi];
15480
15503
  this._msList = [...new Set(this._msList)];
15481
- (_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)}`);
15504
+ (_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)}`);
15482
15505
  return this._msList;
15483
15506
  }
15484
15507
  /**
@@ -15557,7 +15580,6 @@
15557
15580
  (_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({
15558
15581
  status: RCLoggerStatus.SUCCESSED,
15559
15582
  url,
15560
- reqId,
15561
15583
  }), traceId);
15562
15584
  return { code: exports.RCRTCCode.SUCCESS, data: resp };
15563
15585
  }
@@ -15664,13 +15686,13 @@
15664
15686
  /**
15665
15687
  * 房间内观众获取 CDN 资源信息、拉流地址
15666
15688
  */
15667
- getCDNResourceInfo(headers, url) {
15689
+ getCDNResourceInfo(headers, url, traceId) {
15668
15690
  var _a, _b, _c, _d, _e, _f;
15669
15691
  return __awaiter(this, void 0, void 0, function* () {
15670
15692
  const commonHeader = getCommonHeader();
15671
15693
  const mergeHeaders = Object.assign(Object.assign({}, commonHeader), headers);
15672
15694
  const reqId = commonHeader['Request-Id'];
15673
- (_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)}`);
15695
+ (_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);
15674
15696
  const { status, data: resStr } = yield this._runtime.httpReq({
15675
15697
  url,
15676
15698
  headers: mergeHeaders,
@@ -15680,15 +15702,14 @@
15680
15702
  const data = JSON.parse(resStr);
15681
15703
  (_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({
15682
15704
  status: RCLoggerStatus.SUCCESSED,
15683
- reqId: commonHeader['Request-Id'],
15684
- }));
15705
+ cdnPlayerUrl: data === null || data === void 0 ? void 0 : data.data.pull_url,
15706
+ }), traceId);
15685
15707
  return { code: data.resultCode, res: data };
15686
15708
  }
15687
15709
  (_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({
15688
15710
  status: RCLoggerStatus.FAILED,
15689
15711
  code: exports.RCRTCCode.REQUEST_FAILED,
15690
- msg: `request error -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}, url: ${url}`,
15691
- }));
15712
+ }), traceId);
15692
15713
  return { code: exports.RCRTCCode.REQUEST_FAILED };
15693
15714
  });
15694
15715
  }
@@ -16879,11 +16900,6 @@
16879
16900
  * @param {IRCTrackBitrate} bitrate - 以 kbps 为单位的比特率。
16880
16901
  */
16881
16902
  setAudiosBitrate(bitrate) {
16882
- var _a;
16883
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16884
- bitrate,
16885
- msg: 'SDP setAudiosBitrate',
16886
- }));
16887
16903
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => this.setAudioItemBitrate(sdpAudioBlock, bitrate));
16888
16904
  return this;
16889
16905
  }
@@ -16893,12 +16909,6 @@
16893
16909
  * @param {string} streamId - 音频流的媒体流 ID。
16894
16910
  */
16895
16911
  setAudioBitrateWithStreamId(bitrate, streamId) {
16896
- var _a;
16897
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16898
- bitrate,
16899
- streamId,
16900
- msg: 'SDP setAudioBitrateWithStreamId',
16901
- }));
16902
16912
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16903
16913
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16904
16914
  // 判断 msid 是否存在
@@ -16915,12 +16925,6 @@
16915
16925
  * @param {string} mid - 音频流的媒体流 ID。
16916
16926
  */
16917
16927
  setAudioBitrateWithMid(bitrate, mid) {
16918
- var _a;
16919
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16920
- bitrate,
16921
- mid,
16922
- msg: 'SDP setAudioBitrateWithMid',
16923
- }));
16924
16928
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16925
16929
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
16926
16930
  // 判断 msid 是否存在
@@ -16969,11 +16973,6 @@
16969
16973
  * @param bitrate
16970
16974
  */
16971
16975
  setVideosBitrate(bitrate) {
16972
- var _a;
16973
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16974
- bitrate,
16975
- msg: 'SDP setVideosBitrate',
16976
- }));
16977
16976
  // 找到 profile-level-id 行在后面添加 ;x-google--bitrate ;x-google--bitrate=
16978
16977
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => this.setVideoItemBitrate(sdpVideoBlock, bitrate));
16979
16978
  return this;
@@ -16984,12 +16983,6 @@
16984
16983
  * @param {string} streamId - 媒体流 ID。
16985
16984
  */
16986
16985
  setVideoBitrateWithStreamId(bitrate, streamId) {
16987
- var _a;
16988
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16989
- bitrate,
16990
- streamId,
16991
- msg: 'SDP setVideoBitrateWithStreamId',
16992
- }));
16993
16986
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
16994
16987
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16995
16988
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17005,12 +16998,6 @@
17005
16998
  * @param {string} streamId - 媒体流 ID。
17006
16999
  */
17007
17000
  setVideoBitrateWithMid(bitrate, mid) {
17008
- var _a;
17009
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
17010
- bitrate,
17011
- mid,
17012
- msg: 'SDP setVideoBitrateWithMid',
17013
- }));
17014
17001
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
17015
17002
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
17016
17003
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17257,7 +17244,7 @@
17257
17244
  */
17258
17245
  setAudioBitrateWithStreamId(bitrate, streamId) {
17259
17246
  var _a;
17260
- (_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');
17247
+ (_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');
17261
17248
  return this;
17262
17249
  }
17263
17250
  /**
@@ -17265,7 +17252,7 @@
17265
17252
  */
17266
17253
  setVideoBitrateWithStreamId(bitrate, streamId) {
17267
17254
  var _a;
17268
- (_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');
17255
+ (_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');
17269
17256
  return this;
17270
17257
  }
17271
17258
  }
@@ -17604,7 +17591,7 @@
17604
17591
  }
17605
17592
  setBitrate(max, min, start) {
17606
17593
  var _a;
17607
- (_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`');
17594
+ (_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`');
17608
17595
  }
17609
17596
  /**
17610
17597
  * 该函数用于向对等连接添加本地轨道
@@ -18169,16 +18156,12 @@
18169
18156
  return this._sdpStrategy.getOutboundVideoInfo();
18170
18157
  }
18171
18158
  _onLocalTrackMuted(track, resolve) {
18172
- var _a;
18173
18159
  // 修改已发布的小流状态
18174
18160
  const tinyTrack = this.getLocalTrack(`${track.getTrackId()}_tiny`);
18175
18161
  if (tinyTrack) {
18176
18162
  tinyTrack.__innerGetMediaStreamTrack().enabled = !track.isLocalMuted();
18177
18163
  }
18178
18164
  this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, track, resolve);
18179
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O, JSON.stringify({
18180
- trackId: track.getTrackId(),
18181
- }));
18182
18165
  }
18183
18166
  _onLocalTrackDestroied(track) {
18184
18167
  this.emit(RCLocalTrack.__INNER_EVENT_DESTROY__, track);
@@ -18357,7 +18340,7 @@
18357
18340
  * 优化 300 人大会议室 https://rc-jira.rongcloud.net/browse/BEEM-289
18358
18341
  * Mac 端卡顿严重, RTCLib 房间超出 32 路流时,不再做北极星质量数据上报,仅取音量数据,以保持 Beem 声音激励功能可用
18359
18342
  */
18360
- 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) {
18343
+ 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) {
18361
18344
  return true;
18362
18345
  }
18363
18346
  if (formatData.senders.length || formatData.receivers.length) {
@@ -18705,7 +18688,7 @@
18705
18688
  * 加入房间
18706
18689
  */
18707
18690
  sendR1() {
18708
- const rtcVersion = "5.6.3-alpha.3";
18691
+ const rtcVersion = "5.6.3-alpha.5";
18709
18692
  const imVersion = this._context.getCoreVersion();
18710
18693
  const platform = 'web';
18711
18694
  const pcName = navigator.platform;
@@ -18855,7 +18838,7 @@
18855
18838
  _formatR1Data() {
18856
18839
  return {
18857
18840
  joinTime: this._context.userJoinTime || 0,
18858
- rtcVersion: "5.6.3-alpha.3",
18841
+ rtcVersion: "5.6.3-alpha.5",
18859
18842
  imVersion: this._context.getCoreVersion(),
18860
18843
  platform: 'web',
18861
18844
  device: navigator.platform,
@@ -19124,7 +19107,11 @@
19124
19107
  /**
19125
19108
  * context
19126
19109
  */
19127
- _initOptions) {
19110
+ _initOptions,
19111
+ /**
19112
+ * 是否是观众
19113
+ */
19114
+ _isAudience) {
19128
19115
  this._useMutilPeerC = _useMutilPeerC;
19129
19116
  this._roomId = _roomId;
19130
19117
  this._reTryExchange = _reTryExchange;
@@ -19132,6 +19119,7 @@
19132
19119
  this._polarisReport = _polarisReport;
19133
19120
  this._isRoomAudience = _isRoomAudience;
19134
19121
  this._initOptions = _initOptions;
19122
+ this._isAudience = _isAudience;
19135
19123
  // private _reportListener: {[key: string]: IRCRTCReportListener | null} = {}
19136
19124
  /**
19137
19125
  * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
@@ -19145,6 +19133,12 @@
19145
19133
  * 根据 track 判断是否为上行
19146
19134
  */
19147
19135
  _isPub(tracks) {
19136
+ if (this._isAudience) {
19137
+ return false;
19138
+ }
19139
+ if (!this._useMutilPeerC) {
19140
+ return true;
19141
+ }
19148
19142
  // 取消订阅时,剩余订阅资源为空,tracks 会为 []
19149
19143
  if (!tracks.length) {
19150
19144
  return false;
@@ -19218,15 +19212,12 @@
19218
19212
  const peerCArr = [];
19219
19213
  // isPublish 判断tracks中的资源是否为本地发布资源 从而区分是订阅与发布
19220
19214
  const isPub = this._isPub(tracks);
19221
- // 不使用多 peerConnection
19222
- if (!this._useMutilPeerC) {
19223
- const pcName = this._genPCName(true);
19224
- peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19225
- return peerCArr;
19226
- }
19227
- // 多 peerConnction 订阅
19228
- if (this._useMutilPeerC && !isPub) {
19229
- const pcName = this._genPCName(false);
19215
+ /**
19216
+ * 不使用多 peerConnection 或
19217
+ * peerConnction 订阅
19218
+ */
19219
+ if (!this._useMutilPeerC || (this._useMutilPeerC && !isPub)) {
19220
+ const pcName = this._genPCName(isPub);
19230
19221
  peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19231
19222
  return peerCArr;
19232
19223
  }
@@ -19832,6 +19823,9 @@
19832
19823
  if (!hashSubscribTask) {
19833
19824
  return { command, resolve, reject };
19834
19825
  }
19826
+ /**
19827
+ * 倒数第二个任务的 state 改为 middle,最后一个任务的 state 设为 tail
19828
+ */
19835
19829
  const [task] = this._queue.splice(index, 1);
19836
19830
  if (task.command instanceof AsyncCommand) {
19837
19831
  task.command.setState(RCLinkedListPoint.MIDDLE);
@@ -19861,9 +19855,17 @@
19861
19855
  };
19862
19856
  }
19863
19857
  isDestroyed() {
19858
+ var _a;
19859
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_DESTROY_O, JSON.stringify({
19860
+ isDestroyed: this._isDestroyed,
19861
+ }));
19864
19862
  return this._isDestroyed;
19865
19863
  }
19866
19864
  destroy() {
19865
+ var _a;
19866
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_DESTROY_O, JSON.stringify({
19867
+ isDestroyed: this._isDestroyed,
19868
+ }));
19867
19869
  if (this._isDestroyed) {
19868
19870
  return;
19869
19871
  }
@@ -19915,7 +19917,7 @@
19915
19917
  resource: tmpRes,
19916
19918
  }), traceId);
19917
19919
  // 添加请求队列并等待结果
19918
- const code = yield store.context.setRTCTotalRes(store.roomId, buildPlusMessage(RCRTCMessageType.UNPUBLISH, tmpRes), buildTotalURIMessageContent([]), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent([]));
19920
+ const code = yield store.context.setRTCTotalRes(store.roomId, [buildPlusMessage(RCRTCMessageType.UNPUBLISH, tmpRes)], buildTotalURIMessageContent([]), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent([]));
19919
19921
  if (code !== engine.ErrorCode.SUCCESS) {
19920
19922
  (_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({
19921
19923
  status: RCLoggerStatus.FAILED,
@@ -20416,14 +20418,18 @@
20416
20418
  * 扩散 cdn_uris 资源
20417
20419
  */
20418
20420
  function spreadCDNInfo(context, roomId, CDNUris) {
20419
- var _a, _b;
20421
+ var _a, _b, _c, _d;
20420
20422
  return __awaiter(this, void 0, void 0, function* () {
20423
+ const traceId = (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20424
+ (_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({
20425
+ CDNUris,
20426
+ }), traceId);
20421
20427
  const code = yield context.setRTCCDNUris(roomId, RCRTCMessageType.TOTAL_CONTENT_RESOURCE, JSON.stringify([CDNUris]));
20422
20428
  if (code !== engine.ErrorCode.SUCCESS) {
20423
- (_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}`);
20429
+ (_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);
20424
20430
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
20425
20431
  }
20426
- (_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');
20432
+ (_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);
20427
20433
  return { code: exports.RCRTCCode.SUCCESS };
20428
20434
  });
20429
20435
  }
@@ -20431,14 +20437,16 @@
20431
20437
  * 给房间设置 CDN 数据
20432
20438
  */
20433
20439
  function setRoomCDNInfo(context, roomId, CDNUris) {
20434
- var _a, _b;
20440
+ var _a, _b, _c, _d;
20435
20441
  return __awaiter(this, void 0, void 0, function* () {
20442
+ const traceId = (_a = context === null || context === void 0 ? void 0 : context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20443
+ (_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);
20436
20444
  const code = yield context.setRTCData(roomId, 'cdn_uris', JSON.stringify([CDNUris]), true, RTCApiType.ROOM);
20437
20445
  if (code !== engine.ErrorCode.SUCCESS) {
20438
- (_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}`);
20446
+ (_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);
20439
20447
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
20440
20448
  }
20441
- (_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');
20449
+ (_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);
20442
20450
  return { code: exports.RCRTCCode.SUCCESS };
20443
20451
  });
20444
20452
  }
@@ -20446,34 +20454,16 @@
20446
20454
  * 开启、停用 CDN 推资源后发信令
20447
20455
  */
20448
20456
  function sendCDNInfoSignal(store) {
20449
- var _a, _b, _c, _d, _e, _f;
20450
20457
  return __awaiter(this, void 0, void 0, function* () {
20451
20458
  const { context } = store;
20452
20459
  const { roomId } = store;
20453
20460
  // eslint-disable-next-line
20454
20461
  const CDNUris = Object.assign({}, store.getCDNUris(), { enableInnerCDN: store.getCDNEnable() });
20455
- (_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({
20456
- roomId,
20457
- CDNUris,
20458
- }));
20459
20462
  const resCodeArr = yield Promise.all([
20460
20463
  spreadCDNInfo(context, roomId, CDNUris),
20461
20464
  setRoomCDNInfo(context, roomId, CDNUris),
20462
20465
  ]);
20463
20466
  const isSuccess = resCodeArr.every((item) => item.code === exports.RCRTCCode.SUCCESS);
20464
- if (isSuccess) {
20465
- (_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({
20466
- status: RCLoggerStatus.SUCCESSED,
20467
- CDNUris,
20468
- }));
20469
- }
20470
- else {
20471
- (_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({
20472
- status: RCLoggerStatus.FAILED,
20473
- code: exports.RCRTCCode.SIGNAL_ERROR,
20474
- msg: 'signal error',
20475
- }));
20476
- }
20477
20467
  return isSuccess ? { code: exports.RCRTCCode.SUCCESS } : { code: exports.RCRTCCode.SIGNAL_ERROR };
20478
20468
  });
20479
20469
  }
@@ -20939,17 +20929,18 @@
20939
20929
  }
20940
20930
 
20941
20931
  class SubscribeCommand extends BaseCommand {
20942
- constructor(tracks, subhook, forceReq) {
20932
+ constructor(tracks, subhook, forceReq, traceId) {
20943
20933
  super();
20944
20934
  this.tracks = tracks;
20945
20935
  this.subhook = subhook;
20946
20936
  this.forceReq = forceReq;
20937
+ this.traceId = traceId;
20947
20938
  }
20948
20939
  get kind() {
20949
20940
  return RCCommandKind.SUBSCRIBE;
20950
20941
  }
20951
20942
  execute(store, invoker) {
20952
- var _a, _b, _c, _d, _e, _f, _g, _h;
20943
+ var _a, _b, _c, _d, _e, _f;
20953
20944
  return __awaiter(this, void 0, void 0, function* () {
20954
20945
  // 取消房间状态检查,房间销毁后,invoker 应直接清空,避免后续执行动作
20955
20946
  // const roomStatusCode = this._assertRoomDestroyed()
@@ -20958,17 +20949,16 @@
20958
20949
  // return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED }
20959
20950
  // }
20960
20951
  const { tracks, forceReq } = this;
20961
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
20962
- (_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({
20952
+ (_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({
20963
20953
  trackIds: tracks.map(getTrackIdFromAttr),
20964
20954
  forceReq,
20965
- }), traceId);
20955
+ }), this.traceId);
20966
20956
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
20967
- (_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({
20957
+ (_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({
20968
20958
  status: RCLoggerStatus.FAILED,
20969
20959
  code: exports.RCRTCCode.PARAMS_ERROR,
20970
20960
  msg: 'params error -> tracks',
20971
- }), traceId);
20961
+ }), this.traceId);
20972
20962
  return { code: exports.RCRTCCode.PARAMS_ERROR };
20973
20963
  }
20974
20964
  const crtSubList = store.getSubscribedList().map((item) => (Object.assign({}, item)));
@@ -20991,16 +20981,16 @@
20991
20981
  changed = true;
20992
20982
  });
20993
20983
  if (!changed && !forceReq) {
20994
- (_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({
20984
+ (_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({
20995
20985
  status: RCLoggerStatus.SUCCESSED,
20996
20986
  msg: 'repeat subscribe',
20997
- }), traceId);
20987
+ }), this.traceId);
20998
20988
  return { code: exports.RCRTCCode.SUCCESS };
20999
20989
  }
21000
20990
  // 北极星上报
21001
20991
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
21002
20992
  recordSubscribeCommand(true);
21003
- return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, traceId).execute(store, invoker);
20993
+ return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, this.traceId).execute(store, invoker);
21004
20994
  });
21005
20995
  }
21006
20996
  }
@@ -21268,7 +21258,7 @@
21268
21258
  // 通知房间成员
21269
21259
  // 连通率相关埋点-统计扩散耗时
21270
21260
  recordPublishSignalTotalData();
21271
- let errorCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList), CDNValueInfo);
21261
+ let errorCode = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.PUBLISH, plus)], buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList), CDNValueInfo);
21272
21262
  // TIPS: 通知房间成员失败,对信息进行重试操作
21273
21263
  if (errorCode !== engine.ErrorCode.SUCCESS) {
21274
21264
  const RetrySignal = RetrySignaling.handler();
@@ -21278,7 +21268,7 @@
21278
21268
  if ((new Date()).valueOf() - startTime > this.signalRetryTime) {
21279
21269
  return errorCode;
21280
21270
  }
21281
- const code = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21271
+ const code = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.PUBLISH, plus)], buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21282
21272
  if (code !== engine.ErrorCode.SUCCESS) {
21283
21273
  yield RetrySignal.task(loop);
21284
21274
  }
@@ -21501,7 +21491,7 @@
21501
21491
  const dList = publishedList.filter((item) => !unpublishList.includes(item));
21502
21492
  // 通知房间内成员
21503
21493
  recordUnpublishSignalTotalData();
21504
- const singalCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.UNPUBLISH, unpublishList), buildTotalURIMessageContent(dList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21494
+ const singalCode = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.UNPUBLISH, unpublishList)], buildTotalURIMessageContent(dList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
21505
21495
  if (singalCode !== engine.ErrorCode.SUCCESS) {
21506
21496
  reportQualityUnpublishSignalTotalData(publishedList, singalCode);
21507
21497
  (_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({
@@ -21593,16 +21583,20 @@
21593
21583
  return RCCommandKind.LOCAL_TRACK_MUTE;
21594
21584
  }
21595
21585
  execute(store, invoker) {
21596
- var _a, _b, _c, _d;
21586
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21597
21587
  return __awaiter(this, void 0, void 0, function* () {
21598
21588
  const { localTrack } = this;
21599
21589
  const trackId = localTrack.getTrackId();
21600
21590
  const { crtUserId, roomId } = store;
21601
21591
  const enabled = !localTrack.isLocalMuted();
21592
+ const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21593
+ (_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({
21594
+ enabled,
21595
+ trackId: this.localTrack.getTrackId(),
21596
+ }), traceId);
21602
21597
  // 本地资源,需同步房间状态
21603
21598
  const localResource = [{ resourceId: trackId, enabled }];
21604
21599
  // 计算更新后的全量资源数据
21605
- // const publishedList = this._roomResources[crtUserId] || []
21606
21600
  const publishedList = store.getResourcesByUserId(crtUserId);
21607
21601
  // 增量数据
21608
21602
  const plusList = [];
@@ -21617,23 +21611,19 @@
21617
21611
  break;
21618
21612
  }
21619
21613
  }
21620
- const code = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.MODIFY, plusList), buildTotalURIMessageContent(publishedList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21614
+ const code = yield store.context.setRTCTotalRes(roomId, [buildPlusMessage(RCRTCMessageType.MODIFY, plusList)], buildTotalURIMessageContent(publishedList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21621
21615
  // 执行 localTrack.mute 传入的 resolve,并返回 signal 扩散的 code 码
21622
21616
  this._recvSignalResultFn(code);
21623
21617
  if (code !== engine.ErrorCode.SUCCESS) {
21624
- (_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({
21618
+ (_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({
21625
21619
  status: RCLoggerStatus.FAILED,
21626
21620
  code,
21627
- enabled,
21628
- trackId: this.localTrack.getTrackId(),
21629
21621
  msg: 'signal error',
21630
- }));
21622
+ }), traceId);
21631
21623
  }
21632
- (_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({
21624
+ (_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({
21633
21625
  status: RCLoggerStatus.SUCCESSED,
21634
- enabled,
21635
- trackId: this.localTrack.getTrackId(),
21636
- }));
21626
+ }), traceId);
21637
21627
  });
21638
21628
  }
21639
21629
  }
@@ -21652,9 +21642,12 @@
21652
21642
  return CommandPriority.HIGH;
21653
21643
  }
21654
21644
  execute(store, invoker) {
21655
- var _a, _b;
21645
+ var _a, _b, _c, _d, _e;
21656
21646
  return __awaiter(this, void 0, void 0, function* () {
21657
- (_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);
21647
+ const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21648
+ (_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);
21649
+ this._store = store;
21650
+ this._userId = store.context.getCurrentId();
21658
21651
  const { pcName, isPub } = this;
21659
21652
  const { useMutilPeerC } = store;
21660
21653
  const { pc } = store.peerMgr.getPCItemByPCName(pcName);
@@ -21669,17 +21662,91 @@
21669
21662
  // 发送 /exchange 请求
21670
21663
  const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
21671
21664
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
21672
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resp.code}, pcName: ${pcName}`, traceId);
21673
21665
  return;
21674
21666
  }
21675
21667
  const { sdp: answer, resultCode } = resp.data;
21676
21668
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
21677
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resultCode}, pcName: ${pcName}`, traceId);
21678
21669
  return;
21679
21670
  }
21680
21671
  // 请求成功,清除 ice 断线重连的定时器
21681
21672
  pc.clearReTryExchangeTimer();
21682
- yield pc.setRemoteAnswer(answer.sdp);
21673
+ const code = yield pc.setRemoteAnswer(answer.sdp);
21674
+ if (code !== exports.RCRTCCode.SUCCESS) {
21675
+ return;
21676
+ }
21677
+ if (!this.isPub) {
21678
+ return;
21679
+ }
21680
+ /**
21681
+ * 对比 ice 恢复后,发布的资源 uri 是否有变化,
21682
+ * 有则更新内存、扩散给房间内其他人
21683
+ */
21684
+ const publishList = ((_e = resp.data) === null || _e === void 0 ? void 0 : _e.publishList) || [];
21685
+ const { plus, minus } = this._diffPublishListChange(publishList);
21686
+ if (plus.length || minus.length) {
21687
+ yield this._spreadPublishListUri(plus, minus, traceId);
21688
+ }
21689
+ });
21690
+ }
21691
+ /**
21692
+ * 对比新增、取消发布的资源
21693
+ */
21694
+ _diffPublishListChange(publishResource) {
21695
+ const oldPublisheList = this._store.getResourcesByUserId(this._userId);
21696
+ const { useMutilPeerC } = this._store;
21697
+ let newPublishList = JSON.parse(JSON.stringify(oldPublisheList));
21698
+ /**
21699
+ * 单 peerConnection 直接覆盖发布列表
21700
+ * 多 peerConnection 发布完,原 oldPublisheList 中如果有,则替换,没有则为新增
21701
+ */
21702
+ if (!useMutilPeerC) {
21703
+ newPublishList = publishResource.map((item) => (Object.assign({ tag: item.msid.split('_').pop(), state: this._store.getTrackState(getTrackId(item)) }, item)));
21704
+ }
21705
+ else {
21706
+ publishResource.forEach((pubItem) => {
21707
+ const { mediaType, msid } = pubItem;
21708
+ const index = newPublishList.findIndex((oldItem) => {
21709
+ const { mediaType: oldMediaType, msid: oldMsid } = oldItem;
21710
+ return (mediaType === oldMediaType && msid === oldMsid);
21711
+ });
21712
+ if (index === -1) {
21713
+ const newItem = Object.assign({ tag: msid.split('_').pop(), state: this._store.getTrackState(getTrackId(pubItem)) }, pubItem);
21714
+ newPublishList.push(newItem);
21715
+ }
21716
+ else {
21717
+ newPublishList[index].uri = pubItem.uri;
21718
+ }
21719
+ });
21720
+ }
21721
+ const { publishedList: plus, unpublishedList: minus } = diffPublishResources(oldPublisheList, newPublishList, true);
21722
+ this._store.setResourcesByUserId(this._userId, newPublishList);
21723
+ return { plus, minus };
21724
+ }
21725
+ /**
21726
+ * 扩散新增、取消发布资源
21727
+ * @param plus 新增发布
21728
+ * @param minus 减少发布
21729
+ */
21730
+ _spreadPublishListUri(plus, minus, traceId) {
21731
+ var _a, _b, _c;
21732
+ return __awaiter(this, void 0, void 0, function* () {
21733
+ const allPublishList = this._store.getResourcesByUserId(this._userId);
21734
+ (_a = this._store.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_T, JSON.stringify({
21735
+ plus,
21736
+ minus,
21737
+ allPublishList,
21738
+ pcName: this.pcName,
21739
+ }), traceId);
21740
+ const oldSdkSpreadMsg = [];
21741
+ minus.length && oldSdkSpreadMsg.push(buildPlusMessage(RCRTCMessageType.UNPUBLISH, minus));
21742
+ plus.length && oldSdkSpreadMsg.push(buildPlusMessage(RCRTCMessageType.PUBLISH, plus));
21743
+ const code = yield this._store.context.setRTCTotalRes(this._store.roomId, oldSdkSpreadMsg, buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE);
21744
+ if (code === engine.ErrorCode.SUCCESS) {
21745
+ (_b = this._store.context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_R, `status: ${RCLoggerStatus.SUCCESSED}`, traceId);
21746
+ }
21747
+ else {
21748
+ (_c = this._store.context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_RETRY_EXCHANGE_SPREAD_R, `status: ${RCLoggerStatus.FAILED}`, traceId);
21749
+ }
21683
21750
  });
21684
21751
  }
21685
21752
  }
@@ -21760,7 +21827,7 @@
21760
21827
  return;
21761
21828
  }
21762
21829
  if (!data) {
21763
- (_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({
21830
+ (_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({
21764
21831
  status: RCLoggerStatus.FAILED,
21765
21832
  msg: 'im reconnect joinRTCRoom, roomData is empty',
21766
21833
  }), traceId);
@@ -21822,11 +21889,9 @@
21822
21889
  return RCCommandKind.ASYNC_COMMAND;
21823
21890
  }
21824
21891
  execute(store, invoker) {
21825
- var _a, _b, _c, _d;
21892
+ var _a, _b, _c;
21826
21893
  return __awaiter(this, void 0, void 0, function* () {
21827
21894
  const { tracks } = this;
21828
- const { roomId } = store;
21829
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `unsubscribe -> roomId: ${roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
21830
21895
  if (this.state === RCLinkedListPoint.NORMAL) {
21831
21896
  // 获取原订阅列表
21832
21897
  const originTracks = store.getSubscribedList().slice();
@@ -21835,7 +21900,7 @@
21835
21900
  const subscribedTracks = store.getSubscribedList().slice();
21836
21901
  // 计算订阅列表 Diff
21837
21902
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21838
- (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21903
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21839
21904
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21840
21905
  });
21841
21906
  return { code: updateSuscribeCode, failedList };
@@ -21851,14 +21916,14 @@
21851
21916
  // 自执行一次,计算出最终的 collectSubscribeList
21852
21917
  const { code: updateSuscribeCode, failedList } = yield new UpdateSubscribeListCommand(tracks, this.subhook, true).execute(store, invoker);
21853
21918
  if (updateSuscribeCode !== exports.RCRTCCode.SUCCESS) {
21854
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21919
+ (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21855
21920
  code: updateSuscribeCode, subscribe: [], unsubscribe: [], failedList,
21856
21921
  });
21857
21922
  return { code: updateSuscribeCode, failedList };
21858
21923
  }
21859
21924
  const subscribedTracks = store.getSubscribedList().slice(0);
21860
21925
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21861
- (_d = this.callbacks) === null || _d === void 0 ? void 0 : _d.onTaskCompleted({
21926
+ (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21862
21927
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21863
21928
  });
21864
21929
  return { code: updateSuscribeCode, failedList };
@@ -21878,25 +21943,25 @@
21878
21943
  }
21879
21944
 
21880
21945
  class AsyncSubscribeCommand extends AsyncCommand {
21881
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
21946
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21882
21947
  super(state);
21883
21948
  this.tracks = tracks;
21884
21949
  this.subhook = subhook;
21885
21950
  this.callbacks = callbacks;
21951
+ this.traceId = traceId;
21886
21952
  }
21887
21953
  get kind() {
21888
21954
  return RCCommandKind.ASYNC_COMMAND;
21889
21955
  }
21890
21956
  execute(store, invoker) {
21891
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21957
+ var _a, _b, _c, _d, _e;
21892
21958
  return __awaiter(this, void 0, void 0, function* () {
21893
21959
  const { tracks } = this;
21894
- const { roomId } = store;
21895
21960
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21896
21961
  if (this.state === RCLinkedListPoint.NORMAL) {
21897
21962
  // 获取原订阅列表
21898
21963
  const originTracks = store.getSubscribedList().slice();
21899
- const { code: subscribeCode, failedList } = yield new SubscribeCommand(tracks, this.subhook).execute(store, invoker);
21964
+ const { code: subscribeCode, failedList } = yield new SubscribeCommand(tracks, this.subhook, false, this.traceId).execute(store, invoker);
21900
21965
  // 获取新的订阅列表
21901
21966
  const subscribedTracks = store.getSubscribedList().slice();
21902
21967
  // 计算订阅列表 Diff
@@ -21906,16 +21971,15 @@
21906
21971
  });
21907
21972
  return { code: subscribeCode, failedList };
21908
21973
  }
21909
- const traceId = (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.createTraceId();
21910
- (_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({
21974
+ (_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({
21911
21975
  trackIds: tracks.map(getTrackIdFromAttr),
21912
- }), traceId);
21976
+ }), this.traceId);
21913
21977
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
21914
- (_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({
21978
+ (_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({
21915
21979
  status: RCLoggerStatus.FAILED,
21916
21980
  code: exports.RCRTCCode.PARAMS_ERROR,
21917
21981
  msg: 'params error -> tracks',
21918
- }));
21982
+ }), this.traceId);
21919
21983
  return { code: exports.RCRTCCode.PARAMS_ERROR };
21920
21984
  }
21921
21985
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item)));
@@ -21939,16 +22003,12 @@
21939
22003
  });
21940
22004
  // 北极星上报
21941
22005
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
21942
- (_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({
21943
- trackIds: tracks.map(getTrackIdFromAttr),
21944
- roomId,
21945
- }));
21946
22006
  if (this.state === RCLinkedListPoint.TAIL) {
21947
- const { code: subscribeCode } = yield new AsyncSubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE).execute(store, invoker);
22007
+ const { code: subscribeCode } = yield new AsyncSubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE, this.traceId).execute(store, invoker);
21948
22008
  if (subscribeCode === exports.RCRTCCode.SUCCESS) {
21949
22009
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21950
22010
  const tracks = store.getCollectSubscribeList().slice(0);
21951
- return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, traceId).execute(store, invoker);
22011
+ return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, this.traceId).execute(store, invoker);
21952
22012
  }
21953
22013
  return { code: subscribeCode };
21954
22014
  }
@@ -21975,63 +22035,58 @@
21975
22035
  }
21976
22036
 
21977
22037
  class AsyncUnsubscribeCommand extends AsyncCommand {
21978
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
22038
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21979
22039
  super(state);
21980
22040
  this.tracks = tracks;
21981
22041
  this.subhook = subhook;
21982
22042
  this.callbacks = callbacks;
22043
+ this.traceId = traceId;
21983
22044
  }
21984
22045
  get kind() {
21985
22046
  return RCCommandKind.ASYNC_COMMAND;
21986
22047
  }
21987
22048
  execute(store, invoker) {
21988
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22049
+ var _a, _b, _c, _d, _e;
21989
22050
  return __awaiter(this, void 0, void 0, function* () {
21990
22051
  const { tracks } = this;
21991
- const { roomId } = store;
21992
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21993
22052
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21994
22053
  if (this.state === RCLinkedListPoint.NORMAL) {
21995
22054
  // 获取原订阅列表
21996
22055
  const originTracks = store.getSubscribedList().slice();
21997
- const { code: unsubscribeCode, failedList } = yield new UnsubscribeCommand(tracks, this.subhook, traceId).execute(store, invoker);
22056
+ const { code: unsubscribeCode, failedList } = yield new UnsubscribeCommand(tracks, this.subhook, this.traceId).execute(store, invoker);
21998
22057
  // 获取新的订阅列表
21999
22058
  const subscribedTracks = store.getSubscribedList().slice();
22000
22059
  // 计算出 Diff
22001
22060
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
22002
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
22061
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
22003
22062
  code: unsubscribeCode, subscribe, unsubscribe, failedList,
22004
22063
  });
22005
22064
  return { code: unsubscribeCode, failedList };
22006
22065
  }
22007
- (_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({
22066
+ (_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({
22008
22067
  trackIds: tracks.map(getTrackIdFromAttr),
22009
- }));
22068
+ }), this.traceId);
22010
22069
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
22011
- (_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({
22070
+ (_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({
22012
22071
  status: RCLoggerStatus.FAILED,
22013
22072
  code: exports.RCRTCCode.PARAMS_ERROR,
22014
22073
  msg: 'params error -> tracks',
22015
- }));
22074
+ }), this.traceId);
22016
22075
  return { code: exports.RCRTCCode.PARAMS_ERROR };
22017
22076
  }
22018
22077
  // 计算剩余订阅列表, 如果资源在取消订阅列表内则排除它
22019
22078
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item))).filter((item) => !tracks.includes(item.track));
22020
22079
  // 北极星上报
22021
22080
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
22022
- (_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({
22023
- trackIds: tracks.map(getTrackIdFromAttr),
22024
- roomId,
22025
- }));
22026
22081
  if (this.state === RCLinkedListPoint.TAIL) {
22027
22082
  // 自执行一次,计算出最终的 collectSubscribeList
22028
- const { code: unsubscribeCode } = yield new AsyncUnsubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE).execute(store, invoker);
22083
+ const { code: unsubscribeCode } = yield new AsyncUnsubscribeCommand(this.tracks, this.subhook, this.callbacks, RCLinkedListPoint.MIDDLE, this.traceId).execute(store, invoker);
22029
22084
  // 拥塞队列处理完成的数据
22030
22085
  if (unsubscribeCode === exports.RCRTCCode.SUCCESS) {
22031
22086
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
22032
22087
  const tracks = store.getCollectSubscribeList().slice(0).map((item) => item.track);
22033
22088
  // 自执行一次,计算出最终的 collectSubscribeList
22034
- return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, traceId).execute(store, invoker);
22089
+ return new AsyncUpdateSubscribeListCommand(tracks, this.subhook, this.callbacks, RCLinkedListPoint.NORMAL, this.traceId).execute(store, invoker);
22035
22090
  }
22036
22091
  return { code: unsubscribeCode };
22037
22092
  }
@@ -22207,8 +22262,18 @@
22207
22262
  this._peerCManager.setStore(this._store);
22208
22263
  // 注册监听 rtc_ntf 信令数据,收到通知时拉取房间数据
22209
22264
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
22210
- var _a, _b, _c, _d;
22265
+ var _a, _b, _c, _d, _e, _f;
22211
22266
  const { time, type, roomId, } = this._context.decodeRtcNotify(buffer);
22267
+ // 房间销毁后直接生吞发过来的事件
22268
+ if (this._invoker.isDestroyed()) {
22269
+ (_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({
22270
+ isDestroyed: true,
22271
+ type,
22272
+ time,
22273
+ roomId,
22274
+ }));
22275
+ return;
22276
+ }
22212
22277
  switch (type) {
22213
22278
  case 2:
22214
22279
  if (roomId !== this._roomId) {
@@ -22216,8 +22281,8 @@
22216
22281
  }
22217
22282
  // 拉取房间数据
22218
22283
  // eslint-disable-next-line no-case-declarations
22219
- const tracId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
22220
- (_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);
22284
+ const tracId = (_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.createTraceId();
22285
+ (_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);
22221
22286
  this._startPullRTCRoomStatus(roomId, tracId);
22222
22287
  break;
22223
22288
  }
@@ -22881,15 +22946,11 @@
22881
22946
  });
22882
22947
  }
22883
22948
  _getRTCReqestHeaders(pcName) {
22884
- const heasers = {
22885
- 'App-Key': this._context.getAppkey(),
22886
- RoomId: this._roomId,
22887
- Token: this._store.getToken(),
22888
- RoomType: this._store.roomMode,
22889
- UserId: this._context.getCurrentId(),
22890
- 'Client-Session-Id': this._clientSessionId,
22891
- 'Peer-Connection-Id': pcName,
22892
- };
22949
+ /**
22950
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
22951
+ */
22952
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': pcName } : {};
22953
+ 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);
22893
22954
  return heasers;
22894
22955
  }
22895
22956
  /**
@@ -22958,9 +23019,11 @@
22958
23019
  * @returns 一个用代码和失败列表解析为对象的承诺。
22959
23020
  */
22960
23021
  addSubscribeTask(tracks) {
23022
+ var _a;
23023
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22961
23024
  this._invoker.push(new AsyncSubscribeCommand(tracks, this._subhook.bind(this), {
22962
23025
  onTaskCompleted: this._onTaskCompleted.bind(this),
22963
- }));
23026
+ }, RCLinkedListPoint.NORMAL, traceId));
22964
23027
  }
22965
23028
  /**
22966
23029
  * 取消订阅资源
@@ -22980,9 +23043,11 @@
22980
23043
  * @returns 一个用代码和失败列表解析为对象的承诺。
22981
23044
  */
22982
23045
  addUnsubscribeTask(tracks) {
23046
+ var _a;
23047
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22983
23048
  this._invoker.push(new AsyncUnsubscribeCommand(tracks, this._subhook.bind(this), {
22984
23049
  onTaskCompleted: this._onTaskCompleted.bind(this),
22985
- }));
23050
+ }, RCLinkedListPoint.NORMAL, traceId));
22986
23051
  }
22987
23052
  /**
22988
23053
  * 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
@@ -24168,23 +24233,28 @@
24168
24233
  })(RCInnerCDNPushMode || (RCInnerCDNPushMode = {}));
24169
24234
 
24170
24235
  class ExchangeWithPushOtherRoomCommand extends BaseCommand {
24171
- constructor(roomId, hooks, roomPKHandler) {
24236
+ constructor(roomId, hooks, roomPKHandler, traceId) {
24172
24237
  super();
24173
24238
  this.roomId = roomId;
24174
24239
  this.hooks = hooks;
24175
24240
  this.roomPKHandler = roomPKHandler;
24241
+ this.traceId = traceId;
24176
24242
  }
24177
24243
  /**
24178
24244
  * 携带 pushOtherRooms 与 mediaServer 重新交互
24179
24245
  */
24180
24246
  _exchangeWithPushOtherRoom(store, invoker) {
24181
- var _a, _b, _c, _d;
24247
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24182
24248
  return __awaiter(this, void 0, void 0, function* () {
24183
24249
  /**
24184
24250
  * 如果己方未发布过资源,无需发请求
24185
24251
  */
24186
24252
  const pubTracks = store.getLocalTracks();
24187
24253
  if (!pubTracks.length) {
24254
+ (_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({
24255
+ status: RCLoggerStatus.SUCCESSED,
24256
+ msg: 'have not published resource',
24257
+ }), this.traceId);
24188
24258
  return;
24189
24259
  }
24190
24260
  const mutilPeerCList = Object.values(store.peerMgr.getMutilPeerCData());
@@ -24195,16 +24265,28 @@
24195
24265
  const reqBody = yield createExchangeParams(subscribeList, false, pc, store);
24196
24266
  const { pushOtherRooms, headers } = this.hooks(pcNameList[index]);
24197
24267
  reqBody.pushOtherRooms = pushOtherRooms;
24198
- const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
24268
+ const resp = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
24199
24269
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
24200
- (_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}`);
24270
+ (_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({
24271
+ status: RCLoggerStatus.FAILED,
24272
+ code: resp.code,
24273
+ pushOtherRooms,
24274
+ }), this.traceId);
24201
24275
  return;
24202
24276
  }
24203
24277
  const { sdp: answer, resultCode } = resp.data;
24204
24278
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
24205
- (_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}`);
24279
+ (_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({
24280
+ status: RCLoggerStatus.FAILED,
24281
+ code: resultCode,
24282
+ pushOtherRooms,
24283
+ }), this.traceId);
24206
24284
  return;
24207
24285
  }
24286
+ (_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({
24287
+ status: RCLoggerStatus.SUCCESSED,
24288
+ pushOtherRooms,
24289
+ }), this.traceId);
24208
24290
  pc.setRemoteAnswer(answer.sdp);
24209
24291
  }
24210
24292
  });
@@ -24213,45 +24295,35 @@
24213
24295
  return RCCommandKind.EXCHANGE_WITH_PUSH_OTHER_ROOM;
24214
24296
  }
24215
24297
  execute(store, invoker) {
24216
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24298
+ var _a, _b, _c, _d, _e, _f;
24217
24299
  return __awaiter(this, void 0, void 0, function* () {
24218
24300
  const { roomId } = this;
24219
- (_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({
24301
+ (_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({
24220
24302
  roomId,
24221
- userId: store.crtUserId,
24222
24303
  }));
24223
24304
  // 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
24224
24305
  if (!this.roomPKHandler) {
24225
- (_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({
24306
+ (_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({
24226
24307
  status: RCLoggerStatus.FAILED,
24227
- code: '',
24228
24308
  msg: '_roomPKHandler not exist',
24229
- }));
24309
+ }), this.traceId);
24230
24310
  return;
24231
24311
  }
24232
24312
  const PKInfo = this.roomPKHandler.getPKInfo(roomId);
24233
24313
  if (!PKInfo) {
24234
- (_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}`);
24235
- (_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({
24314
+ (_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({
24236
24315
  status: RCLoggerStatus.FAILED,
24237
- code: '',
24238
24316
  msg: 'PKInfo not exist',
24239
- }));
24317
+ }), this.traceId);
24240
24318
  return;
24241
24319
  }
24242
24320
  yield this._exchangeWithPushOtherRoom(store, invoker);
24243
- (_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({
24244
- status: RCLoggerStatus.SUCCESSED,
24245
- roomId,
24246
- userId: store.crtUserId,
24247
- PKInfo,
24248
- }));
24249
24321
  });
24250
24322
  }
24251
24323
  }
24252
24324
 
24253
24325
  class LeaveOtherRoomCommand extends BaseCommand {
24254
- constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK) {
24326
+ constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK, traceId) {
24255
24327
  super();
24256
24328
  this.pkHandler = pkHandler;
24257
24329
  this.room = room;
@@ -24259,6 +24331,7 @@
24259
24331
  this.hooks = hooks;
24260
24332
  this._joinedPKRooms = _joinedPKRooms;
24261
24333
  this.isQuitPK = isQuitPK;
24334
+ this.traceId = traceId;
24262
24335
  }
24263
24336
  get kind() {
24264
24337
  return RCCommandKind.LEAVE_OTHER_ROOM;
@@ -24267,10 +24340,12 @@
24267
24340
  * 结束跨房间连麦
24268
24341
  * @param roomId 需要结束连麦的房间 roomId
24269
24342
  */
24270
- quitRoomPK(roomId, store) {
24271
- var _a, _b, _c, _d, _e, _f;
24343
+ quitRoomPK(roomId, store, traceId) {
24344
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24272
24345
  return __awaiter(this, void 0, void 0, function* () {
24346
+ (_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);
24273
24347
  if (!this._PKInfo[roomId]) {
24348
+ (_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);
24274
24349
  return;
24275
24350
  }
24276
24351
  const { inviterRoomId, inviteeRoomId, inviterUserId, inviteSessionId, } = this._PKInfo[roomId];
@@ -24286,40 +24361,34 @@
24286
24361
  content: JSON.stringify(content),
24287
24362
  keys: [`${inviterRoomId}|${inviterUserId}`],
24288
24363
  };
24289
- (_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)}`);
24290
24364
  const code = yield store.context.endRoomPK(params);
24291
24365
  if (code !== engine.ErrorCode.SUCCESS) {
24292
- (_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}`);
24366
+ (_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);
24293
24367
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
24294
24368
  }
24295
- (_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');
24369
+ (_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);
24296
24370
  delete this._PKInfo[roomId];
24297
24371
  return { code: exports.RCRTCCode.SUCCESS };
24298
24372
  });
24299
24373
  }
24300
24374
  execute(store, invoker) {
24301
- var _a, _b, _c, _d, _e, _f;
24375
+ var _a, _b, _c, _d;
24302
24376
  return __awaiter(this, void 0, void 0, function* () {
24303
24377
  const { room, isQuitPK } = this;
24304
24378
  const roomId = room.getRoomId();
24305
- (_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}`);
24306
- (_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({
24379
+ (_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({
24307
24380
  roomId,
24308
- userId: store.crtUserId,
24309
24381
  isQuitPK,
24310
- }));
24382
+ }), this.traceId);
24311
24383
  yield room.__destroy(true);
24312
24384
  // 回调主直播房间离开 PK 房间
24313
24385
  delete this._joinedPKRooms[roomId];
24314
- yield new ExchangeWithPushOtherRoomCommand(roomId, this.hooks, this.pkHandler).execute(store, invoker);
24386
+ yield new ExchangeWithPushOtherRoomCommand(roomId, this.hooks, this.pkHandler, this.traceId).execute(store, invoker);
24315
24387
  // isQuitPK 为 true 时,结束连麦
24316
- isQuitPK && this.quitRoomPK(roomId, store);
24317
- (_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({
24388
+ isQuitPK && this.quitRoomPK(roomId, store, this.traceId);
24389
+ (_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({
24318
24390
  status: RCLoggerStatus.SUCCESSED,
24319
- roomId,
24320
- userId: store.crtUserId,
24321
- isQuitPK,
24322
- }));
24391
+ }), this.traceId);
24323
24392
  return { code: exports.RCRTCCode.SUCCESS };
24324
24393
  });
24325
24394
  }
@@ -24361,9 +24430,8 @@
24361
24430
  this._mainRoomId = this._mainLivingRoom.getRoomId();
24362
24431
  }
24363
24432
  _callAppListener(eventType, ...attrs) {
24364
- var _a, _b, _c, _d, _e;
24365
- (_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)}`);
24366
- const handle = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c[eventType];
24433
+ var _a, _b, _c;
24434
+ const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
24367
24435
  if (!handle) {
24368
24436
  return;
24369
24437
  }
@@ -24371,7 +24439,7 @@
24371
24439
  handle(...attrs);
24372
24440
  }
24373
24441
  catch (error) {
24374
- (_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));
24442
+ (_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));
24375
24443
  }
24376
24444
  }
24377
24445
  /**
@@ -24387,8 +24455,7 @@
24387
24455
  extra,
24388
24456
  };
24389
24457
  this._PKInfo[inviterRoomId] = inviteInfo;
24390
- (_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({
24391
- status: RCLoggerStatus.SUCCESSED,
24458
+ (_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({
24392
24459
  eventType: 'onRequestJoinOtherRoom',
24393
24460
  info,
24394
24461
  }));
@@ -24406,8 +24473,7 @@
24406
24473
  extra,
24407
24474
  };
24408
24475
  delete this._PKInfo[inviterRoomId];
24409
- (_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({
24410
- status: RCLoggerStatus.SUCCESSED,
24476
+ (_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({
24411
24477
  eventType: 'onCancelRequestOtherRoom',
24412
24478
  cancelInfo,
24413
24479
  }));
@@ -24442,21 +24508,20 @@
24442
24508
  inviteeRoomId,
24443
24509
  };
24444
24510
  this._PKInfo[inviteeRoomId].inviteeUserAutoMix = inviteeUserAutoMix;
24445
- (_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({
24446
- status: RCLoggerStatus.SUCCESSED,
24511
+ (_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({
24447
24512
  eventType: 'onResponseJoinOtherRoom',
24448
24513
  answerInfo,
24449
24514
  }));
24450
24515
  this._callAppListener('onResponseJoinOtherRoom', answerInfo);
24451
24516
  }
24452
- createLeaveOtherRoomCommand(room, isQuitPK) {
24453
- return new LeaveOtherRoomCommand(this, room, this._PKInfo, this._hooks, this._joinedPKRooms, isQuitPK);
24517
+ createLeaveOtherRoomCommand(room, isQuitPK, traceId) {
24518
+ return new LeaveOtherRoomCommand(this, room, this._PKInfo, this._hooks, this._joinedPKRooms, isQuitPK, traceId);
24454
24519
  }
24455
24520
  /**
24456
24521
  * 收到连麦结束
24457
24522
  */
24458
24523
  _onPKEnd(content) {
24459
- var _a, _b;
24524
+ var _a, _b, _c, _d, _e, _f;
24460
24525
  return __awaiter(this, void 0, void 0, function* () {
24461
24526
  const { inviteeRoomId, inviterRoomId, userId } = content.inviteInfo;
24462
24527
  const roomId = inviterRoomId === this._mainRoomId ? inviteeRoomId : inviterRoomId;
@@ -24466,10 +24531,11 @@
24466
24531
  };
24467
24532
  // 兼容先退出房间,再收到 pk 结束的情况
24468
24533
  const room = this._joinedPKRooms[roomId];
24469
- room && (yield this._invoker.push(this.createLeaveOtherRoomCommand(room)));
24534
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24535
+ (_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);
24536
+ room && (yield this._invoker.push(this.createLeaveOtherRoomCommand(room, true, traceId)));
24470
24537
  delete this._PKInfo[roomId];
24471
- (_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({
24472
- status: RCLoggerStatus.SUCCESSED,
24538
+ (_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({
24473
24539
  eventType: 'onFinishOtherRoom',
24474
24540
  endInfo,
24475
24541
  }));
@@ -24505,7 +24571,6 @@
24505
24571
  registerRoomPKEventListener(listener) {
24506
24572
  var _a, _b;
24507
24573
  (_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({
24508
- status: RCLoggerStatus.SUCCESSED,
24509
24574
  listener: listener && Object.keys(listener),
24510
24575
  }));
24511
24576
  this._appListener = listener;
@@ -24518,23 +24583,23 @@
24518
24583
  * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
24519
24584
  */
24520
24585
  requestJoinOtherRoom(inviteeRoomId, inviteeUserId, options) {
24521
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
24586
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24522
24587
  return __awaiter(this, void 0, void 0, function* () {
24523
- (_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({
24588
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24589
+ (_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({
24524
24590
  inviteeRoomId,
24525
24591
  inviteeUserId,
24526
24592
  options,
24527
- }));
24593
+ }), traceId);
24528
24594
  if (!(engine.validate('inviteeRoomId', inviteeRoomId, engine.notEmptyString, true)
24529
24595
  && engine.validate('inviteeUserId', inviteeUserId, engine.notEmptyString, true))) {
24530
- (_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({
24596
+ (_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({
24531
24597
  status: RCLoggerStatus.FAILED,
24532
24598
  code: exports.RCRTCCode.PARAMS_ERROR,
24533
- msg: 'params error -> inviteeRoomId inviteeUserId',
24534
- }));
24599
+ msg: 'params error -> inviteeRoomId or inviteeUserId',
24600
+ }), traceId);
24535
24601
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24536
24602
  }
24537
- (_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 || {})}`);
24538
24603
  const inviteSessionId = getUUID();
24539
24604
  const autoMix = engine.isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24540
24605
  const inviteInfo = {
@@ -24555,18 +24620,14 @@
24555
24620
  inviteInfo: JSON.stringify(inviteInfo),
24556
24621
  inviteSessionId,
24557
24622
  };
24558
- (_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)}`);
24559
24623
  const code = yield this._context.requestRoomPK(params);
24560
24624
  if (code !== engine.ErrorCode.SUCCESS) {
24561
- (_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}`);
24562
- (_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({
24625
+ (_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({
24563
24626
  status: RCLoggerStatus.FAILED,
24564
24627
  code,
24565
- msg: '',
24566
- }));
24628
+ }), traceId);
24567
24629
  return { code };
24568
24630
  }
24569
- (_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');
24570
24631
  this._PKInfo[inviteeRoomId] = {
24571
24632
  inviteSessionId,
24572
24633
  inviterRoomId: this._mainRoomId,
@@ -24574,11 +24635,9 @@
24574
24635
  inviterUserAutoMix: autoMix,
24575
24636
  inviteeRoomId,
24576
24637
  };
24577
- (_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({
24578
- inviteeRoomId,
24579
- inviteeUserId,
24580
- options,
24581
- }));
24638
+ (_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({
24639
+ status: RCLoggerStatus.SUCCESSED,
24640
+ }), traceId);
24582
24641
  return { code: exports.RCRTCCode.SUCCESS };
24583
24642
  });
24584
24643
  }
@@ -24589,34 +24648,31 @@
24589
24648
  * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
24590
24649
  */
24591
24650
  cancelRequestJoinOtherRoom(inviteeRoomId, inviteeUserId, extra) {
24592
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
24651
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
24593
24652
  return __awaiter(this, void 0, void 0, function* () {
24594
- (_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({
24653
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24654
+ (_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({
24595
24655
  inviteeRoomId,
24596
24656
  inviteeUserId,
24597
24657
  extra,
24598
- userId: this._context.getCurrentId(),
24599
- roomId: this._mainRoomId,
24600
- }));
24658
+ }), traceId);
24601
24659
  if (!(engine.validate('inviteeRoomId', inviteeRoomId, engine.notEmptyString, true)
24602
24660
  && engine.validate('inviteeUserId', inviteeUserId, engine.notEmptyString, true))) {
24603
- (_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({
24661
+ (_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({
24604
24662
  status: RCLoggerStatus.FAILED,
24605
24663
  code: exports.RCRTCCode.PARAMS_ERROR,
24606
24664
  msg: 'params error -> inviteeRoomId or inviteeUserId',
24607
- }));
24665
+ }), traceId);
24608
24666
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24609
24667
  }
24610
24668
  if (!this._PKInfo[inviteeRoomId]) {
24611
- (_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`);
24612
24669
  (_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({
24613
24670
  status: RCLoggerStatus.FAILED,
24614
24671
  code: exports.RCRTCCode.PARAMS_ERROR,
24615
24672
  msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24616
- }));
24673
+ }), traceId);
24617
24674
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24618
24675
  }
24619
- (_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}`);
24620
24676
  const inviteInfo = {
24621
24677
  inviterRoomId: this._mainRoomId,
24622
24678
  inviterUserId: this._context.getCurrentId(),
@@ -24631,24 +24687,17 @@
24631
24687
  inviteSessionId: this._PKInfo[inviteeRoomId].inviteSessionId,
24632
24688
  inviteInfo: JSON.stringify(inviteInfo),
24633
24689
  };
24634
- (_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)}`);
24635
24690
  const code = yield this._context.cancelRoomPK(params);
24636
24691
  if (code !== engine.ErrorCode.SUCCESS) {
24637
- (_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}`);
24638
- (_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({
24692
+ (_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({
24639
24693
  status: RCLoggerStatus.FAILED,
24640
24694
  code,
24641
- msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24642
- }));
24695
+ }), traceId);
24643
24696
  return { code };
24644
24697
  }
24645
- (_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');
24646
- (_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({
24698
+ (_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({
24647
24699
  status: RCLoggerStatus.SUCCESSED,
24648
- inviteeRoomId,
24649
- inviteeUserId,
24650
- extra,
24651
- }));
24700
+ }), traceId);
24652
24701
  delete this._PKInfo[inviteeRoomId];
24653
24702
  return { code: exports.RCRTCCode.SUCCESS };
24654
24703
  });
@@ -24662,35 +24711,32 @@
24662
24711
  * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
24663
24712
  */
24664
24713
  responseJoinOtherRoom(inviterRoomId, inviterUserId, agree, options) {
24665
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
24714
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
24666
24715
  return __awaiter(this, void 0, void 0, function* () {
24667
- (_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({
24716
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24717
+ (_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({
24668
24718
  inviterRoomId,
24669
24719
  inviterUserId,
24670
24720
  agree,
24671
24721
  options,
24672
- userId: this._context.getCurrentId(),
24673
- roomId: this._mainRoomId,
24674
- }));
24722
+ }), traceId);
24675
24723
  if (!(engine.validate('inviterRoomId', inviterRoomId, engine.notEmptyString, true)
24676
24724
  && engine.validate('inviterUserId', inviterUserId, engine.notEmptyString, true))) {
24677
- (_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({
24725
+ (_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({
24678
24726
  status: RCLoggerStatus.FAILED,
24679
24727
  code: exports.RCRTCCode.PARAMS_ERROR,
24680
24728
  msg: 'params error -> inviterRoomId or inviterUserId',
24681
- }));
24729
+ }), traceId);
24682
24730
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24683
24731
  }
24684
24732
  if (!this._PKInfo[inviterRoomId]) {
24685
- (_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`);
24686
24733
  (_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({
24687
24734
  status: RCLoggerStatus.FAILED,
24688
24735
  code: exports.RCRTCCode.PARAMS_ERROR,
24689
24736
  msg: `User ${inviterUserId} in room ${inviterRoomId} did not send a request for connection`,
24690
- }));
24737
+ }), traceId);
24691
24738
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24692
24739
  }
24693
- (_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 || {})}`);
24694
24740
  const { inviteSessionId, inviterUserAutoMix } = this._PKInfo[inviterRoomId];
24695
24741
  const autoMix = engine.isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24696
24742
  const value = {
@@ -24720,27 +24766,17 @@
24720
24766
  key: `${inviterRoomId}|${this._mainRoomId}`,
24721
24767
  value: JSON.stringify(value),
24722
24768
  };
24723
- (_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)}`);
24724
24769
  const code = yield this._context.responseRoomPK(params);
24725
24770
  if (code !== engine.ErrorCode.SUCCESS) {
24726
- (_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}`);
24727
- (_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({
24771
+ (_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({
24728
24772
  status: RCLoggerStatus.FAILED,
24729
24773
  code,
24730
- msg: '',
24731
- }));
24774
+ }), traceId);
24732
24775
  return { code };
24733
24776
  }
24734
- (_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');
24735
- (_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({
24777
+ (_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({
24736
24778
  status: RCLoggerStatus.SUCCESSED,
24737
- inviterRoomId,
24738
- inviterUserId,
24739
- agree,
24740
- options,
24741
- userId: this._context.getCurrentId(),
24742
- roomId: this._mainRoomId,
24743
- }));
24779
+ }), traceId);
24744
24780
  this._PKInfo[inviterRoomId].inviteeUserAutoMix = autoMix;
24745
24781
  return { code: exports.RCRTCCode.SUCCESS };
24746
24782
  });
@@ -24750,35 +24786,34 @@
24750
24786
  * @roomId 副房间的 roomId
24751
24787
  */
24752
24788
  joinOtherRoom(roomId) {
24753
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
24789
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24754
24790
  return __awaiter(this, void 0, void 0, function* () {
24755
- (_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({
24791
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24792
+ (_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({
24756
24793
  roomId,
24757
- userId: this._context.getCurrentId(),
24758
- }));
24794
+ }), traceId);
24759
24795
  if (!(engine.validate('roomId', roomId, engine.notEmptyString, true))) {
24760
- (_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({
24796
+ (_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({
24761
24797
  status: RCLoggerStatus.FAILED,
24762
24798
  code: exports.RCRTCCode.PARAMS_ERROR,
24763
24799
  msg: 'params error -> roomId',
24764
- }));
24800
+ }), traceId);
24765
24801
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24766
24802
  }
24767
24803
  if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
24768
- (_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({
24804
+ (_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({
24769
24805
  status: RCLoggerStatus.FAILED,
24770
24806
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
24771
24807
  msg: 'IM disconnected',
24772
- }));
24808
+ }), traceId);
24773
24809
  return { code: exports.RCRTCCode.SIGNAL_DISCONNECTED };
24774
24810
  }
24775
- (_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}`);
24776
24811
  if (this._joinedPKRooms[roomId]) {
24777
24812
  (_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({
24778
24813
  status: RCLoggerStatus.FAILED,
24779
24814
  code: exports.RCRTCCode.REPERT_JOIN_ROOM,
24780
24815
  msg: 'Join the room repeatedly',
24781
- }));
24816
+ }), traceId);
24782
24817
  return { code: exports.RCRTCCode.REPERT_JOIN_ROOM };
24783
24818
  }
24784
24819
  const livingType = exports.RCLivingType.VIDEO; // signal 不处理 livingType 故写死 RCLivingType.VIDEO
@@ -24789,23 +24824,18 @@
24789
24824
  const room = new RCLivingRoom(this._context, this._runtime, roomId, this._service, this._initOptions, livingType, false, false, false, this._clientSessionId);
24790
24825
  const { code, data } = yield room.__innerInit(RTCMode.LIVE, undefined, livingType, innerUserData);
24791
24826
  if (code !== exports.RCRTCCode.SUCCESS) {
24792
- (_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}`);
24793
- (_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({
24827
+ (_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({
24794
24828
  status: RCLoggerStatus.FAILED,
24795
24829
  code,
24796
- msg: '',
24797
- }));
24830
+ }), traceId);
24798
24831
  return { code: code };
24799
24832
  }
24800
- (_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)}`);
24801
24833
  // 回调主直播房间,已加入 PK 房间
24802
24834
  this._joinedPKRooms[roomId] = room;
24803
- yield this._onJoinedPKRoom(roomId, room);
24804
- (_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({
24835
+ yield this._onJoinedPKRoom(roomId, traceId);
24836
+ (_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({
24805
24837
  status: RCLoggerStatus.SUCCESSED,
24806
- roomId,
24807
- userId: this._context.getCurrentId(),
24808
- }));
24838
+ }), traceId);
24809
24839
  return {
24810
24840
  room, code: exports.RCRTCCode.SUCCESS, userIds: room.getRemoteUserIds(), tracks: room.getRemoteTracks(),
24811
24841
  };
@@ -24817,8 +24847,11 @@
24817
24847
  * @param isQuitPK 是否要结束连麦
24818
24848
  */
24819
24849
  leaveOtherRoom(room, isQuitPK) {
24850
+ var _a, _b, _c, _d;
24820
24851
  return __awaiter(this, void 0, void 0, function* () {
24821
- return this._invoker.push(this.createLeaveOtherRoomCommand(room, isQuitPK));
24852
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
24853
+ (_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);
24854
+ return this._invoker.push(this.createLeaveOtherRoomCommand(room, isQuitPK, traceId));
24822
24855
  });
24823
24856
  }
24824
24857
  /**
@@ -25102,9 +25135,8 @@
25102
25135
  var _a;
25103
25136
  const { userId } = parseTrackId(resourceId);
25104
25137
  // 是否是主房间资源
25105
- // const isHostRoomResource = !!this._roomResources[userId]?.find(item => getTrackId(item) === resourceId)
25106
25138
  const isHostRoomResource = !!((_a = this._store.getResourcesByUserId(userId)) === null || _a === void 0 ? void 0 : _a.find((item) => getTrackId(item) === resourceId));
25107
- // 是否是主房间资源
25139
+ // 是否是副房间资源
25108
25140
  let isPKRoomResource = false;
25109
25141
  /**
25110
25142
  * 无副房间时,只验证是否为主房间资源
@@ -25136,7 +25168,7 @@
25136
25168
  * 副房间不可调用
25137
25169
  */
25138
25170
  if (!this._store.isMainRoom) {
25139
- (_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');
25171
+ (_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');
25140
25172
  return { code: exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM };
25141
25173
  }
25142
25174
  return this._mcuConfigBuilder;
@@ -25226,7 +25258,7 @@
25226
25258
  * @override
25227
25259
  * 加入 PK 房间回调
25228
25260
  */
25229
- _onJoinedPKRoom(roomId, room) {
25261
+ _onJoinedPKRoom(roomId, traceId) {
25230
25262
  return __awaiter(this, void 0, void 0, function* () {
25231
25263
  /**
25232
25264
  * 加入副房间之后,如果己方发布过资源,且参与连麦,
@@ -25235,8 +25267,7 @@
25235
25267
  this._invoker.push(new ExchangeWithPushOtherRoomCommand(roomId, (pcName) => ({
25236
25268
  pushOtherRooms: this._getPushOtherRoomsParams(),
25237
25269
  headers: this._getRTCReqestHeaders(pcName),
25238
- }), this._roomPKHandler));
25239
- // push(async () => this._onLeavePKRoom(roomId))
25270
+ }), this._roomPKHandler, traceId));
25240
25271
  });
25241
25272
  }
25242
25273
  /**
@@ -25425,7 +25456,7 @@
25425
25456
  this._appListener = null;
25426
25457
  this._crtUserId = this._context.getCurrentId();
25427
25458
  this._service = new RCMediaService(runtime, _context, _initOption.mediaServer);
25428
- this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._crtUserId, this._reTryExchange.bind(this), this._crtUserId, undefined, false, _initOption);
25459
+ this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._crtUserId, this._reTryExchange.bind(this), this._crtUserId, undefined, false, _initOption, true);
25429
25460
  /**
25430
25461
  * 利用 store 存储数据
25431
25462
  */
@@ -25433,7 +25464,6 @@
25433
25464
  this._peerCManager.setStore(this._store);
25434
25465
  }
25435
25466
  _getReqHeaders(livingType) {
25436
- var _a, _b;
25437
25467
  return __awaiter(this, void 0, void 0, function* () {
25438
25468
  // 直播观众端 RoomId 与 UserId 保持一致
25439
25469
  const roomId = this._crtUserId;
@@ -25441,22 +25471,17 @@
25441
25471
  if (!this._rtcToken) {
25442
25472
  const { code, data } = yield this._context.getRTCToken(roomId, RTCMode.LIVE, livingType);
25443
25473
  if (code !== engine.ErrorCode.SUCCESS) {
25444
- (_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}`);
25445
25474
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
25446
25475
  }
25447
25476
  this._rtcToken = data.rtcToken;
25448
25477
  }
25478
+ /**
25479
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
25480
+ */
25481
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
25449
25482
  return {
25450
25483
  code: exports.RCRTCCode.SUCCESS,
25451
- headers: {
25452
- 'App-Key': this._context.getAppkey(),
25453
- UserId: this._crtUserId,
25454
- RoomId: roomId,
25455
- RoomType: RTCMode.LIVE,
25456
- Token: this._rtcToken,
25457
- 'Peer-Connection-Id': this._pcName,
25458
- 'Client-Session-Id': this._clientSessionId,
25459
- },
25484
+ 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),
25460
25485
  };
25461
25486
  });
25462
25487
  }
@@ -25493,7 +25518,7 @@
25493
25518
  });
25494
25519
  }
25495
25520
  __subscribe(liveUrl, livingType, mediaType, subTiny = false) {
25496
- 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;
25521
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
25497
25522
  return __awaiter(this, void 0, void 0, function* () {
25498
25523
  (_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({
25499
25524
  liveUrl,
@@ -25514,8 +25539,7 @@
25514
25539
  !this._fromRetry && ((_e = this._pc) === null || _e === void 0 ? void 0 : _e.clearReTryExchangeTimer());
25515
25540
  this._fromRetry = false;
25516
25541
  if (!engine.isString(liveUrl)) {
25517
- (_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}`);
25518
- (_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({
25542
+ (_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({
25519
25543
  status: RCLoggerStatus.FAILED,
25520
25544
  code: exports.RCRTCCode.PARAMS_ERROR,
25521
25545
  msg: `params error -> liveUrl: ${liveUrl}`,
@@ -25523,8 +25547,8 @@
25523
25547
  return { code: exports.RCRTCCode.PARAMS_ERROR, tracks };
25524
25548
  }
25525
25549
  if (![exports.RCLivingType.AUDIO, exports.RCLivingType.VIDEO].includes(livingType)) {
25526
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.error(`livingType is invalid: ${livingType}`);
25527
- (_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({
25550
+ (_j = (_h = this._context) === null || _h === void 0 ? void 0 : _h.logger) === null || _j === void 0 ? void 0 : _j.error(`livingType is invalid: ${livingType}`);
25551
+ (_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({
25528
25552
  status: RCLoggerStatus.FAILED,
25529
25553
  code: exports.RCRTCCode.PARAMS_ERROR,
25530
25554
  msg: `params error -> livingType: ${livingType}`,
@@ -25532,8 +25556,7 @@
25532
25556
  return { code: exports.RCRTCCode.PARAMS_ERROR, tracks };
25533
25557
  }
25534
25558
  if (![exports.RCMediaType.AUDIO_ONLY, exports.RCMediaType.VIDEO_ONLY, exports.RCMediaType.AUDIO_VIDEO].includes(mediaType)) {
25535
- (_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}`);
25536
- (_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({
25559
+ (_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({
25537
25560
  status: RCLoggerStatus.FAILED,
25538
25561
  code: exports.RCRTCCode.PARAMS_ERROR,
25539
25562
  msg: `params error -> -> mediaType: ${mediaType}`,
@@ -25542,7 +25565,7 @@
25542
25565
  }
25543
25566
  // 允许观众动态切换大小流订阅,或重复订阅同一资源
25544
25567
  if (this._liveUrl && this._liveUrl !== liveUrl) {
25545
- (_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({
25568
+ (_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({
25546
25569
  status: RCLoggerStatus.FAILED,
25547
25570
  code: exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,
25548
25571
  msg: 'repeat subscribe',
@@ -25566,10 +25589,10 @@
25566
25589
  // 构建 http req headers
25567
25590
  const { code, headers } = yield this._getReqHeaders(livingType);
25568
25591
  if (code !== exports.RCRTCCode.SUCCESS) {
25569
- (_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({
25592
+ (_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({
25570
25593
  status: RCLoggerStatus.FAILED,
25571
25594
  code,
25572
- msg: '',
25595
+ msg: 'getRTCToken failed',
25573
25596
  }));
25574
25597
  return { code, tracks };
25575
25598
  }
@@ -25593,25 +25616,21 @@
25593
25616
  };
25594
25617
  const resp = yield this._service.broadcastSubscribe(headers, body);
25595
25618
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
25596
- (_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}`);
25597
- (_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({
25619
+ (_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({
25598
25620
  status: RCLoggerStatus.FAILED,
25599
25621
  code: resp.code,
25600
- msg: `andience subscribe failed: ${resp.code}`,
25601
25622
  }));
25602
25623
  return { code: resp.code, tracks };
25603
25624
  }
25604
25625
  const data = resp.data;
25605
25626
  if (data.resultCode !== exports.RCRTCCode.SUCCESS) {
25606
- (_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}`);
25607
- (_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({
25627
+ (_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({
25608
25628
  status: RCLoggerStatus.FAILED,
25609
25629
  code: data.resultCode,
25610
- msg: `andience subscribe failed! code: ${data.resultCode}; message: ${data.message}`,
25630
+ msg: data.message,
25611
25631
  }));
25612
25632
  return { code: data.resultCode, tracks };
25613
25633
  }
25614
- (_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}`);
25615
25634
  this._livingType = livingType;
25616
25635
  this._mediaType = mediaType;
25617
25636
  this._subTiny = subTiny;
@@ -25630,7 +25649,7 @@
25630
25649
  readyTracks && this._updateTrackIdSSRCMap(answer.sdp, readyTracks);
25631
25650
  // 缓存订阅资源的ssrc和msid
25632
25651
  // AbstractStatParser.formatSourceIdMapFromSdp(answer.sdp, 'subscribe');
25633
- (_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({
25652
+ (_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({
25634
25653
  status: RCLoggerStatus.SUCCESSED,
25635
25654
  liveUrl,
25636
25655
  }));
@@ -25659,7 +25678,7 @@
25659
25678
  });
25660
25679
  }
25661
25680
  __unsubscribe() {
25662
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
25681
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25663
25682
  return __awaiter(this, void 0, void 0, function* () {
25664
25683
  (_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({
25665
25684
  liveUrl: this._liveUrl,
@@ -25678,19 +25697,15 @@
25678
25697
  const { headers } = yield this._getReqHeaders();
25679
25698
  const { code } = yield this._service.broadcastExit(headers);
25680
25699
  if (code !== exports.RCRTCCode.SUCCESS) {
25681
- (_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}`);
25682
- (_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({
25700
+ (_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({
25683
25701
  status: RCLoggerStatus.FAILED,
25684
25702
  code,
25685
- msg: `broadcast unsubscribe failed: ${code}`,
25686
25703
  }));
25687
25704
  }
25688
25705
  else {
25689
- (_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');
25690
- (_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({
25706
+ (_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({
25691
25707
  status: RCLoggerStatus.SUCCESSED,
25692
25708
  liveUrl: this._liveUrl,
25693
- msg: 'broadcast unsubscribe success',
25694
25709
  }));
25695
25710
  this._subscribedList = [];
25696
25711
  }
@@ -25714,16 +25729,17 @@
25714
25729
  this._appListener = listener;
25715
25730
  }
25716
25731
  _onTrackReady(evt) {
25717
- var _a, _b, _c, _d;
25732
+ var _a, _b, _c, _d, _e, _f;
25718
25733
  const { track } = evt.receiver;
25719
25734
  const mediaType = track.kind === 'audio' ? exports.RCMediaType.AUDIO_ONLY : exports.RCMediaType.VIDEO_ONLY;
25720
25735
  const rTrack = this._subTracks[mediaType];
25721
25736
  rTrack.__innerSetMediaStreamTrack(track);
25722
25737
  try {
25723
- (_b = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a.onTrackReady) === null || _b === void 0 ? void 0 : _b.call(_a, rTrack);
25738
+ (_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()}`);
25739
+ (_d = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c.onTrackReady) === null || _d === void 0 ? void 0 : _d.call(_c, rTrack);
25724
25740
  }
25725
25741
  catch (error) {
25726
- (_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));
25742
+ (_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));
25727
25743
  }
25728
25744
  }
25729
25745
  }
@@ -25789,14 +25805,12 @@
25789
25805
  // 北极星数据
25790
25806
  this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this, PolarisRole.Audience);
25791
25807
  this._polarisReport.sendR1();
25792
- this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._crtUserId, this._polarisReport, true, this._initOptions);
25808
+ this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._crtUserId, this._polarisReport, true, this._initOptions, true);
25793
25809
  // 注册监听 rtc_ntf 信令数据,解码后拉取指定房间数据
25794
25810
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
25795
- var _a, _b;
25796
25811
  // 1. 拉取数据,非本房间可不拉取
25797
25812
  // 2. 拉取完成后调用原通知方法 this.singalDataChange(_roomId)
25798
25813
  const { time, type, roomId } = this._context.decodeRtcNotify(buffer);
25799
- (_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 })}`);
25800
25814
  switch (type) {
25801
25815
  case 1:
25802
25816
  // RTC KV拉取
@@ -25813,7 +25827,7 @@
25813
25827
  this._setInitData();
25814
25828
  }
25815
25829
  _startPull(roomId, timestamp) {
25816
- var _a, _b;
25830
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25817
25831
  return __awaiter(this, void 0, void 0, function* () {
25818
25832
  if (this._isPulling) {
25819
25833
  return;
@@ -25824,14 +25838,17 @@
25824
25838
  this._isPulling = false;
25825
25839
  return;
25826
25840
  }
25841
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
25842
+ (_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);
25827
25843
  const { code, data } = yield this._context.pullRTCRoomEntry(roomId);
25828
25844
  if (code === engine.ErrorCode.SUCCESS) {
25829
25845
  this._isPulling = false;
25830
25846
  this._pullTime = data.syncTime || 0;
25831
25847
  const kvEntries = (data === null || data === void 0 ? void 0 : data.kvEntries) || [];
25832
- (_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)}`);
25833
- this.singalDataChange(kvEntries, roomId);
25848
+ (_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);
25849
+ this.singalDataChange(kvEntries, roomId, traceId);
25834
25850
  }
25851
+ (_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);
25835
25852
  });
25836
25853
  }
25837
25854
  /**
@@ -25893,10 +25910,7 @@
25893
25910
  });
25894
25911
  }
25895
25912
  _assertRoomDestroyed() {
25896
- var _a, _b;
25897
25913
  if (this._destroyed) {
25898
- const msg = 'This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.';
25899
- (_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);
25900
25914
  return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED;
25901
25915
  }
25902
25916
  }
@@ -25909,26 +25923,18 @@
25909
25923
  * * key RC_RTC_SESSIONID value: sessionId
25910
25924
  * * key RC_CDN value: CDN 资源数据
25911
25925
  */
25912
- singalDataChange(singalData, roomId) {
25913
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
25914
- (_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({
25915
- singalData,
25916
- roomId,
25917
- userId: this._crtUserId,
25918
- }));
25926
+ singalDataChange(singalData, roomId, traceId) {
25927
+ var _a, _b, _c;
25919
25928
  if (roomId !== this._roomId) {
25920
- (_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}`);
25921
- (_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({
25929
+ (_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({
25922
25930
  status: RCLoggerStatus.FAILED,
25923
- code: '',
25924
- msg: `id inconsistency -> params id:${roomId},current id:${this._roomId}`,
25925
- }));
25931
+ msg: `roomId inconsistency -> params roomId:${roomId}, current roomId:${this._roomId}`,
25932
+ }), traceId);
25926
25933
  return;
25927
25934
  }
25928
- (_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 || {})}`);
25929
25935
  const allMcuUris = [];
25930
- const CDNUrisStr = (_j = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _j === void 0 ? void 0 : _j.value;
25931
- CDNUrisStr && this._diffCDNUris(JSON.parse(JSON.parse(CDNUrisStr).cdn_uris)[0]);
25936
+ const CDNUrisStr = (_c = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _c === void 0 ? void 0 : _c.value;
25937
+ CDNUrisStr && this._diffCDNUris(JSON.parse(JSON.parse(CDNUrisStr).cdn_uris)[0], traceId);
25932
25938
  singalData.forEach((data) => {
25933
25939
  const { key, value, timestamp, uid, } = data;
25934
25940
  const isResKey = key.indexOf('RC_RES_') !== -1;
@@ -25938,7 +25944,7 @@
25938
25944
  const anchorUris = JSON.parse(serverUris.uris || '[]');
25939
25945
  allMcuUris.push(...mcuUris);
25940
25946
  // 处理主播发布的分流资源
25941
- this._diffAnchorResource(anchorUris, uid);
25947
+ this._diffAnchorResource(anchorUris, uid, traceId);
25942
25948
  return;
25943
25949
  }
25944
25950
  // 处理主播列表
@@ -25946,21 +25952,15 @@
25946
25952
  const anchorUserIds = JSON.parse(value || '[]');
25947
25953
  const { joinUserIds, leftUserIds } = this._diffAnchorList(anchorUserIds);
25948
25954
  if (joinUserIds.length > 0) {
25949
- this._handleNewJoinedAnchor(joinUserIds);
25955
+ this._handleNewJoinedAnchor(joinUserIds, traceId);
25950
25956
  }
25951
25957
  if (leftUserIds.length > 0) {
25952
- this._handleLeftedAnchor(leftUserIds);
25958
+ this._handleLeftedAnchor(leftUserIds, traceId);
25953
25959
  }
25954
25960
  }
25955
25961
  });
25956
25962
  // 处理直播间 MCU 合流资源资源
25957
- this._diffRoomResource(allMcuUris);
25958
- (_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({
25959
- status: RCLoggerStatus.SUCCESSED,
25960
- singalData,
25961
- roomId,
25962
- userId: this._crtUserId,
25963
- }));
25963
+ this._diffRoomResource(allMcuUris, traceId);
25964
25964
  }
25965
25965
  /**
25966
25966
  * 计算加入离开的主播 ID 列表
@@ -25973,19 +25973,18 @@
25973
25973
  joinUserIds,
25974
25974
  };
25975
25975
  }
25976
- _handleNewJoinedAnchor(list) {
25976
+ _handleNewJoinedAnchor(list, traceId) {
25977
25977
  var _a, _b;
25978
25978
  // 更新 _roomAnchorList
25979
25979
  this._roomAnchorList.push(...list);
25980
25980
  // 触发 app 主播加入监听
25981
- (_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({
25982
- status: RCLoggerStatus.SUCCESSED,
25981
+ (_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({
25983
25982
  eventType: 'onAnchorJoin',
25984
25983
  list,
25985
- }));
25984
+ }), traceId);
25986
25985
  this._callAppListener('onAnchorJoin', list);
25987
25986
  }
25988
- _handleLeftedAnchor(list) {
25987
+ _handleLeftedAnchor(list, traceId) {
25989
25988
  var _a, _b;
25990
25989
  return __awaiter(this, void 0, void 0, function* () {
25991
25990
  // 更新 _roomAnchorList
@@ -26001,18 +26000,17 @@
26001
26000
  tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
26002
26001
  }
26003
26002
  // 触发 app 主播离开监听
26004
- (_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({
26005
- status: RCLoggerStatus.SUCCESSED,
26003
+ (_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({
26006
26004
  eventType: 'onAnchorLeave',
26007
26005
  list,
26008
- }));
26006
+ }), traceId);
26009
26007
  this._callAppListener('onAnchorLeave', list);
26010
26008
  });
26011
26009
  }
26012
26010
  /**
26013
26011
  * 计算新发布和取消发布的合流资源
26014
26012
  */
26015
- _diffRoomResource(uris) {
26013
+ _diffRoomResource(uris, traceId) {
26016
26014
  var _a, _b;
26017
26015
  return __awaiter(this, void 0, void 0, function* () {
26018
26016
  const newPubTracks = [];
@@ -26048,31 +26046,23 @@
26048
26046
  });
26049
26047
  // 通知 APP 新发布的 tracks
26050
26048
  if (newPubTracks.length > 0) {
26051
- (_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({
26052
- status: RCLoggerStatus.SUCCESSED,
26049
+ (_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({
26053
26050
  eventType: 'onTrackPublish',
26054
26051
  trackIds: newPubTracks.map((track) => track.getTrackId()),
26055
- }));
26052
+ }), traceId);
26056
26053
  this._callAppListener('onTrackPublish', newPubTracks);
26057
26054
  }
26058
26055
  if (unpubTracks.length > 0) {
26059
- this._onUserUnpublish(unpubTracks, 'onTrackUnpublish');
26056
+ this._onUserUnpublish(unpubTracks, 'onTrackUnpublish', traceId);
26060
26057
  }
26061
26058
  });
26062
26059
  }
26063
26060
  /**
26064
26061
  * 计算主播发布和取消发布的资源,以及资源的状态变更
26065
26062
  */
26066
- _diffAnchorResource(uris, userId) {
26067
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26063
+ _diffAnchorResource(uris, userId, traceId) {
26064
+ var _a, _b, _c, _d, _e, _f;
26068
26065
  return __awaiter(this, void 0, void 0, function* () {
26069
- /**
26070
- * 设置房间内 RTC 资源 ssrc 和 trackId map
26071
- */
26072
- uris.forEach((res) => {
26073
- const { ssrc, resourceId } = JSON.parse(res.uri);
26074
- this._store.setTrackIdSSRCMap(ssrc, resourceId);
26075
- });
26076
26066
  // 当前资源清单
26077
26067
  const nowRes = this._roomAnchorRes[userId] || (this._roomAnchorRes[userId] = []);
26078
26068
  const { publishedList, unpublishedList, modifiedList } = diffPublishResources(nowRes, uris);
@@ -26110,17 +26100,19 @@
26110
26100
  // 重新订阅二次发布资源
26111
26101
  if (subedTracks.length) {
26112
26102
  const trackIds = subedTracks.map((item) => item.getTrackId());
26113
- (_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)}`);
26114
26103
  const { code } = yield push(() => this._subscribeHandle(subedTracks, true));
26115
26104
  if (code !== exports.RCRTCCode.SUCCESS) {
26116
- (_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)}`);
26105
+ (_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({
26106
+ status: RCLoggerStatus.FAILED,
26107
+ trackIds,
26108
+ code,
26109
+ }));
26117
26110
  }
26118
26111
  }
26119
- (_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({
26120
- status: RCLoggerStatus.SUCCESSED,
26112
+ (_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({
26121
26113
  eventType: 'onAnchorTrackPublish',
26122
26114
  trackIds: newTracks.map((track) => track.getTrackId()),
26123
- }));
26115
+ }), traceId);
26124
26116
  this._callAppListener('onAnchorTrackPublish', newTracks);
26125
26117
  }
26126
26118
  if (unpublishedList.length) {
@@ -26135,7 +26127,7 @@
26135
26127
  const trackId = getTrackId(item);
26136
26128
  return this._remoteTracks[trackId];
26137
26129
  });
26138
- yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish');
26130
+ yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish', traceId);
26139
26131
  }
26140
26132
  if (modifiedList.length) {
26141
26133
  const resIds = nowRes.map(getTrackId);
@@ -26147,27 +26139,17 @@
26147
26139
  nowRes[index].state = item.state;
26148
26140
  const rTrack = this._remoteTracks[id];
26149
26141
  rTrack.__innerSetRemoteMuted(item.state === 0);
26150
- if (rTrack.isAudioTrack()) {
26151
- (_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({
26152
- status: RCLoggerStatus.SUCCESSED,
26153
- eventType: 'onAudioMuteChange',
26154
- trackId: rTrack.getTrackId(),
26155
- }));
26156
- this._callAppListener('onAudioMuteChange', rTrack);
26157
- }
26158
- else {
26159
- (_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({
26160
- status: RCLoggerStatus.SUCCESSED,
26161
- eventType: 'onVideoMuteChange',
26162
- trackId: rTrack.getTrackId(),
26163
- }));
26164
- this._callAppListener('onVideoMuteChange', rTrack);
26165
- }
26142
+ const eventType = rTrack.isAudioTrack() ? 'onAudioMuteChange' : 'onVideoMuteChange';
26143
+ (_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({
26144
+ eventType,
26145
+ trackId: rTrack.getTrackId(),
26146
+ }), traceId);
26147
+ this._callAppListener(eventType, rTrack);
26166
26148
  }
26167
26149
  }
26168
26150
  });
26169
26151
  }
26170
- _onUserUnpublish(tracks, eventName) {
26152
+ _onUserUnpublish(tracks, eventName, traceId) {
26171
26153
  var _a, _b;
26172
26154
  return __awaiter(this, void 0, void 0, function* () {
26173
26155
  // 需要替业务层取消订阅,业务层只需关注 UI 变化
@@ -26179,18 +26161,16 @@
26179
26161
  delete this._remoteTracks[item.getTrackId()];
26180
26162
  });
26181
26163
  // 通知 APP 取消发布的 tracks
26182
- (_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({
26183
- status: RCLoggerStatus.SUCCESSED,
26164
+ (_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({
26184
26165
  eventType: eventName,
26185
26166
  trackIds: tracks.map((track) => track.getTrackId()),
26186
- }));
26167
+ }), traceId);
26187
26168
  this._callAppListener(eventName, tracks);
26188
26169
  });
26189
26170
  }
26190
26171
  _callAppListener(eventType, ...attrs) {
26191
- var _a, _b, _c, _d, _e;
26192
- (_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)}`);
26193
- const handle = (_c = this._appListener) === null || _c === void 0 ? void 0 : _c[eventType];
26172
+ var _a, _b, _c;
26173
+ const handle = (_a = this._appListener) === null || _a === void 0 ? void 0 : _a[eventType];
26194
26174
  if (!handle) {
26195
26175
  return;
26196
26176
  }
@@ -26198,7 +26178,7 @@
26198
26178
  handle(...attrs);
26199
26179
  }
26200
26180
  catch (error) {
26201
- (_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));
26181
+ (_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));
26202
26182
  }
26203
26183
  }
26204
26184
  /**
@@ -26207,17 +26187,15 @@
26207
26187
  _reTryExchange() {
26208
26188
  return __awaiter(this, void 0, void 0, function* () {
26209
26189
  push(() => __awaiter(this, void 0, void 0, function* () {
26210
- var _a, _b, _c, _d, _e;
26190
+ var _a;
26211
26191
  const { reqBody } = yield this._createSubscribeParams(this._subscribedList, {}, true);
26212
26192
  // 发送 /exchange 请求
26213
26193
  const resp = yield this._exchangeHandle(reqBody);
26214
26194
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
26215
- (_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}`);
26216
26195
  return { code: resp.code };
26217
26196
  }
26218
26197
  const { sdp: answer, resultCode } = resp.data;
26219
26198
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
26220
- (_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}`);
26221
26199
  return { code: resultCode };
26222
26200
  }
26223
26201
  // 请求成功,清除 ice 断线重连的定时器
@@ -26225,7 +26203,7 @@
26225
26203
  const mcuSubList = this._subscribedList.filter((item) => item.track.isMCUTrack());
26226
26204
  if (mcuSubList.length > 0) {
26227
26205
  const mcuTrackId = mcuSubList[0].track.getTrackId();
26228
- const sdpMsid = (_e = this._roomRes[mcuTrackId]) === null || _e === void 0 ? void 0 : _e.msid;
26206
+ const sdpMsid = (_a = this._roomRes[mcuTrackId]) === null || _a === void 0 ? void 0 : _a.msid;
26229
26207
  const currentMsid = [this._roomId, 'RongCloudRTC'].join('_');
26230
26208
  answer.sdp = answer.sdp.replace(new RegExp(sdpMsid, 'g'), currentMsid);
26231
26209
  }
@@ -26292,23 +26270,28 @@
26292
26270
  });
26293
26271
  }
26294
26272
  _subscribeHandle(tracks, forceReq = false) {
26295
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26273
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26296
26274
  return __awaiter(this, void 0, void 0, function* () {
26275
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26276
+ (_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({
26277
+ trackIds: tracks.map(getTrackIdFromAttr),
26278
+ forceReq,
26279
+ }), traceId);
26297
26280
  const roomStatusCode = this._assertRoomDestroyed();
26298
26281
  if (roomStatusCode) {
26299
- (_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({
26282
+ (_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({
26300
26283
  status: RCLoggerStatus.FAILED,
26301
26284
  code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26302
26285
  msg: 'room destroyed',
26303
- }));
26286
+ }), traceId);
26304
26287
  return { code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26305
26288
  }
26306
26289
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
26307
- (_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({
26290
+ (_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({
26308
26291
  status: RCLoggerStatus.FAILED,
26309
26292
  code: exports.RCRTCCode.PARAMS_ERROR,
26310
26293
  msg: 'params error -> tracks',
26311
- }));
26294
+ }), traceId);
26312
26295
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26313
26296
  }
26314
26297
  const { pc, pcName } = this._peerCManager.createPeerCList(tracks)[0];
@@ -26339,23 +26322,15 @@
26339
26322
  trackChanged = true;
26340
26323
  });
26341
26324
  if (!trackChanged && !forceReq) {
26342
- (_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({
26343
- status: RCLoggerStatus.FAILED,
26344
- code: '',
26325
+ (_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({
26326
+ status: RCLoggerStatus.SUCCESSED,
26345
26327
  msg: 'repeat subscribe',
26346
- }));
26328
+ }), traceId);
26347
26329
  return { code: exports.RCRTCCode.SUCCESS };
26348
26330
  }
26349
26331
  // 北极星上报
26350
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26351
- (_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({
26352
- status: RCLoggerStatus.SUCCESSED,
26353
- trackIds: tracks.map(getTrackIdFromAttr),
26354
- roomId: this._roomId,
26355
- userId: this._crtUserId,
26356
- forceReq,
26357
- }));
26358
- return this._updateSubListHandle(crtSubList, true);
26332
+ (_l = this._polarisReport) === null || _l === void 0 ? void 0 : _l.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26333
+ return this._updateSubListHandle(crtSubList, true, traceId);
26359
26334
  });
26360
26335
  }
26361
26336
  /**
@@ -26369,12 +26344,11 @@
26369
26344
  const trackId = [msid, track.kind === 'audio' ? exports.RCMediaType.AUDIO_ONLY : exports.RCMediaType.VIDEO_ONLY].join('_');
26370
26345
  const rTrack = this._remoteTracks[trackId];
26371
26346
  if (!rTrack) {
26372
- (_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}`);
26347
+ (_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}`);
26373
26348
  return;
26374
26349
  }
26375
26350
  rTrack.__innerSetMediaStreamTrack(track);
26376
- (_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({
26377
- status: RCLoggerStatus.SUCCESSED,
26351
+ (_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({
26378
26352
  eventType: 'onTrackReady',
26379
26353
  trackId: rTrack.getTrackId(),
26380
26354
  }));
@@ -26383,31 +26357,23 @@
26383
26357
  }
26384
26358
  _getReqHeaders() {
26385
26359
  const userId = this._crtUserId;
26360
+ /**
26361
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
26362
+ */
26363
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
26386
26364
  // 直播观众端 RoomId 与 UserId 保持一致
26387
- return {
26388
- 'App-Key': this._context.getAppkey(),
26389
- RoomId: userId,
26390
- Token: this._joinResData.token,
26391
- RoomType: RTCMode.LIVE,
26392
- UserId: userId,
26393
- 'Session-Id': this._sessionId,
26394
- 'Peer-Connection-Id': this._pcName,
26395
- 'Client-Session-Id': this._clientSessionId,
26396
- };
26365
+ 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);
26397
26366
  }
26398
26367
  _exchangeHandle(body) {
26399
26368
  return this._service.broadcastSubscribe(this._getReqHeaders(), body);
26400
26369
  }
26401
- _updateSubListHandle(tracks, forceReq = false) {
26402
- var _a, _b, _c, _d, _e;
26370
+ _updateSubListHandle(tracks, forceReq = false, traceId) {
26371
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26403
26372
  return __awaiter(this, void 0, void 0, function* () {
26404
- const roomStatusCode = this._assertRoomDestroyed();
26405
- if (roomStatusCode) {
26406
- return { code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26407
- }
26408
- if (!engine.validate('resources', tracks, () => engine.isArray(tracks) && tracks.every((res) => res instanceof RCRemoteTrack || res.track instanceof RCRemoteTrack), true)) {
26409
- return { code: exports.RCRTCCode.PARAMS_ERROR };
26410
- }
26373
+ (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T, JSON.stringify({
26374
+ trackIds: tracks.map(getTrackIdFromAttr),
26375
+ forceReq,
26376
+ }), traceId);
26411
26377
  let attrs = tracks.map((item) => (item instanceof RCRemoteTrack ? { track: item } : Object.assign({}, item)));
26412
26378
  // resourceId 去重,并做数据深拷贝
26413
26379
  const map = {};
@@ -26442,6 +26408,10 @@
26442
26408
  changed = true;
26443
26409
  }
26444
26410
  if (!changed) {
26411
+ (_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({
26412
+ status: RCLoggerStatus.SUCCESSED,
26413
+ msg: 'repeat subscribe',
26414
+ }), traceId);
26445
26415
  return { code: exports.RCRTCCode.SUCCESS };
26446
26416
  }
26447
26417
  }
@@ -26451,12 +26421,6 @@
26451
26421
  // 连通率相关埋点-订阅开始
26452
26422
  recordQualitySubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26453
26423
  recordQualityUnsubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26454
- (_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({
26455
- trackIds: tracks.map(getTrackIdFromAttr),
26456
- roomId: this._roomId,
26457
- userId: this._crtUserId,
26458
- forceReq,
26459
- }));
26460
26424
  // MediaServer 交互
26461
26425
  const { reqBody } = yield this._createSubscribeParams(attrs, {}, false);
26462
26426
  const result = yield this._exchangeHandle(reqBody);
@@ -26466,16 +26430,24 @@
26466
26430
  crtSubList.forEach((item) => {
26467
26431
  resourceIds.push(item.track.getTrackId());
26468
26432
  });
26469
- (_c = this._pc.reportParser) === null || _c === void 0 ? void 0 : _c.clearLatestPacketsRecv(resourceIds);
26433
+ (_d = this._pc.reportParser) === null || _d === void 0 ? void 0 : _d.clearLatestPacketsRecv(resourceIds);
26470
26434
  }
26471
26435
  if (result.code !== exports.RCRTCCode.SUCCESS) {
26472
26436
  reportQualitySubscribeAndUnsubscribeData(attrs, result.code);
26437
+ (_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({
26438
+ status: RCLoggerStatus.FAILED,
26439
+ code: result.code,
26440
+ }), traceId);
26473
26441
  return { code: result.code };
26474
26442
  }
26475
26443
  const { sdp: answer, resultCode, message, subscribedList, } = result.data;
26476
26444
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
26477
26445
  reportQualitySubscribeAndUnsubscribeData(attrs, resultCode);
26478
- (_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}`);
26446
+ (_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({
26447
+ status: RCLoggerStatus.FAILED,
26448
+ code: resultCode,
26449
+ msg: message,
26450
+ }), traceId);
26479
26451
  return { code: resultCode };
26480
26452
  }
26481
26453
  // 修改 answer.sdp 中 msid
@@ -26491,6 +26463,11 @@
26491
26463
  const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
26492
26464
  if (resCode !== exports.RCRTCCode.SUCCESS) {
26493
26465
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
26466
+ (_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({
26467
+ status: RCLoggerStatus.FAILED,
26468
+ code: resCode,
26469
+ msg: 'set remote answer error',
26470
+ }), traceId);
26494
26471
  return { code: resCode };
26495
26472
  }
26496
26473
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
@@ -26513,6 +26490,11 @@
26513
26490
  }
26514
26491
  // 更新本地订阅关系
26515
26492
  this._subscribedList.splice(0, this._subscribedList.length, ...subSuccessList);
26493
+ (_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({
26494
+ status: RCLoggerStatus.SUCCESSED,
26495
+ subSuccessTrackIds,
26496
+ failedList,
26497
+ }), traceId);
26516
26498
  return failedList.length ? { code: exports.RCRTCCode.SUCCESS, failedList } : { code: exports.RCRTCCode.SUCCESS };
26517
26499
  });
26518
26500
  }
@@ -26520,17 +26502,16 @@
26520
26502
  * 对比 cdn_uris 资源
26521
26503
  * @param newCDNUris 新的 cdn_uris 数据
26522
26504
  */
26523
- _diffCDNUris(newCDNUris) {
26505
+ _diffCDNUris(newCDNUris, traceId) {
26524
26506
  var _a, _b, _c, _d, _e, _f;
26525
26507
  return __awaiter(this, void 0, void 0, function* () {
26526
26508
  /**
26527
26509
  * CDN 资源减少: 上次 CDNUris 中有 url,变更后无 url
26528
26510
  */
26529
26511
  if (this._CDNUris.url && !newCDNUris.url) {
26530
- (_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({
26531
- status: RCLoggerStatus.SUCCESSED,
26512
+ (_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({
26532
26513
  eventType: 'onCDNInfoDisable',
26533
- }));
26514
+ }), traceId);
26534
26515
  this._callAppListener('onCDNInfoDisable');
26535
26516
  /**
26536
26517
  * 更新内存中存储的 cdn_uris 数据
@@ -26544,12 +26525,11 @@
26544
26525
  * 上次 CDNUris 无 url,变更后有 url
26545
26526
  */
26546
26527
  if (!this._CDNUris || (!this._CDNUris.url && newCDNUris.url)) {
26547
- (_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({
26548
- status: RCLoggerStatus.SUCCESSED,
26528
+ (_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({
26549
26529
  eventType: 'onCDNInfoEnable',
26550
26530
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26551
26531
  fps: `FPS_${newCDNUris.fps}`,
26552
- }));
26532
+ }), traceId);
26553
26533
  this._callAppListener('onCDNInfoEnable', {
26554
26534
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26555
26535
  fps: `FPS_${newCDNUris.fps}`,
@@ -26562,12 +26542,11 @@
26562
26542
  const isHChange = (this._CDNUris.h && newCDNUris.h && (this._CDNUris.h !== newCDNUris.h));
26563
26543
  const isFpsChange = (this._CDNUris.fps && newCDNUris.fps && (this._CDNUris.fps !== newCDNUris.fps));
26564
26544
  if (isWChange || isHChange || isFpsChange) {
26565
- (_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({
26566
- status: RCLoggerStatus.SUCCESSED,
26545
+ (_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({
26567
26546
  eventType: 'onCDNInfoChange',
26568
26547
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26569
26548
  fps: `FPS_${newCDNUris.fps}`,
26570
- }));
26549
+ }), traceId);
26571
26550
  this._callAppListener('onCDNInfoChange', {
26572
26551
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26573
26552
  fps: `FPS_${newCDNUris.fps}`,
@@ -26584,14 +26563,18 @@
26584
26563
  * _CDNUris 无 url 时,说明未开启 CDN 推送
26585
26564
  * @returns CDNPlayUrl
26586
26565
  */
26587
- _getCDNPlayUrl(params) {
26588
- var _a, _b, _c, _d, _e, _f;
26566
+ _getCDNPlayUrl(params, traceId) {
26567
+ var _a, _b;
26589
26568
  return __awaiter(this, void 0, void 0, function* () {
26590
26569
  const { w, h, fps } = params;
26591
26570
  const kind = this._initOptions.pullInnerCDNProtocol || exports.RCInnerCDNPullKind.FLV;
26592
26571
  const useHttps = (this._initOptions.pullInnerCDNUseHttps === exports.RCInnerCDNPullIsHttps.NOT_HTTPS) ? exports.RCInnerCDNPullIsHttps.NOT_HTTPS : exports.RCInnerCDNPullIsHttps.HTTPS;
26593
26572
  if (!this._CDNUris.url) {
26594
- (_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: ${exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY}`);
26573
+ (_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({
26574
+ status: RCLoggerStatus.FAILED,
26575
+ code: exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,
26576
+ msg: 'cdn_uris url is empty, the anchor need to open or push CDN',
26577
+ }), traceId);
26595
26578
  return { code: exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY };
26596
26579
  }
26597
26580
  const headers = {
@@ -26620,12 +26603,10 @@
26620
26603
  const paramsStr = paramsArr.join('&');
26621
26604
  let requestUrl = `${this._CDNUris.url}?`;
26622
26605
  paramsStr && (requestUrl += paramsStr);
26623
- const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl);
26606
+ const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl, traceId);
26624
26607
  if (code !== exports.RCRTCCode.SUCCESS) {
26625
- (_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}`);
26626
26608
  return { code };
26627
26609
  }
26628
- (_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}`);
26629
26610
  return {
26630
26611
  code,
26631
26612
  CDNPlayUrl: res === null || res === void 0 ? void 0 : res.data.pull_url,
@@ -26637,28 +26618,27 @@
26637
26618
  * @returns CDNPlayUrl
26638
26619
  */
26639
26620
  getCDNPlayUrl(resolution, fps) {
26640
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26621
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26641
26622
  return __awaiter(this, void 0, void 0, function* () {
26642
- (_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({
26623
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26624
+ (_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({
26643
26625
  resolution,
26644
26626
  fps,
26645
- }));
26627
+ }), traceId);
26646
26628
  if (resolution && !isValidResolution(resolution)) {
26647
- (_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');
26648
26629
  (_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({
26649
26630
  status: RCLoggerStatus.FAILED,
26650
26631
  code: exports.RCRTCCode.PARAMS_ERROR,
26651
26632
  msg: 'params error -> resolution',
26652
- }));
26633
+ }), traceId);
26653
26634
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26654
26635
  }
26655
26636
  if (fps && !isValidFPS(fps)) {
26656
- (_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');
26657
- (_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({
26637
+ (_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({
26658
26638
  status: RCLoggerStatus.FAILED,
26659
26639
  code: exports.RCRTCCode.PARAMS_ERROR,
26660
26640
  msg: 'params error -> fps',
26661
- }));
26641
+ }), traceId);
26662
26642
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26663
26643
  }
26664
26644
  const { width, height } = resolution ? transResolution(resolution) : { width: null, height: null };
@@ -26667,12 +26647,7 @@
26667
26647
  width && (params.w = width);
26668
26648
  height && (params.h = height);
26669
26649
  fpsNum && (params.fps = fpsNum);
26670
- (_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({
26671
- status: RCLoggerStatus.SUCCESSED,
26672
- resolution,
26673
- fps,
26674
- }));
26675
- return this._getCDNPlayUrl(params);
26650
+ return this._getCDNPlayUrl(params, traceId);
26676
26651
  });
26677
26652
  }
26678
26653
  /**
@@ -26695,33 +26670,34 @@
26695
26670
  __unsubscribe(tracks) {
26696
26671
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26697
26672
  return __awaiter(this, void 0, void 0, function* () {
26698
- (_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({
26673
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26674
+ (_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({
26699
26675
  trackIds: tracks.map((track) => track.getTrackId()),
26700
- roomId: this._roomId,
26701
- userId: this._crtUserId,
26702
- }));
26703
- if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26704
- (_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}`);
26676
+ }), traceId);
26677
+ const roomStatusCode = this._assertRoomDestroyed();
26678
+ if (roomStatusCode) {
26705
26679
  (_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({
26680
+ status: RCLoggerStatus.FAILED,
26681
+ code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26682
+ msg: 'room destroyed',
26683
+ }), traceId);
26684
+ return { code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26685
+ }
26686
+ if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26687
+ (_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({
26706
26688
  status: RCLoggerStatus.FAILED,
26707
26689
  code: exports.RCRTCCode.PARAMS_ERROR,
26708
26690
  msg: 'params error -> tracks',
26709
- }));
26691
+ }), traceId);
26710
26692
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26711
26693
  }
26712
26694
  // 计算剩余订阅列表
26713
26695
  const crtSubList = this._subscribedList.map((item) => (Object.assign({}, item)))
26714
26696
  .filter((item) => !tracks.includes(item.track));
26715
26697
  // 北极星上报
26716
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26717
- (_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({
26718
- status: RCLoggerStatus.SUCCESSED,
26719
- trackIds: tracks.map((track) => track.getTrackId()),
26720
- roomId: this._roomId,
26721
- userId: this._crtUserId,
26722
- }));
26698
+ (_j = this._polarisReport) === null || _j === void 0 ? void 0 : _j.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26723
26699
  recordUnsubscribeCommand(true);
26724
- return this._updateSubListHandle(crtSubList, false);
26700
+ return this._updateSubListHandle(crtSubList, false, traceId);
26725
26701
  });
26726
26702
  }
26727
26703
  /**
@@ -26792,15 +26768,18 @@
26792
26768
  * 断线重连后处理逻辑, SDK 内部处理调用
26793
26769
  */
26794
26770
  __onReconnected() {
26795
- var _a, _b;
26771
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26796
26772
  return __awaiter(this, void 0, void 0, function* () {
26797
26773
  /**
26798
26774
  * 重新加入房间后,从头拉取全量资源
26799
26775
  */
26776
+ const traceId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
26777
+ (_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);
26800
26778
  const { code } = yield this._context.joinLivingRoomAsAudience(this._roomId, RTCMode.LIVE);
26801
26779
  if (code !== engine.ErrorCode.SUCCESS) {
26802
- (_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');
26780
+ (_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);
26803
26781
  }
26782
+ (_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);
26804
26783
  });
26805
26784
  }
26806
26785
  /**
@@ -26820,8 +26799,7 @@
26820
26799
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
26821
26800
  this._audioLevelReport = new RCAudioLevelReport(this);
26822
26801
  this._audioLevelReport.onAudioLevelChange(handler, gap || 1000);
26823
- (_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({
26824
- status: RCLoggerStatus.SUCCESSED,
26802
+ (_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({
26825
26803
  handler: handler === null || handler === void 0 ? void 0 : handler.name,
26826
26804
  gap,
26827
26805
  }));
@@ -28100,7 +28078,7 @@
28100
28078
  }
28101
28079
  reportSDKInfo() {
28102
28080
  this._context.reportSDKInfo({
28103
- 'plugin-rtc': "5.6.3-alpha.3",
28081
+ 'plugin-rtc': "5.6.3-alpha.5",
28104
28082
  });
28105
28083
  }
28106
28084
  }
@@ -28722,15 +28700,19 @@ message probuf {
28722
28700
  * @param valueInfo 全量资源数据
28723
28701
  * @param objectName 全量 URI 消息名
28724
28702
  */
28725
- setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28703
+ setRTCTotalRes(roomId, messageList, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28726
28704
  return __awaiter(this, void 0, void 0, function* () {
28727
28705
  const params = {
28728
28706
  objectName,
28729
- content: this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true),
28707
+ content: [],
28730
28708
  valueInfo: [
28731
28709
  this.codec.encode(RTCPB.RtcValueInfo, { key: 'uris', value: valueInfo }, true),
28732
28710
  ],
28733
28711
  };
28712
+ messageList.forEach((message) => {
28713
+ const encodeData = this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true);
28714
+ params.content.push(encodeData);
28715
+ });
28734
28716
  mcuValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true));
28735
28717
  cdnValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'cdn_uris', value: cdnValInfo }, true));
28736
28718
  const sourceData = this.codec.encode(RTCPB.RtcUserSetDataInput, params);
@@ -29089,7 +29071,7 @@ message probuf {
29089
29071
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
29090
29072
  return false;
29091
29073
  }
29092
- engine.VersionManage.add('plugin-rtc', "5.6.3-alpha.3");
29074
+ engine.VersionManage.add('plugin-rtc', "5.6.3-alpha.5");
29093
29075
  if (!engine.VersionManage.validEngine("^5.6.0")) {
29094
29076
  console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
29095
29077
  return false;
@@ -29103,8 +29085,8 @@ message probuf {
29103
29085
  RTCLogger.setLogger(originLogger);
29104
29086
  logger.setLogger(originLogger);
29105
29087
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
29106
- 'RCRTC Version': "5.6.3-alpha.3",
29107
- Commit: "db726c933e72872baf32689bc9690c7a34f2bab2",
29088
+ 'RCRTC Version': "5.6.3-alpha.5",
29089
+ Commit: "48fe4c6914037db2dfd263f31aba741834041487",
29108
29090
  'browserInfo.browser': browserInfo.browser,
29109
29091
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
29110
29092
  'browserInfo.version': browserInfo.version,