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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.6.3-alpha.2
3
- * CommitId - 2fda2b34be0736183519f005f2d4157acd8a3161
4
- * Sun Nov 13 2022 12:38:30 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.6.3-alpha.5
3
+ * CommitId - 48fe4c6914037db2dfd263f31aba741834041487
4
+ * Wed Nov 16 2022 17:24:53 GMT+0800 (中国标准时间)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  (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,9 +987,29 @@
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";
997
+ /**
998
+ * 队列任务插入
999
+ */
1000
+ RCLoggerTag["L_INVOKER_PUSH_O"] = "L-invoker_push-O";
1001
+ /**
1002
+ * 队列任务开始执行
1003
+ */
1004
+ RCLoggerTag["L_INVOKER_EXECUTE_T"] = "L-invoker_execute-T";
1005
+ /**
1006
+ * 队列任务执行结束
1007
+ */
1008
+ RCLoggerTag["L_INVOKER_EXECUTE_R"] = "L-invoker_execute-R";
1009
+ /**
1010
+ * 销毁队列事件
1011
+ */
1012
+ RCLoggerTag["L_INVOKER_DESTROY_O"] = "L-invoker_destroy-R";
967
1013
  })(RCLoggerTag || (RCLoggerTag = {}));
968
1014
  var RCLoggerStatus;
969
1015
  (function (RCLoggerStatus) {
@@ -7167,7 +7213,6 @@
7167
7213
  */
7168
7214
  changed && this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, this, resolve);
7169
7215
  (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_LOCAL_TRACK_SET_LOCAL_MUTED_O, JSON.stringify({
7170
- status: RCLoggerStatus.SUCCESSED,
7171
7216
  enable: bool,
7172
7217
  trackId: this._id,
7173
7218
  }));
@@ -14759,7 +14804,7 @@
14759
14804
  'Content-Type': 'application/json;charset=UTF-8',
14760
14805
  'Cache-Control': 'no-cache',
14761
14806
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
14762
- ClientVersion: "5.6.3-alpha.2",
14807
+ ClientVersion: "5.6.3-alpha.5",
14763
14808
  'Client-Session-Id': getUUID(),
14764
14809
  'Request-Id': Date.now().toString(),
14765
14810
  });
@@ -14784,8 +14829,6 @@
14784
14829
  timeout: PING_REQ_TIMEOUT,
14785
14830
  method: engine.HttpMethod.POST,
14786
14831
  });
14787
- const logger = RTCLogger.getLogger();
14788
- logger === null || logger === void 0 ? void 0 : logger.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `ping res => ${JSON.stringify({ status: res.status, host })}`);
14789
14832
  if (res.status === 200) {
14790
14833
  pingRes.push(host.clusterId);
14791
14834
  }
@@ -14810,7 +14853,7 @@
14810
14853
  }
14811
14854
  catch (error) {
14812
14855
  const logger = RTCLogger.getLogger();
14813
- 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}`);
14814
14857
  return '';
14815
14858
  }
14816
14859
  if (voipInfo.strategy === 0) {
@@ -15337,7 +15380,7 @@
15337
15380
  'Content-Type': 'application/json;charset=UTF-8',
15338
15381
  'Cache-Control': 'no-cache',
15339
15382
  ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
15340
- ClientVersion: "5.6.3-alpha.2",
15383
+ ClientVersion: "5.6.3-alpha.5",
15341
15384
  'Client-Session-Id': getUUID(),
15342
15385
  'Request-Id': Date.now().toString(),
15343
15386
  });
@@ -15382,7 +15425,6 @@
15382
15425
  }
15383
15426
  }
15384
15427
  detectorMediaSever() {
15385
- var _a, _b;
15386
15428
  const naviInfo = this._context.getNaviInfo();
15387
15429
  RCMediaService.jwtToken = (naviInfo === null || naviInfo === void 0 ? void 0 : naviInfo.jwt) || '';
15388
15430
  // 如果有传入自定义 MediaServer 地址不走探测逻辑
@@ -15392,7 +15434,6 @@
15392
15434
  const nowDate = Date.now();
15393
15435
  const isValid = (RCMediaService.detectValidMinute + RCMediaService.detectorTime > nowDate);
15394
15436
  RCMediaService.isDetector = isValid;
15395
- (_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)}`);
15396
15437
  if (!isValid && naviInfo && engine.notEmptyObject(naviInfo)) {
15397
15438
  this._msList = [];
15398
15439
  this._getDetectorUrls(naviInfo);
@@ -15404,7 +15445,6 @@
15404
15445
  * 拿不到等 IM 链接成功后,再回调中调用开始嗅探
15405
15446
  */
15406
15447
  _getDetectorUrls(naviInfo) {
15407
- var _a, _b, _c, _d;
15408
15448
  return __awaiter(this, void 0, void 0, function* () {
15409
15449
  if (RCMediaService.isDetector) {
15410
15450
  return;
@@ -15419,8 +15459,6 @@
15419
15459
  RCMediaService.msInDetector = fastMediaUrl || [];
15420
15460
  RCMediaService.detectorTime = Date.now();
15421
15461
  RCMediaService.detectValidMinute = clientDetectMinute * 60 * 1000;
15422
- (_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}`);
15423
- (_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}`);
15424
15462
  });
15425
15463
  }
15426
15464
  getNaviMS() {
@@ -15438,20 +15476,18 @@
15438
15476
  * ping1 :ping 结果返回最快值
15439
15477
  */
15440
15478
  setMediaServiceList() {
15441
- var _a, _b, _c, _d, _e, _f, _g, _h;
15479
+ var _a, _b;
15442
15480
  let backupMsInDetector = [];
15443
15481
  let backupMsInNavi = [];
15444
15482
  if (this._clusterId) {
15445
15483
  this._clusterId = this._clusterId.replace(/^(https?:\/\/)?/, 'https://');
15446
15484
  this._msList.push(this._clusterId);
15447
15485
  }
15448
- (_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}`);
15449
15486
  if (engine.notEmptyArray(RCMediaService.msInDetector)) {
15450
15487
  RCMediaService.msInDetector = RCMediaService.msInDetector.map((item) => item.replace(/^(https?:\/\/)?/, 'https://'));
15451
15488
  this._msList.push(RCMediaService.msInDetector[0]);
15452
15489
  backupMsInDetector = RCMediaService.msInDetector.concat().splice(1, RCMediaService.msInDetector.length - 1);
15453
15490
  }
15454
- (_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)}`);
15455
15491
  if (this._msInNavi.length === 0) {
15456
15492
  if (this._failedMs.length === 0) {
15457
15493
  this._msInNavi.push(...parseNaviInfo(this._context.getNaviInfo()));
@@ -15461,12 +15497,11 @@
15461
15497
  this._failedMs.length = 0;
15462
15498
  }
15463
15499
  }
15464
- (_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)}`);
15465
15500
  backupMsInNavi = this._msInNavi.concat().splice(1, this._msInNavi.length - 1);
15466
15501
  this._msList.push(this._msInNavi[0]);
15467
15502
  this._msList = [...this._msList, ...backupMsInDetector, ...backupMsInNavi];
15468
15503
  this._msList = [...new Set(this._msList)];
15469
- (_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)}`);
15470
15505
  return this._msList;
15471
15506
  }
15472
15507
  /**
@@ -15545,7 +15580,6 @@
15545
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({
15546
15581
  status: RCLoggerStatus.SUCCESSED,
15547
15582
  url,
15548
- reqId,
15549
15583
  }), traceId);
15550
15584
  return { code: exports.RCRTCCode.SUCCESS, data: resp };
15551
15585
  }
@@ -15652,13 +15686,13 @@
15652
15686
  /**
15653
15687
  * 房间内观众获取 CDN 资源信息、拉流地址
15654
15688
  */
15655
- getCDNResourceInfo(headers, url) {
15689
+ getCDNResourceInfo(headers, url, traceId) {
15656
15690
  var _a, _b, _c, _d, _e, _f;
15657
15691
  return __awaiter(this, void 0, void 0, function* () {
15658
15692
  const commonHeader = getCommonHeader();
15659
15693
  const mergeHeaders = Object.assign(Object.assign({}, commonHeader), headers);
15660
15694
  const reqId = commonHeader['Request-Id'];
15661
- (_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);
15662
15696
  const { status, data: resStr } = yield this._runtime.httpReq({
15663
15697
  url,
15664
15698
  headers: mergeHeaders,
@@ -15668,15 +15702,14 @@
15668
15702
  const data = JSON.parse(resStr);
15669
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({
15670
15704
  status: RCLoggerStatus.SUCCESSED,
15671
- reqId: commonHeader['Request-Id'],
15672
- }));
15705
+ cdnPlayerUrl: data === null || data === void 0 ? void 0 : data.data.pull_url,
15706
+ }), traceId);
15673
15707
  return { code: data.resultCode, res: data };
15674
15708
  }
15675
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({
15676
15710
  status: RCLoggerStatus.FAILED,
15677
15711
  code: exports.RCRTCCode.REQUEST_FAILED,
15678
- msg: `request error -> Request-Id: ${commonHeader['Request-Id']}, status: ${status}, url: ${url}`,
15679
- }));
15712
+ }), traceId);
15680
15713
  return { code: exports.RCRTCCode.REQUEST_FAILED };
15681
15714
  });
15682
15715
  }
@@ -16867,11 +16900,6 @@
16867
16900
  * @param {IRCTrackBitrate} bitrate - 以 kbps 为单位的比特率。
16868
16901
  */
16869
16902
  setAudiosBitrate(bitrate) {
16870
- var _a;
16871
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16872
- bitrate,
16873
- msg: 'SDP setAudiosBitrate',
16874
- }));
16875
16903
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => this.setAudioItemBitrate(sdpAudioBlock, bitrate));
16876
16904
  return this;
16877
16905
  }
@@ -16881,12 +16909,6 @@
16881
16909
  * @param {string} streamId - 音频流的媒体流 ID。
16882
16910
  */
16883
16911
  setAudioBitrateWithStreamId(bitrate, streamId) {
16884
- var _a;
16885
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16886
- bitrate,
16887
- streamId,
16888
- msg: 'SDP setAudioBitrateWithStreamId',
16889
- }));
16890
16912
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16891
16913
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16892
16914
  // 判断 msid 是否存在
@@ -16903,12 +16925,6 @@
16903
16925
  * @param {string} mid - 音频流的媒体流 ID。
16904
16926
  */
16905
16927
  setAudioBitrateWithMid(bitrate, mid) {
16906
- var _a;
16907
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16908
- bitrate,
16909
- mid,
16910
- msg: 'SDP setAudioBitrateWithMid',
16911
- }));
16912
16928
  this.audioStreams = this.audioStreams.map((sdpAudioBlock) => {
16913
16929
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
16914
16930
  // 判断 msid 是否存在
@@ -16957,11 +16973,6 @@
16957
16973
  * @param bitrate
16958
16974
  */
16959
16975
  setVideosBitrate(bitrate) {
16960
- var _a;
16961
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16962
- bitrate,
16963
- msg: 'SDP setVideosBitrate',
16964
- }));
16965
16976
  // 找到 profile-level-id 行在后面添加 ;x-google--bitrate ;x-google--bitrate=
16966
16977
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => this.setVideoItemBitrate(sdpVideoBlock, bitrate));
16967
16978
  return this;
@@ -16972,12 +16983,6 @@
16972
16983
  * @param {string} streamId - 媒体流 ID。
16973
16984
  */
16974
16985
  setVideoBitrateWithStreamId(bitrate, streamId) {
16975
- var _a;
16976
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16977
- bitrate,
16978
- streamId,
16979
- msg: 'SDP setVideoBitrateWithStreamId',
16980
- }));
16981
16986
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
16982
16987
  const testStreamId = new RegExp(`\\bmsid:${streamId}\\b`, 'ig');
16983
16988
  if (testStreamId.test(sdpVideoBlock)) {
@@ -16993,12 +16998,6 @@
16993
16998
  * @param {string} streamId - 媒体流 ID。
16994
16999
  */
16995
17000
  setVideoBitrateWithMid(bitrate, mid) {
16996
- var _a;
16997
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_SDP_BITRATE_O, JSON.stringify({
16998
- bitrate,
16999
- mid,
17000
- msg: 'SDP setVideoBitrateWithMid',
17001
- }));
17002
17001
  this.videoStreams = this.videoStreams.map((sdpVideoBlock) => {
17003
17002
  const testStreamId = new RegExp(`\\bmid:${mid}\\b`, 'ig');
17004
17003
  if (testStreamId.test(sdpVideoBlock)) {
@@ -17245,7 +17244,7 @@
17245
17244
  */
17246
17245
  setAudioBitrateWithStreamId(bitrate, streamId) {
17247
17246
  var _a;
17248
- (_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');
17249
17248
  return this;
17250
17249
  }
17251
17250
  /**
@@ -17253,7 +17252,7 @@
17253
17252
  */
17254
17253
  setVideoBitrateWithStreamId(bitrate, streamId) {
17255
17254
  var _a;
17256
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'plan-b not support set 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');
17257
17256
  return this;
17258
17257
  }
17259
17258
  }
@@ -17592,7 +17591,7 @@
17592
17591
  }
17593
17592
  setBitrate(max, min, start) {
17594
17593
  var _a;
17595
- (_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`');
17596
17595
  }
17597
17596
  /**
17598
17597
  * 该函数用于向对等连接添加本地轨道
@@ -18157,16 +18156,12 @@
18157
18156
  return this._sdpStrategy.getOutboundVideoInfo();
18158
18157
  }
18159
18158
  _onLocalTrackMuted(track, resolve) {
18160
- var _a;
18161
18159
  // 修改已发布的小流状态
18162
18160
  const tinyTrack = this.getLocalTrack(`${track.getTrackId()}_tiny`);
18163
18161
  if (tinyTrack) {
18164
18162
  tinyTrack.__innerGetMediaStreamTrack().enabled = !track.isLocalMuted();
18165
18163
  }
18166
18164
  this.emit(RCLocalTrack.__INNER_EVENT_MUTED_CHANGE__, track, resolve);
18167
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_RTC_PEER_CONNECTION_LOCAL_TRACK_MUTED_O, JSON.stringify({
18168
- trackId: track.getTrackId(),
18169
- }));
18170
18165
  }
18171
18166
  _onLocalTrackDestroied(track) {
18172
18167
  this.emit(RCLocalTrack.__INNER_EVENT_DESTROY__, track);
@@ -18345,7 +18340,7 @@
18345
18340
  * 优化 300 人大会议室 https://rc-jira.rongcloud.net/browse/BEEM-289
18346
18341
  * Mac 端卡顿严重, RTCLib 房间超出 32 路流时,不再做北极星质量数据上报,仅取音量数据,以保持 Beem 声音激励功能可用
18347
18342
  */
18348
- 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) {
18349
18344
  return true;
18350
18345
  }
18351
18346
  if (formatData.senders.length || formatData.receivers.length) {
@@ -18693,7 +18688,7 @@
18693
18688
  * 加入房间
18694
18689
  */
18695
18690
  sendR1() {
18696
- const rtcVersion = "5.6.3-alpha.2";
18691
+ const rtcVersion = "5.6.3-alpha.5";
18697
18692
  const imVersion = this._context.getCoreVersion();
18698
18693
  const platform = 'web';
18699
18694
  const pcName = navigator.platform;
@@ -18843,7 +18838,7 @@
18843
18838
  _formatR1Data() {
18844
18839
  return {
18845
18840
  joinTime: this._context.userJoinTime || 0,
18846
- rtcVersion: "5.6.3-alpha.2",
18841
+ rtcVersion: "5.6.3-alpha.5",
18847
18842
  imVersion: this._context.getCoreVersion(),
18848
18843
  platform: 'web',
18849
18844
  device: navigator.platform,
@@ -19112,7 +19107,11 @@
19112
19107
  /**
19113
19108
  * context
19114
19109
  */
19115
- _initOptions) {
19110
+ _initOptions,
19111
+ /**
19112
+ * 是否是观众
19113
+ */
19114
+ _isAudience) {
19116
19115
  this._useMutilPeerC = _useMutilPeerC;
19117
19116
  this._roomId = _roomId;
19118
19117
  this._reTryExchange = _reTryExchange;
@@ -19120,6 +19119,7 @@
19120
19119
  this._polarisReport = _polarisReport;
19121
19120
  this._isRoomAudience = _isRoomAudience;
19122
19121
  this._initOptions = _initOptions;
19122
+ this._isAudience = _isAudience;
19123
19123
  // private _reportListener: {[key: string]: IRCRTCReportListener | null} = {}
19124
19124
  /**
19125
19125
  * 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
@@ -19133,6 +19133,12 @@
19133
19133
  * 根据 track 判断是否为上行
19134
19134
  */
19135
19135
  _isPub(tracks) {
19136
+ if (this._isAudience) {
19137
+ return false;
19138
+ }
19139
+ if (!this._useMutilPeerC) {
19140
+ return true;
19141
+ }
19136
19142
  // 取消订阅时,剩余订阅资源为空,tracks 会为 []
19137
19143
  if (!tracks.length) {
19138
19144
  return false;
@@ -19206,15 +19212,12 @@
19206
19212
  const peerCArr = [];
19207
19213
  // isPublish 判断tracks中的资源是否为本地发布资源 从而区分是订阅与发布
19208
19214
  const isPub = this._isPub(tracks);
19209
- // 不使用多 peerConnection
19210
- if (!this._useMutilPeerC) {
19211
- const pcName = this._genPCName(true);
19212
- peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19213
- return peerCArr;
19214
- }
19215
- // 多 peerConnction 订阅
19216
- if (this._useMutilPeerC && !isPub) {
19217
- const pcName = this._genPCName(false);
19215
+ /**
19216
+ * 不使用多 peerConnection 或
19217
+ * peerConnction 订阅
19218
+ */
19219
+ if (!this._useMutilPeerC || (this._useMutilPeerC && !isPub)) {
19220
+ const pcName = this._genPCName(isPub);
19218
19221
  peerCArr.push(this._createOnePeerCItem(pcName, tracks));
19219
19222
  return peerCArr;
19220
19223
  }
@@ -19292,24 +19295,84 @@
19292
19295
  /* 定义命令类型 */
19293
19296
  var RCCommandKind;
19294
19297
  (function (RCCommandKind) {
19298
+ /**
19299
+ * 发信令取消加入房间之前的资源
19300
+ */
19301
+ RCCommandKind["UNPUBLISH_PREV"] = "UnpublishPrevCommand";
19302
+ /**
19303
+ * 拉取房间内数据
19304
+ */
19305
+ RCCommandKind["PULL_RTCROOM_STATUS"] = "PullRTCRoomStatusCommand";
19306
+ /**
19307
+ * 加入房间
19308
+ */
19309
+ RCCommandKind["JOINROOM"] = "JoinRoomCommand";
19310
+ /**
19311
+ * 解析远端资源数据
19312
+ */
19313
+ RCCommandKind["PARSE_REMOTERES"] = "ParseRemoteResCommand";
19314
+ /**
19315
+ * 解析远端人员数据
19316
+ */
19317
+ RCCommandKind["PARSE_USERSTATE"] = "ParseUserStateCommand";
19318
+ /**
19319
+ * 本端 track 禁用/启用
19320
+ */
19321
+ RCCommandKind["LOCAL_TRACK_MUTE"] = "LocalTrackMuteCommand";
19322
+ /**
19323
+ * 发布资源
19324
+ */
19325
+ RCCommandKind["PUBLISH"] = "PublishCommand";
19326
+ /**
19327
+ * 恢复 ice 连接
19328
+ */
19329
+ RCCommandKind["RETRY_EXCHANGE"] = "RetryExchangeCommand";
19330
+ /**
19331
+ * 取消发布
19332
+ */
19333
+ RCCommandKind["UNPUBLISH"] = "UnpublishCommand";
19334
+ /**
19335
+ * 订阅
19336
+ */
19337
+ RCCommandKind["SUBSCRIBE"] = "SubscribeCommand";
19338
+ /**
19339
+ * 异步订阅、取消订阅、全量订阅
19340
+ */
19341
+ RCCommandKind["ASYNC_COMMAND"] = "AsyncCommand";
19342
+ /**
19343
+ * 取消订阅
19344
+ */
19345
+ RCCommandKind["UNSUBSCRIBE"] = "UnsubscribeCommand";
19346
+ /**
19347
+ * 全量订阅
19348
+ */
19349
+ RCCommandKind["UPDATE_SUBSCRIBE_LIST"] = "UpdateSubscribeListCommand";
19350
+ /**
19351
+ * im 重连房间内人员、资源处理
19352
+ */
19353
+ RCCommandKind["ON_SIGNAL_RECONNECTED"] = "OnSignalReconnectedCommand";
19354
+ /**
19355
+ * 退出副房间
19356
+ */
19357
+ RCCommandKind["LEAVE_OTHER_ROOM"] = "LeaveOtherRoomCommand";
19358
+ /**
19359
+ * 主播、观众切换身份
19360
+ */
19361
+ RCCommandKind["RTC_IDENTITY_CHANGE"] = "RTCIdentityChangeCommand";
19362
+ /**
19363
+ * 开/关 CDN
19364
+ */
19365
+ RCCommandKind["ENABLE_INNER_CDN"] = "EnableInnerCDNCommand";
19366
+ /**
19367
+ * 携带副房间信息重新发 /exchange 请求
19368
+ */
19369
+ RCCommandKind["EXCHANGE_WITH_PUSH_OTHER_ROOM"] = "ExchangeWithPushOtherRoomCommand";
19370
+ /**
19371
+ * 发送 MCU 请求
19372
+ */
19373
+ RCCommandKind["MCUCONFIG_FLUSH"] = "MCUConfigFlushCommand";
19295
19374
  // 未定议的
19296
- RCCommandKind[RCCommandKind["Unknow"] = 0] = "Unknow";
19297
- // 发布资源
19298
- RCCommandKind[RCCommandKind["Publish"] = 1] = "Publish";
19299
- // 取消发布资源
19300
- RCCommandKind[RCCommandKind["UnPublish"] = 2] = "UnPublish";
19301
- // 加入房间
19302
- RCCommandKind[RCCommandKind["JoinRoom"] = 3] = "JoinRoom";
19303
- // 离开房间
19304
- RCCommandKind[RCCommandKind["LeaveRoom"] = 4] = "LeaveRoom";
19305
- // 更新订阅列表
19306
- RCCommandKind[RCCommandKind["UpdateSubscribeTask"] = 5] = "UpdateSubscribeTask";
19307
- // 资源订阅
19308
- RCCommandKind[RCCommandKind["SubscribedTask"] = 6] = "SubscribedTask";
19309
- // 取消资源订阅
19310
- RCCommandKind[RCCommandKind["UnSubscribedTask"] = 7] = "UnSubscribedTask";
19311
- // 异步事件命令
19312
- RCCommandKind["AsyncCommand"] = "AsyncCommand";
19375
+ RCCommandKind["UNKNOWN"] = "Unknown";
19313
19376
  })(RCCommandKind || (RCCommandKind = {}));
19314
19377
 
19315
19378
  // 描述 链表 中的位置
@@ -19345,7 +19408,7 @@
19345
19408
  * @returns 命令的种类。
19346
19409
  */
19347
19410
  get kind() {
19348
- return RCCommandKind.Unknow;
19411
+ return RCCommandKind.UNKNOWN;
19349
19412
  }
19350
19413
  }
19351
19414
 
@@ -19355,7 +19418,7 @@
19355
19418
  this.state = state;
19356
19419
  }
19357
19420
  get kind() {
19358
- return RCCommandKind.AsyncCommand;
19421
+ return RCCommandKind.ASYNC_COMMAND;
19359
19422
  }
19360
19423
  /**
19361
19424
  * `public setState(状态:RCLinkedListPoint):void`
@@ -19642,7 +19705,7 @@
19642
19705
  }
19643
19706
 
19644
19707
  class BaseInvoker {
19645
- constructor(
19708
+ constructor(context,
19646
19709
  /**
19647
19710
  * 内存数据管理实例
19648
19711
  */
@@ -19651,6 +19714,7 @@
19651
19714
  * 命令终止时返回的错误码定义
19652
19715
  */
19653
19716
  abortCode) {
19717
+ this.context = context;
19654
19718
  this._store = _store;
19655
19719
  this.abortCode = abortCode;
19656
19720
  // command 队列
@@ -19664,6 +19728,7 @@
19664
19728
  this._execute();
19665
19729
  }
19666
19730
  _execute() {
19731
+ var _a, _b, _c, _d;
19667
19732
  return __awaiter(this, void 0, void 0, function* () {
19668
19733
  if (this._isDestroyed || this._busy || this._queue.length === 0) {
19669
19734
  return;
@@ -19671,23 +19736,37 @@
19671
19736
  this._busy = true;
19672
19737
  const { command, resolve, reject } = this._queue.shift();
19673
19738
  let res;
19739
+ const traceId = (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
19674
19740
  try {
19675
19741
  /**
19676
19742
  * 说明:由于是先弹出 再执行 Command,所以不存在 在队列中正在执行的任务
19677
19743
  */
19744
+ (_b = this.context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_INVOKER_EXECUTE_T, `commandKind: ${command.kind}, commandLength: ${this._queue.length}`, traceId);
19678
19745
  res = yield command.execute(this._store, this);
19679
19746
  }
19680
19747
  catch (error) {
19748
+ (_c = this.context.logger) === null || _c === void 0 ? void 0 : _c.error(RCLoggerTag.L_INVOKER_EXECUTE_R, JSON.stringify({
19749
+ error,
19750
+ status: RCLoggerStatus.FAILED,
19751
+ commandKind: command.kind,
19752
+ }), traceId);
19681
19753
  reject(error);
19682
19754
  this._next();
19683
19755
  return;
19684
19756
  }
19757
+ (_d = this.context.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_INVOKER_EXECUTE_R, `status: ${RCLoggerStatus.SUCCESSED}, commandKind: ${command.kind}`, traceId);
19685
19758
  resolve(res);
19686
19759
  this._next();
19687
19760
  });
19688
19761
  }
19689
19762
  push(command) {
19690
19763
  return new Promise((resolve, reject) => {
19764
+ var _a;
19765
+ (_a = this.context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_INVOKER_PUSH_O, JSON.stringify({
19766
+ isDestroyed: this._isDestroyed,
19767
+ commandKind: command.kind,
19768
+ commandLength: this._queue.length,
19769
+ }));
19691
19770
  // 房间已销毁
19692
19771
  if (this._isDestroyed) {
19693
19772
  reject({
@@ -19700,7 +19779,7 @@
19700
19779
  // 所以只要队列中存在中 Subscribed 或 UnSubscribed 则可以只执行最后一个
19701
19780
  const { kind } = command;
19702
19781
  if (this._queue.length > 0) {
19703
- if (kind === RCCommandKind.AsyncCommand) {
19782
+ if (kind === RCCommandKind.ASYNC_COMMAND) {
19704
19783
  // 重写 resolve, reject 并将使用新回调的进行包裹它
19705
19784
  ({ command, resolve, reject } = this.commandOffset(command, resolve, reject));
19706
19785
  }
@@ -19729,7 +19808,7 @@
19729
19808
  });
19730
19809
  }
19731
19810
  /**
19732
- * 查找出 RCCommandKind.AsyncCommand 类型的 Command,并将其从队列中删除
19811
+ * 查找出 RCCommandKind.ASYNC_COMMAND 类型的 Command,并将其从队列中删除
19733
19812
  * 并使用最新的一次 Command 接管它的 resolve & reject
19734
19813
  * @param resolve
19735
19814
  * @param reject
@@ -19739,11 +19818,14 @@
19739
19818
  // 因为一次只可以插入一个 Command 所以查找 只需要在队列最后查找一个即可
19740
19819
  const index = this._queue.length - 1;
19741
19820
  const item = this._queue[index];
19742
- const hashSubscribTask = item.command.kind === RCCommandKind.AsyncCommand;
19821
+ const hashSubscribTask = item.command.kind === RCCommandKind.ASYNC_COMMAND;
19743
19822
  // 如果队列中不存在则直接返回
19744
19823
  if (!hashSubscribTask) {
19745
19824
  return { command, resolve, reject };
19746
19825
  }
19826
+ /**
19827
+ * 倒数第二个任务的 state 改为 middle,最后一个任务的 state 设为 tail
19828
+ */
19747
19829
  const [task] = this._queue.splice(index, 1);
19748
19830
  if (task.command instanceof AsyncCommand) {
19749
19831
  task.command.setState(RCLinkedListPoint.MIDDLE);
@@ -19773,9 +19855,17 @@
19773
19855
  };
19774
19856
  }
19775
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
+ }));
19776
19862
  return this._isDestroyed;
19777
19863
  }
19778
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
+ }));
19779
19869
  if (this._isDestroyed) {
19780
19870
  return;
19781
19871
  }
@@ -19792,7 +19882,7 @@
19792
19882
  */
19793
19883
  class Invoker extends BaseInvoker {
19794
19884
  constructor(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom) {
19795
- super(new Store(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom), exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED);
19885
+ super(context, new Store(context, service, peerMrg, roomId, crtUserId, mode, reporter, isUpgrade, isMainRoom), exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED);
19796
19886
  }
19797
19887
  /**
19798
19888
  * 获取 store 存储实例,返回值类型 `ReadableStore`,避免非 command 定义中修改内存
@@ -19812,6 +19902,9 @@
19812
19902
  * 该步骤没有必要与 MediaServer 的交互,因后续资源变更交互为全量交互
19813
19903
  */
19814
19904
  class UnpublishPrevCommand extends BaseCommand {
19905
+ get kind() {
19906
+ return RCCommandKind.UNPUBLISH_PREV;
19907
+ }
19815
19908
  execute(store) {
19816
19909
  var _a, _b, _c, _d, _e, _f, _g, _h;
19817
19910
  return __awaiter(this, void 0, void 0, function* () {
@@ -19824,7 +19917,7 @@
19824
19917
  resource: tmpRes,
19825
19918
  }), traceId);
19826
19919
  // 添加请求队列并等待结果
19827
- 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([]));
19828
19921
  if (code !== engine.ErrorCode.SUCCESS) {
19829
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({
19830
19923
  status: RCLoggerStatus.FAILED,
@@ -19891,7 +19984,7 @@
19891
19984
  this.traceId = traceId;
19892
19985
  }
19893
19986
  get kind() {
19894
- return RCCommandKind.JoinRoom;
19987
+ return RCCommandKind.JOINROOM;
19895
19988
  }
19896
19989
  execute(store, invoker) {
19897
19990
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
@@ -20086,6 +20179,9 @@
20086
20179
  this.forceReq = forceReq;
20087
20180
  this.traceId = traceId;
20088
20181
  }
20182
+ get kind() {
20183
+ return RCCommandKind.UPDATE_SUBSCRIBE_LIST;
20184
+ }
20089
20185
  execute(store, invoker) {
20090
20186
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
20091
20187
  return __awaiter(this, void 0, void 0, function* () {
@@ -20230,6 +20326,9 @@
20230
20326
  this.subhook = subhook;
20231
20327
  this.traceId = traceId;
20232
20328
  }
20329
+ get kind() {
20330
+ return RCCommandKind.UNSUBSCRIBE;
20331
+ }
20233
20332
  execute(store, invoker) {
20234
20333
  var _a, _b, _c, _d;
20235
20334
  return __awaiter(this, void 0, void 0, function* () {
@@ -20319,14 +20418,18 @@
20319
20418
  * 扩散 cdn_uris 资源
20320
20419
  */
20321
20420
  function spreadCDNInfo(context, roomId, CDNUris) {
20322
- var _a, _b;
20421
+ var _a, _b, _c, _d;
20323
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);
20324
20427
  const code = yield context.setRTCCDNUris(roomId, RCRTCMessageType.TOTAL_CONTENT_RESOURCE, JSON.stringify([CDNUris]));
20325
20428
  if (code !== engine.ErrorCode.SUCCESS) {
20326
- (_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);
20327
20430
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
20328
20431
  }
20329
- (_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);
20330
20433
  return { code: exports.RCRTCCode.SUCCESS };
20331
20434
  });
20332
20435
  }
@@ -20334,14 +20437,16 @@
20334
20437
  * 给房间设置 CDN 数据
20335
20438
  */
20336
20439
  function setRoomCDNInfo(context, roomId, CDNUris) {
20337
- var _a, _b;
20440
+ var _a, _b, _c, _d;
20338
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);
20339
20444
  const code = yield context.setRTCData(roomId, 'cdn_uris', JSON.stringify([CDNUris]), true, RTCApiType.ROOM);
20340
20445
  if (code !== engine.ErrorCode.SUCCESS) {
20341
- (_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);
20342
20447
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
20343
20448
  }
20344
- (_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);
20345
20450
  return { code: exports.RCRTCCode.SUCCESS };
20346
20451
  });
20347
20452
  }
@@ -20349,34 +20454,16 @@
20349
20454
  * 开启、停用 CDN 推资源后发信令
20350
20455
  */
20351
20456
  function sendCDNInfoSignal(store) {
20352
- var _a, _b, _c, _d, _e, _f;
20353
20457
  return __awaiter(this, void 0, void 0, function* () {
20354
20458
  const { context } = store;
20355
20459
  const { roomId } = store;
20356
20460
  // eslint-disable-next-line
20357
20461
  const CDNUris = Object.assign({}, store.getCDNUris(), { enableInnerCDN: store.getCDNEnable() });
20358
- (_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({
20359
- roomId,
20360
- CDNUris,
20361
- }));
20362
20462
  const resCodeArr = yield Promise.all([
20363
20463
  spreadCDNInfo(context, roomId, CDNUris),
20364
20464
  setRoomCDNInfo(context, roomId, CDNUris),
20365
20465
  ]);
20366
20466
  const isSuccess = resCodeArr.every((item) => item.code === exports.RCRTCCode.SUCCESS);
20367
- if (isSuccess) {
20368
- (_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({
20369
- status: RCLoggerStatus.SUCCESSED,
20370
- CDNUris,
20371
- }));
20372
- }
20373
- else {
20374
- (_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({
20375
- status: RCLoggerStatus.FAILED,
20376
- code: exports.RCRTCCode.SIGNAL_ERROR,
20377
- msg: 'signal error',
20378
- }));
20379
- }
20380
20467
  return isSuccess ? { code: exports.RCRTCCode.SUCCESS } : { code: exports.RCRTCCode.SIGNAL_ERROR };
20381
20468
  });
20382
20469
  }
@@ -20617,6 +20704,9 @@
20617
20704
  this.subhook = subhook;
20618
20705
  this.traceId = traceId;
20619
20706
  }
20707
+ get kind() {
20708
+ return RCCommandKind.PARSE_USERSTATE;
20709
+ }
20620
20710
  get priority() {
20621
20711
  return CommandPriority.NORMAL;
20622
20712
  }
@@ -20711,6 +20801,9 @@
20711
20801
  this.callback = callback;
20712
20802
  this.traceId = traceId;
20713
20803
  }
20804
+ get kind() {
20805
+ return RCCommandKind.PARSE_REMOTERES;
20806
+ }
20714
20807
  get priority() {
20715
20808
  return CommandPriority.NORMAL;
20716
20809
  }
@@ -20836,14 +20929,18 @@
20836
20929
  }
20837
20930
 
20838
20931
  class SubscribeCommand extends BaseCommand {
20839
- constructor(tracks, subhook, forceReq) {
20932
+ constructor(tracks, subhook, forceReq, traceId) {
20840
20933
  super();
20841
20934
  this.tracks = tracks;
20842
20935
  this.subhook = subhook;
20843
20936
  this.forceReq = forceReq;
20937
+ this.traceId = traceId;
20938
+ }
20939
+ get kind() {
20940
+ return RCCommandKind.SUBSCRIBE;
20844
20941
  }
20845
20942
  execute(store, invoker) {
20846
- var _a, _b, _c, _d, _e, _f, _g, _h;
20943
+ var _a, _b, _c, _d, _e, _f;
20847
20944
  return __awaiter(this, void 0, void 0, function* () {
20848
20945
  // 取消房间状态检查,房间销毁后,invoker 应直接清空,避免后续执行动作
20849
20946
  // const roomStatusCode = this._assertRoomDestroyed()
@@ -20852,17 +20949,16 @@
20852
20949
  // return { code: RCRTCCode.ROOM_HAS_BEEN_DESTROYED }
20853
20950
  // }
20854
20951
  const { tracks, forceReq } = this;
20855
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
20856
- (_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({
20857
20953
  trackIds: tracks.map(getTrackIdFromAttr),
20858
20954
  forceReq,
20859
- }), traceId);
20955
+ }), this.traceId);
20860
20956
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
20861
- (_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({
20862
20958
  status: RCLoggerStatus.FAILED,
20863
20959
  code: exports.RCRTCCode.PARAMS_ERROR,
20864
20960
  msg: 'params error -> tracks',
20865
- }), traceId);
20961
+ }), this.traceId);
20866
20962
  return { code: exports.RCRTCCode.PARAMS_ERROR };
20867
20963
  }
20868
20964
  const crtSubList = store.getSubscribedList().map((item) => (Object.assign({}, item)));
@@ -20885,16 +20981,16 @@
20885
20981
  changed = true;
20886
20982
  });
20887
20983
  if (!changed && !forceReq) {
20888
- (_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({
20889
20985
  status: RCLoggerStatus.SUCCESSED,
20890
20986
  msg: 'repeat subscribe',
20891
- }), traceId);
20987
+ }), this.traceId);
20892
20988
  return { code: exports.RCRTCCode.SUCCESS };
20893
20989
  }
20894
20990
  // 北极星上报
20895
20991
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
20896
20992
  recordSubscribeCommand(true);
20897
- return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, traceId).execute(store, invoker);
20993
+ return new UpdateSubscribeListCommand(crtSubList, this.subhook, true, this.traceId).execute(store, invoker);
20898
20994
  });
20899
20995
  }
20900
20996
  }
@@ -20961,7 +21057,7 @@
20961
21057
  this._traceId = (_a = this._logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
20962
21058
  }
20963
21059
  get kind() {
20964
- return RCCommandKind.Publish;
21060
+ return RCCommandKind.PUBLISH;
20965
21061
  }
20966
21062
  /**
20967
21063
  * 从 pc 移除当次发布失败的资源
@@ -21162,7 +21258,7 @@
21162
21258
  // 通知房间成员
21163
21259
  // 连通率相关埋点-统计扩散耗时
21164
21260
  recordPublishSignalTotalData();
21165
- 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);
21166
21262
  // TIPS: 通知房间成员失败,对信息进行重试操作
21167
21263
  if (errorCode !== engine.ErrorCode.SUCCESS) {
21168
21264
  const RetrySignal = RetrySignaling.handler();
@@ -21172,7 +21268,7 @@
21172
21268
  if ((new Date()).valueOf() - startTime > this.signalRetryTime) {
21173
21269
  return errorCode;
21174
21270
  }
21175
- 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));
21176
21272
  if (code !== engine.ErrorCode.SUCCESS) {
21177
21273
  yield RetrySignal.task(loop);
21178
21274
  }
@@ -21296,7 +21392,7 @@
21296
21392
  this.unpubhook = unpubhook;
21297
21393
  }
21298
21394
  get kind() {
21299
- return RCCommandKind.UnPublish;
21395
+ return RCCommandKind.UNPUBLISH;
21300
21396
  }
21301
21397
  __unpublish(store, invoker, peerCItem, tracks) {
21302
21398
  var _a, _b, _c, _d;
@@ -21395,7 +21491,7 @@
21395
21491
  const dList = publishedList.filter((item) => !unpublishList.includes(item));
21396
21492
  // 通知房间内成员
21397
21493
  recordUnpublishSignalTotalData();
21398
- 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));
21399
21495
  if (singalCode !== engine.ErrorCode.SUCCESS) {
21400
21496
  reportQualityUnpublishSignalTotalData(publishedList, singalCode);
21401
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({
@@ -21483,17 +21579,24 @@
21483
21579
  this.localTrack = localTrack;
21484
21580
  this._recvSignalResultFn = _recvSignalResultFn;
21485
21581
  }
21582
+ get kind() {
21583
+ return RCCommandKind.LOCAL_TRACK_MUTE;
21584
+ }
21486
21585
  execute(store, invoker) {
21487
- var _a, _b, _c, _d;
21586
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21488
21587
  return __awaiter(this, void 0, void 0, function* () {
21489
21588
  const { localTrack } = this;
21490
21589
  const trackId = localTrack.getTrackId();
21491
21590
  const { crtUserId, roomId } = store;
21492
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);
21493
21597
  // 本地资源,需同步房间状态
21494
21598
  const localResource = [{ resourceId: trackId, enabled }];
21495
21599
  // 计算更新后的全量资源数据
21496
- // const publishedList = this._roomResources[crtUserId] || []
21497
21600
  const publishedList = store.getResourcesByUserId(crtUserId);
21498
21601
  // 增量数据
21499
21602
  const plusList = [];
@@ -21508,23 +21611,19 @@
21508
21611
  break;
21509
21612
  }
21510
21613
  }
21511
- 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);
21512
21615
  // 执行 localTrack.mute 传入的 resolve,并返回 signal 扩散的 code 码
21513
21616
  this._recvSignalResultFn(code);
21514
21617
  if (code !== engine.ErrorCode.SUCCESS) {
21515
- (_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({
21516
21619
  status: RCLoggerStatus.FAILED,
21517
21620
  code,
21518
- enabled,
21519
- trackId: this.localTrack.getTrackId(),
21520
21621
  msg: 'signal error',
21521
- }));
21622
+ }), traceId);
21522
21623
  }
21523
- (_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({
21524
21625
  status: RCLoggerStatus.SUCCESSED,
21525
- enabled,
21526
- trackId: this.localTrack.getTrackId(),
21527
- }));
21626
+ }), traceId);
21528
21627
  });
21529
21628
  }
21530
21629
  }
@@ -21536,13 +21635,19 @@
21536
21635
  this.isPub = isPub;
21537
21636
  this.retryHook = retryHook;
21538
21637
  }
21638
+ get kind() {
21639
+ return RCCommandKind.RETRY_EXCHANGE;
21640
+ }
21539
21641
  get priority() {
21540
21642
  return CommandPriority.HIGH;
21541
21643
  }
21542
21644
  execute(store, invoker) {
21543
- var _a, _b;
21645
+ var _a, _b, _c, _d, _e;
21544
21646
  return __awaiter(this, void 0, void 0, function* () {
21545
- (_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();
21546
21651
  const { pcName, isPub } = this;
21547
21652
  const { useMutilPeerC } = store;
21548
21653
  const { pc } = store.peerMgr.getPCItemByPCName(pcName);
@@ -21557,28 +21662,109 @@
21557
21662
  // 发送 /exchange 请求
21558
21663
  const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
21559
21664
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
21560
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resp.code}, pcName: ${pcName}`, traceId);
21561
21665
  return;
21562
21666
  }
21563
21667
  const { sdp: answer, resultCode } = resp.data;
21564
21668
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
21565
- // store.context?.logger?.error(RCLoggerTag.L_RETRY_EXCHANGE_COMMAND_R, `reTryExchange failed: ${resultCode}, pcName: ${pcName}`, traceId);
21566
21669
  return;
21567
21670
  }
21568
21671
  // 请求成功,清除 ice 断线重连的定时器
21569
21672
  pc.clearReTryExchangeTimer();
21570
- 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
+ }
21571
21750
  });
21572
21751
  }
21573
21752
  }
21574
21753
 
21575
21754
  class OnSignalReconnectedCommand extends BaseCommand {
21576
- constructor(subhook, callbacks, livingType) {
21755
+ constructor(subhook, callbacks, _retryHook, _pubhook, _signalRetryTime = PUBLISHSIGNALRETRYTIME, _pullRTCRoomStatus, livingType) {
21577
21756
  super();
21578
21757
  this.subhook = subhook;
21579
21758
  this.callbacks = callbacks;
21759
+ this._retryHook = _retryHook;
21760
+ this._pubhook = _pubhook;
21761
+ this._signalRetryTime = _signalRetryTime;
21762
+ this._pullRTCRoomStatus = _pullRTCRoomStatus;
21580
21763
  this.livingType = livingType;
21581
21764
  }
21765
+ get kind() {
21766
+ return RCCommandKind.ON_SIGNAL_RECONNECTED;
21767
+ }
21582
21768
  /**
21583
21769
  * @override
21584
21770
  */
@@ -21586,10 +21772,11 @@
21586
21772
  return CommandPriority.HIGH;
21587
21773
  }
21588
21774
  execute(store, invoker) {
21589
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
21775
+ var _a, _b, _c, _d, _e, _f;
21590
21776
  return __awaiter(this, void 0, void 0, function* () {
21591
- const { livingType } = this;
21592
21777
  const { roomId, roomMode } = store;
21778
+ this._roomId = roomId;
21779
+ this._roomMode = roomMode;
21593
21780
  const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21594
21781
  (_d = (_c = store.context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_T, undefined, traceId);
21595
21782
  /**
@@ -21607,9 +21794,32 @@
21607
21794
  this.callbacks.onPeerClosed && this.callbacks.onPeerClosed();
21608
21795
  return;
21609
21796
  }
21610
- const { code, data } = yield store.context.joinRTCRoom(roomId, roomMode, livingType);
21797
+ const { code: pingCode } = yield store.context.rtcPing(roomId, roomMode);
21798
+ /**
21799
+ * 不在房间内时,需重新加房间,恢复资源状态
21800
+ * ErrorCode 增加 40001 需更新 im 包,暂时转为数字对比
21801
+ * 在房间内获取房间内最新数据
21802
+ */
21803
+ if (pingCode === 40001) {
21804
+ const code = yield this._joinRoom(store, traceId, invoker);
21805
+ /**
21806
+ * 加入房间成功后,恢复和 mediaServer 服务之间的连接
21807
+ */
21808
+ if (code === engine.ErrorCode.SUCCESS) {
21809
+ yield this._restoreMediaServer(store, invoker);
21810
+ }
21811
+ }
21812
+ else {
21813
+ yield this._pullRTCRoomStatus(this._roomId, traceId).execute(store, invoker);
21814
+ }
21815
+ });
21816
+ }
21817
+ _joinRoom(store, traceId, invoker) {
21818
+ var _a, _b, _c, _d, _e, _f, _g;
21819
+ return __awaiter(this, void 0, void 0, function* () {
21820
+ const { code, data } = yield store.context.joinRTCRoom(this._roomId, this._roomMode, this.livingType);
21611
21821
  if (code !== engine.ErrorCode.SUCCESS) {
21612
- (_h = (_g = store.context) === null || _g === void 0 ? void 0 : _g.logger) === null || _h === void 0 ? void 0 : _h.error(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21822
+ (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.error(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21613
21823
  status: RCLoggerStatus.FAILED,
21614
21824
  code,
21615
21825
  msg: 'im reconnect joinRTCRoom failed',
@@ -21617,7 +21827,7 @@
21617
21827
  return;
21618
21828
  }
21619
21829
  if (!data) {
21620
- (_k = (_j = store.context) === null || _j === void 0 ? void 0 : _j.logger) === null || _k === void 0 ? void 0 : _k.info(RCLoggerTag.L_LIVING_ROOM_RECONNECTED_R, JSON.stringify({
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({
21621
21831
  status: RCLoggerStatus.FAILED,
21622
21832
  msg: 'im reconnect joinRTCRoom, roomData is empty',
21623
21833
  }), traceId);
@@ -21626,13 +21836,38 @@
21626
21836
  /**
21627
21837
  * 处理全量的房间数据
21628
21838
  */
21629
- const CDNUris = (_l = data.roomInfo.filter((item) => item.key === 'cdn_uris')[0]) === null || _l === void 0 ? void 0 : _l.value;
21839
+ const CDNUris = (_e = data.roomInfo.filter((item) => item.key === 'cdn_uris')[0]) === null || _e === void 0 ? void 0 : _e.value;
21630
21840
  handleFullRoomData(data, store, this.callbacks, invoker, this.subhook, CDNUris, traceId);
21631
- (_o = (_m = store.context) === null || _m === void 0 ? void 0 : _m.logger) === null || _o === void 0 ? void 0 : _o.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21841
+ (_g = (_f = store.context) === null || _f === void 0 ? void 0 : _f.logger) === null || _g === void 0 ? void 0 : _g.info(RCLoggerTag.L_ABSTRACT_ROOM_IM_RECONNECTED_R, JSON.stringify({
21632
21842
  status: RCLoggerStatus.SUCCESSED,
21633
21843
  roomData: data,
21634
21844
  }), traceId);
21635
- return { data };
21845
+ return code;
21846
+ });
21847
+ }
21848
+ _restoreMediaServer(store, invoker) {
21849
+ return __awaiter(this, void 0, void 0, function* () {
21850
+ const { useMutilPeerC } = store.peerMgr;
21851
+ const localTracks = store.getLocalTracks();
21852
+ const subedTracks = Object.values(store.getRemoteTracks()).filter((track) => !!track.isSubscribed());
21853
+ /**
21854
+ * 多 peerConnection 恢复订阅资源
21855
+ */
21856
+ if (useMutilPeerC) {
21857
+ /**
21858
+ * 多 peerConnection 恢复发布资源
21859
+ */
21860
+ subedTracks.length && (yield new SubscribeCommand(subedTracks, this.subhook, true).execute(store, invoker));
21861
+ localTracks.length && (yield new PublishCommand(localTracks, this._pubhook, this._signalRetryTime).execute(store, invoker));
21862
+ return;
21863
+ }
21864
+ /**
21865
+ * 单 peerConnection 恢复发布、订阅资源
21866
+ */
21867
+ localTracks.length && (yield new PublishCommand(localTracks, this._pubhook, this._signalRetryTime).execute(store, invoker));
21868
+ if (!localTracks.length && subedTracks.length) {
21869
+ yield new SubscribeCommand(subedTracks, this.subhook, true).execute(store, invoker);
21870
+ }
21636
21871
  });
21637
21872
  }
21638
21873
  }
@@ -21650,12 +21885,13 @@
21650
21885
  this._logger = null;
21651
21886
  this._logger = RTCLogger.getLogger();
21652
21887
  }
21888
+ get kind() {
21889
+ return RCCommandKind.ASYNC_COMMAND;
21890
+ }
21653
21891
  execute(store, invoker) {
21654
- var _a, _b, _c, _d;
21892
+ var _a, _b, _c;
21655
21893
  return __awaiter(this, void 0, void 0, function* () {
21656
21894
  const { tracks } = this;
21657
- const { roomId } = store;
21658
- (_a = this._logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_OLD_DAILY_RECORD_O, `unsubscribe -> roomId: ${roomId}, tracks: ${tracks.map(getTrackIdFromAttr)}`);
21659
21895
  if (this.state === RCLinkedListPoint.NORMAL) {
21660
21896
  // 获取原订阅列表
21661
21897
  const originTracks = store.getSubscribedList().slice();
@@ -21664,7 +21900,7 @@
21664
21900
  const subscribedTracks = store.getSubscribedList().slice();
21665
21901
  // 计算订阅列表 Diff
21666
21902
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21667
- (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21903
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21668
21904
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21669
21905
  });
21670
21906
  return { code: updateSuscribeCode, failedList };
@@ -21680,14 +21916,14 @@
21680
21916
  // 自执行一次,计算出最终的 collectSubscribeList
21681
21917
  const { code: updateSuscribeCode, failedList } = yield new UpdateSubscribeListCommand(tracks, this.subhook, true).execute(store, invoker);
21682
21918
  if (updateSuscribeCode !== exports.RCRTCCode.SUCCESS) {
21683
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21919
+ (_b = this.callbacks) === null || _b === void 0 ? void 0 : _b.onTaskCompleted({
21684
21920
  code: updateSuscribeCode, subscribe: [], unsubscribe: [], failedList,
21685
21921
  });
21686
21922
  return { code: updateSuscribeCode, failedList };
21687
21923
  }
21688
21924
  const subscribedTracks = store.getSubscribedList().slice(0);
21689
21925
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21690
- (_d = this.callbacks) === null || _d === void 0 ? void 0 : _d.onTaskCompleted({
21926
+ (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
21691
21927
  code: updateSuscribeCode, subscribe, unsubscribe, failedList,
21692
21928
  });
21693
21929
  return { code: updateSuscribeCode, failedList };
@@ -21707,22 +21943,25 @@
21707
21943
  }
21708
21944
 
21709
21945
  class AsyncSubscribeCommand extends AsyncCommand {
21710
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
21946
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21711
21947
  super(state);
21712
21948
  this.tracks = tracks;
21713
21949
  this.subhook = subhook;
21714
21950
  this.callbacks = callbacks;
21951
+ this.traceId = traceId;
21952
+ }
21953
+ get kind() {
21954
+ return RCCommandKind.ASYNC_COMMAND;
21715
21955
  }
21716
21956
  execute(store, invoker) {
21717
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21957
+ var _a, _b, _c, _d, _e;
21718
21958
  return __awaiter(this, void 0, void 0, function* () {
21719
21959
  const { tracks } = this;
21720
- const { roomId } = store;
21721
21960
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21722
21961
  if (this.state === RCLinkedListPoint.NORMAL) {
21723
21962
  // 获取原订阅列表
21724
21963
  const originTracks = store.getSubscribedList().slice();
21725
- 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);
21726
21965
  // 获取新的订阅列表
21727
21966
  const subscribedTracks = store.getSubscribedList().slice();
21728
21967
  // 计算订阅列表 Diff
@@ -21732,16 +21971,15 @@
21732
21971
  });
21733
21972
  return { code: subscribeCode, failedList };
21734
21973
  }
21735
- const traceId = (_c = (_b = store.context) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.createTraceId();
21736
- (_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({
21737
21975
  trackIds: tracks.map(getTrackIdFromAttr),
21738
- }), traceId);
21976
+ }), this.traceId);
21739
21977
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
21740
- (_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({
21741
21979
  status: RCLoggerStatus.FAILED,
21742
21980
  code: exports.RCRTCCode.PARAMS_ERROR,
21743
21981
  msg: 'params error -> tracks',
21744
- }));
21982
+ }), this.traceId);
21745
21983
  return { code: exports.RCRTCCode.PARAMS_ERROR };
21746
21984
  }
21747
21985
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item)));
@@ -21765,16 +22003,12 @@
21765
22003
  });
21766
22004
  // 北极星上报
21767
22005
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
21768
- (_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({
21769
- trackIds: tracks.map(getTrackIdFromAttr),
21770
- roomId,
21771
- }));
21772
22006
  if (this.state === RCLinkedListPoint.TAIL) {
21773
- 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);
21774
22008
  if (subscribeCode === exports.RCRTCCode.SUCCESS) {
21775
22009
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21776
22010
  const tracks = store.getCollectSubscribeList().slice(0);
21777
- 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);
21778
22012
  }
21779
22013
  return { code: subscribeCode };
21780
22014
  }
@@ -21801,60 +22035,58 @@
21801
22035
  }
21802
22036
 
21803
22037
  class AsyncUnsubscribeCommand extends AsyncCommand {
21804
- constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL) {
22038
+ constructor(tracks, subhook, callbacks, state = RCLinkedListPoint.NORMAL, traceId) {
21805
22039
  super(state);
21806
22040
  this.tracks = tracks;
21807
22041
  this.subhook = subhook;
21808
22042
  this.callbacks = callbacks;
22043
+ this.traceId = traceId;
22044
+ }
22045
+ get kind() {
22046
+ return RCCommandKind.ASYNC_COMMAND;
21809
22047
  }
21810
22048
  execute(store, invoker) {
21811
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22049
+ var _a, _b, _c, _d, _e;
21812
22050
  return __awaiter(this, void 0, void 0, function* () {
21813
22051
  const { tracks } = this;
21814
- const { roomId } = store;
21815
- const traceId = (_b = (_a = store.context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
21816
22052
  // 队列中只有一个发布或者取消发布任务,没有进行操作合并时的处理
21817
22053
  if (this.state === RCLinkedListPoint.NORMAL) {
21818
22054
  // 获取原订阅列表
21819
22055
  const originTracks = store.getSubscribedList().slice();
21820
- 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);
21821
22057
  // 获取新的订阅列表
21822
22058
  const subscribedTracks = store.getSubscribedList().slice();
21823
22059
  // 计算出 Diff
21824
22060
  const { subscribe, unsubscribe } = this.pickoutSubscribed(subscribedTracks, originTracks);
21825
- (_c = this.callbacks) === null || _c === void 0 ? void 0 : _c.onTaskCompleted({
22061
+ (_a = this.callbacks) === null || _a === void 0 ? void 0 : _a.onTaskCompleted({
21826
22062
  code: unsubscribeCode, subscribe, unsubscribe, failedList,
21827
22063
  });
21828
22064
  return { code: unsubscribeCode, failedList };
21829
22065
  }
21830
- (_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({
21831
22067
  trackIds: tracks.map(getTrackIdFromAttr),
21832
- }));
22068
+ }), this.traceId);
21833
22069
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
21834
- (_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({
21835
22071
  status: RCLoggerStatus.FAILED,
21836
22072
  code: exports.RCRTCCode.PARAMS_ERROR,
21837
22073
  msg: 'params error -> tracks',
21838
- }));
22074
+ }), this.traceId);
21839
22075
  return { code: exports.RCRTCCode.PARAMS_ERROR };
21840
22076
  }
21841
22077
  // 计算剩余订阅列表, 如果资源在取消订阅列表内则排除它
21842
22078
  const crtSubList = this.getSubscribedList(store).map((item) => (Object.assign({}, item))).filter((item) => !tracks.includes(item.track));
21843
22079
  // 北极星上报
21844
22080
  store.polarisReport.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
21845
- (_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({
21846
- trackIds: tracks.map(getTrackIdFromAttr),
21847
- roomId,
21848
- }));
21849
22081
  if (this.state === RCLinkedListPoint.TAIL) {
21850
22082
  // 自执行一次,计算出最终的 collectSubscribeList
21851
- 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);
21852
22084
  // 拥塞队列处理完成的数据
21853
22085
  if (unsubscribeCode === exports.RCRTCCode.SUCCESS) {
21854
22086
  // 浅Copy 并对 store.getCollectSubscribeList 数据进行清空
21855
22087
  const tracks = store.getCollectSubscribeList().slice(0).map((item) => item.track);
21856
22088
  // 自执行一次,计算出最终的 collectSubscribeList
21857
- 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);
21858
22090
  }
21859
22091
  return { code: unsubscribeCode };
21860
22092
  }
@@ -21913,8 +22145,11 @@
21913
22145
  this._subhook = _subhook;
21914
22146
  this._dealUserAppListener = _dealUserAppListener;
21915
22147
  }
22148
+ get kind() {
22149
+ return RCCommandKind.PULL_RTCROOM_STATUS;
22150
+ }
21916
22151
  execute(store, invoker) {
21917
- var _a, _b;
22152
+ var _a, _b, _c;
21918
22153
  return __awaiter(this, void 0, void 0, function* () {
21919
22154
  const version = store.getRoomStatusVersion();
21920
22155
  (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.info(RCLoggerTag.L_PULL_ROOM_STATUS_T, JSON.stringify({
@@ -21923,10 +22158,14 @@
21923
22158
  }), this._traceId);
21924
22159
  const { code, data } = yield this._context.pullRTCRoomStatus(this._roomId, version);
21925
22160
  if (code !== engine.ErrorCode.SUCCESS) {
22161
+ (_b = this._context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
22162
+ status: RCLoggerStatus.FAILED,
22163
+ code,
22164
+ }), this._traceId);
21926
22165
  return { code };
21927
22166
  }
21928
22167
  const { bFullStatus, version: newVersion, usersData, roomStatus, } = data;
21929
- (_b = this._context.logger) === null || _b === void 0 ? void 0 : _b.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
22168
+ (_c = this._context.logger) === null || _c === void 0 ? void 0 : _c.info(RCLoggerTag.L_PULL_ROOM_STATUS_R, JSON.stringify({
21930
22169
  bFullStatus,
21931
22170
  version: int64ToTimestamp(newVersion),
21932
22171
  usersData,
@@ -22023,8 +22262,18 @@
22023
22262
  this._peerCManager.setStore(this._store);
22024
22263
  // 注册监听 rtc_ntf 信令数据,收到通知时拉取房间数据
22025
22264
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
22026
- var _a, _b, _c, _d;
22265
+ var _a, _b, _c, _d, _e, _f;
22027
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
+ }
22028
22277
  switch (type) {
22029
22278
  case 2:
22030
22279
  if (roomId !== this._roomId) {
@@ -22032,28 +22281,31 @@
22032
22281
  }
22033
22282
  // 拉取房间数据
22034
22283
  // eslint-disable-next-line no-case-declarations
22035
- const tracId = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.createTraceId();
22036
- (_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);
22037
22286
  this._startPullRTCRoomStatus(roomId, tracId);
22038
22287
  break;
22039
22288
  }
22040
22289
  }));
22041
22290
  }
22291
+ _pullRTCRoomStatus(roomId, tracId) {
22292
+ return new PullRTCRoomStatusCommand(roomId, tracId, this._context, {
22293
+ onUserJoin: this._callAppListener.bind(this, 'onUserJoin'),
22294
+ onUserLeave: this._callAppListener.bind(this, 'onUserLeave'),
22295
+ onAudioMuteChange: this._onAudioMuteChange.bind(this),
22296
+ onVideoMuteChange: this._onVideoMuteChange.bind(this),
22297
+ onTrackPublish: this._onTrackPublish.bind(this),
22298
+ onTrackUnpublish: this._onTrackUnpublish.bind(this),
22299
+ onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22300
+ }, this._subhook.bind(this), this._dealUserAppListener.bind(this));
22301
+ }
22042
22302
  /**
22043
22303
  * 拉取房间数据
22044
22304
  * @param roomId 房间 id
22045
22305
  */
22046
22306
  _startPullRTCRoomStatus(roomId, tracId) {
22047
22307
  return __awaiter(this, void 0, void 0, function* () {
22048
- yield this._invoker.push(new PullRTCRoomStatusCommand(roomId, tracId, this._context, {
22049
- onUserJoin: this._callAppListener.bind(this, 'onUserJoin'),
22050
- onUserLeave: this._callAppListener.bind(this, 'onUserLeave'),
22051
- onAudioMuteChange: this._onAudioMuteChange.bind(this),
22052
- onVideoMuteChange: this._onVideoMuteChange.bind(this),
22053
- onTrackPublish: this._onTrackPublish.bind(this),
22054
- onTrackUnpublish: this._onTrackUnpublish.bind(this),
22055
- onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22056
- }, this._subhook.bind(this), this._dealUserAppListener.bind(this)));
22308
+ yield this._invoker.push(this._pullRTCRoomStatus(roomId, tracId));
22057
22309
  });
22058
22310
  }
22059
22311
  __innerInit(mode, joinType, livingType, innerUserDatas, outerUserDatas, traceId) {
@@ -22694,15 +22946,11 @@
22694
22946
  });
22695
22947
  }
22696
22948
  _getRTCReqestHeaders(pcName) {
22697
- const heasers = {
22698
- 'App-Key': this._context.getAppkey(),
22699
- RoomId: this._roomId,
22700
- Token: this._store.getToken(),
22701
- RoomType: this._store.roomMode,
22702
- UserId: this._context.getCurrentId(),
22703
- 'Client-Session-Id': this._clientSessionId,
22704
- 'Peer-Connection-Id': pcName,
22705
- };
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);
22706
22954
  return heasers;
22707
22955
  }
22708
22956
  /**
@@ -22771,9 +23019,11 @@
22771
23019
  * @returns 一个用代码和失败列表解析为对象的承诺。
22772
23020
  */
22773
23021
  addSubscribeTask(tracks) {
23022
+ var _a;
23023
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22774
23024
  this._invoker.push(new AsyncSubscribeCommand(tracks, this._subhook.bind(this), {
22775
23025
  onTaskCompleted: this._onTaskCompleted.bind(this),
22776
- }));
23026
+ }, RCLinkedListPoint.NORMAL, traceId));
22777
23027
  }
22778
23028
  /**
22779
23029
  * 取消订阅资源
@@ -22793,9 +23043,11 @@
22793
23043
  * @returns 一个用代码和失败列表解析为对象的承诺。
22794
23044
  */
22795
23045
  addUnsubscribeTask(tracks) {
23046
+ var _a;
23047
+ const traceId = (_a = this._context.logger) === null || _a === void 0 ? void 0 : _a.createTraceId();
22796
23048
  this._invoker.push(new AsyncUnsubscribeCommand(tracks, this._subhook.bind(this), {
22797
23049
  onTaskCompleted: this._onTaskCompleted.bind(this),
22798
- }));
23050
+ }, RCLinkedListPoint.NORMAL, traceId));
22799
23051
  }
22800
23052
  /**
22801
23053
  * 强制修改订阅列表,仅订阅数组中的资源,取消订阅其他已订阅资源。
@@ -22919,7 +23171,7 @@
22919
23171
  onTrackPublish: this._onTrackPublish.bind(this),
22920
23172
  onTrackUnpublish: this._onTrackUnpublish.bind(this),
22921
23173
  onCDNEnableChange: this._callAppListener.bind(this, 'onCDNEnableChange'),
22922
- }, livingType));
23174
+ }, (pcName) => ({ pushOtherRooms: this._getPushOtherRoomsParams(), headers: this._getRTCReqestHeaders(pcName) }), this._pubhook.bind(this), this.signalRetryTime, this._pullRTCRoomStatus.bind(this), livingType));
22923
23175
  });
22924
23176
  }
22925
23177
  _onAudioMuteChange(audioTrack) {
@@ -22961,6 +23213,9 @@
22961
23213
  this.data = data;
22962
23214
  this.cdnValues = cdnValues;
22963
23215
  }
23216
+ get kind() {
23217
+ return RCCommandKind.MCUCONFIG_FLUSH;
23218
+ }
22964
23219
  execute(store, invoker) {
22965
23220
  var _a, _b, _c, _d;
22966
23221
  return __awaiter(this, void 0, void 0, function* () {
@@ -23978,23 +24233,28 @@
23978
24233
  })(RCInnerCDNPushMode || (RCInnerCDNPushMode = {}));
23979
24234
 
23980
24235
  class ExchangeWithPushOtherRoomCommand extends BaseCommand {
23981
- constructor(roomId, hooks, roomPKHandler) {
24236
+ constructor(roomId, hooks, roomPKHandler, traceId) {
23982
24237
  super();
23983
24238
  this.roomId = roomId;
23984
24239
  this.hooks = hooks;
23985
24240
  this.roomPKHandler = roomPKHandler;
24241
+ this.traceId = traceId;
23986
24242
  }
23987
24243
  /**
23988
24244
  * 携带 pushOtherRooms 与 mediaServer 重新交互
23989
24245
  */
23990
24246
  _exchangeWithPushOtherRoom(store, invoker) {
23991
- var _a, _b, _c, _d;
24247
+ var _a, _b, _c, _d, _e, _f, _g, _h;
23992
24248
  return __awaiter(this, void 0, void 0, function* () {
23993
24249
  /**
23994
24250
  * 如果己方未发布过资源,无需发请求
23995
24251
  */
23996
24252
  const pubTracks = store.getLocalTracks();
23997
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);
23998
24258
  return;
23999
24259
  }
24000
24260
  const mutilPeerCList = Object.values(store.peerMgr.getMutilPeerCData());
@@ -24005,60 +24265,65 @@
24005
24265
  const reqBody = yield createExchangeParams(subscribeList, false, pc, store);
24006
24266
  const { pushOtherRooms, headers } = this.hooks(pcNameList[index]);
24007
24267
  reqBody.pushOtherRooms = pushOtherRooms;
24008
- const resp = yield new ExchangeCommand(headers, reqBody).execute(store, invoker);
24268
+ const resp = yield new ExchangeCommand(headers, reqBody, this.traceId).execute(store, invoker);
24009
24269
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
24010
- (_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);
24011
24275
  return;
24012
24276
  }
24013
24277
  const { sdp: answer, resultCode } = resp.data;
24014
24278
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
24015
- (_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);
24016
24284
  return;
24017
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);
24018
24290
  pc.setRemoteAnswer(answer.sdp);
24019
24291
  }
24020
24292
  });
24021
24293
  }
24294
+ get kind() {
24295
+ return RCCommandKind.EXCHANGE_WITH_PUSH_OTHER_ROOM;
24296
+ }
24022
24297
  execute(store, invoker) {
24023
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24298
+ var _a, _b, _c, _d, _e, _f;
24024
24299
  return __awaiter(this, void 0, void 0, function* () {
24025
24300
  const { roomId } = this;
24026
- (_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({
24027
24302
  roomId,
24028
- userId: store.crtUserId,
24029
24303
  }));
24030
24304
  // 离开 PK 房间后,如果参与过连麦,pushOtherRooms 需去掉退出的连麦房间配置,重新和 mediaServer 交互
24031
24305
  if (!this.roomPKHandler) {
24032
- (_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({
24033
24307
  status: RCLoggerStatus.FAILED,
24034
- code: '',
24035
24308
  msg: '_roomPKHandler not exist',
24036
- }));
24309
+ }), this.traceId);
24037
24310
  return;
24038
24311
  }
24039
24312
  const PKInfo = this.roomPKHandler.getPKInfo(roomId);
24040
24313
  if (!PKInfo) {
24041
- (_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}`);
24042
- (_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({
24043
24315
  status: RCLoggerStatus.FAILED,
24044
- code: '',
24045
24316
  msg: 'PKInfo not exist',
24046
- }));
24317
+ }), this.traceId);
24047
24318
  return;
24048
24319
  }
24049
24320
  yield this._exchangeWithPushOtherRoom(store, invoker);
24050
- (_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({
24051
- status: RCLoggerStatus.SUCCESSED,
24052
- roomId,
24053
- userId: store.crtUserId,
24054
- PKInfo,
24055
- }));
24056
24321
  });
24057
24322
  }
24058
24323
  }
24059
24324
 
24060
24325
  class LeaveOtherRoomCommand extends BaseCommand {
24061
- constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK) {
24326
+ constructor(pkHandler, room, _PKInfo, hooks, _joinedPKRooms, isQuitPK, traceId) {
24062
24327
  super();
24063
24328
  this.pkHandler = pkHandler;
24064
24329
  this.room = room;
@@ -24066,18 +24331,21 @@
24066
24331
  this.hooks = hooks;
24067
24332
  this._joinedPKRooms = _joinedPKRooms;
24068
24333
  this.isQuitPK = isQuitPK;
24334
+ this.traceId = traceId;
24069
24335
  }
24070
24336
  get kind() {
24071
- return RCCommandKind.LeaveRoom;
24337
+ return RCCommandKind.LEAVE_OTHER_ROOM;
24072
24338
  }
24073
24339
  /**
24074
24340
  * 结束跨房间连麦
24075
24341
  * @param roomId 需要结束连麦的房间 roomId
24076
24342
  */
24077
- quitRoomPK(roomId, store) {
24078
- var _a, _b, _c, _d, _e, _f;
24343
+ quitRoomPK(roomId, store, traceId) {
24344
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24079
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);
24080
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);
24081
24349
  return;
24082
24350
  }
24083
24351
  const { inviterRoomId, inviteeRoomId, inviterUserId, inviteSessionId, } = this._PKInfo[roomId];
@@ -24093,40 +24361,34 @@
24093
24361
  content: JSON.stringify(content),
24094
24362
  keys: [`${inviterRoomId}|${inviterUserId}`],
24095
24363
  };
24096
- (_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)}`);
24097
24364
  const code = yield store.context.endRoomPK(params);
24098
24365
  if (code !== engine.ErrorCode.SUCCESS) {
24099
- (_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);
24100
24367
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
24101
24368
  }
24102
- (_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);
24103
24370
  delete this._PKInfo[roomId];
24104
24371
  return { code: exports.RCRTCCode.SUCCESS };
24105
24372
  });
24106
24373
  }
24107
24374
  execute(store, invoker) {
24108
- var _a, _b, _c, _d, _e, _f;
24375
+ var _a, _b, _c, _d;
24109
24376
  return __awaiter(this, void 0, void 0, function* () {
24110
24377
  const { room, isQuitPK } = this;
24111
24378
  const roomId = room.getRoomId();
24112
- (_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}`);
24113
- (_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({
24114
24380
  roomId,
24115
- userId: store.crtUserId,
24116
24381
  isQuitPK,
24117
- }));
24382
+ }), this.traceId);
24118
24383
  yield room.__destroy(true);
24119
24384
  // 回调主直播房间离开 PK 房间
24120
24385
  delete this._joinedPKRooms[roomId];
24121
- 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);
24122
24387
  // isQuitPK 为 true 时,结束连麦
24123
- isQuitPK && this.quitRoomPK(roomId, store);
24124
- (_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({
24125
24390
  status: RCLoggerStatus.SUCCESSED,
24126
- roomId,
24127
- userId: store.crtUserId,
24128
- isQuitPK,
24129
- }));
24391
+ }), this.traceId);
24130
24392
  return { code: exports.RCRTCCode.SUCCESS };
24131
24393
  });
24132
24394
  }
@@ -24168,9 +24430,8 @@
24168
24430
  this._mainRoomId = this._mainLivingRoom.getRoomId();
24169
24431
  }
24170
24432
  _callAppListener(eventType, ...attrs) {
24171
- var _a, _b, _c, _d, _e;
24172
- (_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)}`);
24173
- 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];
24174
24435
  if (!handle) {
24175
24436
  return;
24176
24437
  }
@@ -24178,7 +24439,7 @@
24178
24439
  handle(...attrs);
24179
24440
  }
24180
24441
  catch (error) {
24181
- (_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));
24182
24443
  }
24183
24444
  }
24184
24445
  /**
@@ -24194,8 +24455,7 @@
24194
24455
  extra,
24195
24456
  };
24196
24457
  this._PKInfo[inviterRoomId] = inviteInfo;
24197
- (_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({
24198
- 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({
24199
24459
  eventType: 'onRequestJoinOtherRoom',
24200
24460
  info,
24201
24461
  }));
@@ -24213,8 +24473,7 @@
24213
24473
  extra,
24214
24474
  };
24215
24475
  delete this._PKInfo[inviterRoomId];
24216
- (_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({
24217
- 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({
24218
24477
  eventType: 'onCancelRequestOtherRoom',
24219
24478
  cancelInfo,
24220
24479
  }));
@@ -24249,21 +24508,20 @@
24249
24508
  inviteeRoomId,
24250
24509
  };
24251
24510
  this._PKInfo[inviteeRoomId].inviteeUserAutoMix = inviteeUserAutoMix;
24252
- (_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({
24253
- 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({
24254
24512
  eventType: 'onResponseJoinOtherRoom',
24255
24513
  answerInfo,
24256
24514
  }));
24257
24515
  this._callAppListener('onResponseJoinOtherRoom', answerInfo);
24258
24516
  }
24259
- createLeaveOtherRoomCommand(room, isQuitPK) {
24260
- 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);
24261
24519
  }
24262
24520
  /**
24263
24521
  * 收到连麦结束
24264
24522
  */
24265
24523
  _onPKEnd(content) {
24266
- var _a, _b;
24524
+ var _a, _b, _c, _d, _e, _f;
24267
24525
  return __awaiter(this, void 0, void 0, function* () {
24268
24526
  const { inviteeRoomId, inviterRoomId, userId } = content.inviteInfo;
24269
24527
  const roomId = inviterRoomId === this._mainRoomId ? inviteeRoomId : inviterRoomId;
@@ -24273,10 +24531,11 @@
24273
24531
  };
24274
24532
  // 兼容先退出房间,再收到 pk 结束的情况
24275
24533
  const room = this._joinedPKRooms[roomId];
24276
- 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)));
24277
24537
  delete this._PKInfo[roomId];
24278
- (_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({
24279
- 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({
24280
24539
  eventType: 'onFinishOtherRoom',
24281
24540
  endInfo,
24282
24541
  }));
@@ -24312,7 +24571,6 @@
24312
24571
  registerRoomPKEventListener(listener) {
24313
24572
  var _a, _b;
24314
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({
24315
- status: RCLoggerStatus.SUCCESSED,
24316
24574
  listener: listener && Object.keys(listener),
24317
24575
  }));
24318
24576
  this._appListener = listener;
@@ -24325,23 +24583,23 @@
24325
24583
  * @param options.extra 拓展字段,可随邀请连麦消息透传给被邀请者
24326
24584
  */
24327
24585
  requestJoinOtherRoom(inviteeRoomId, inviteeUserId, options) {
24328
- 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;
24329
24587
  return __awaiter(this, void 0, void 0, function* () {
24330
- (_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({
24331
24590
  inviteeRoomId,
24332
24591
  inviteeUserId,
24333
24592
  options,
24334
- }));
24593
+ }), traceId);
24335
24594
  if (!(engine.validate('inviteeRoomId', inviteeRoomId, engine.notEmptyString, true)
24336
24595
  && engine.validate('inviteeUserId', inviteeUserId, engine.notEmptyString, true))) {
24337
- (_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({
24338
24597
  status: RCLoggerStatus.FAILED,
24339
24598
  code: exports.RCRTCCode.PARAMS_ERROR,
24340
- msg: 'params error -> inviteeRoomId inviteeUserId',
24341
- }));
24599
+ msg: 'params error -> inviteeRoomId or inviteeUserId',
24600
+ }), traceId);
24342
24601
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24343
24602
  }
24344
- (_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 || {})}`);
24345
24603
  const inviteSessionId = getUUID();
24346
24604
  const autoMix = engine.isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24347
24605
  const inviteInfo = {
@@ -24362,18 +24620,14 @@
24362
24620
  inviteInfo: JSON.stringify(inviteInfo),
24363
24621
  inviteSessionId,
24364
24622
  };
24365
- (_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)}`);
24366
24623
  const code = yield this._context.requestRoomPK(params);
24367
24624
  if (code !== engine.ErrorCode.SUCCESS) {
24368
- (_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}`);
24369
- (_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({
24370
24626
  status: RCLoggerStatus.FAILED,
24371
24627
  code,
24372
- msg: '',
24373
- }));
24628
+ }), traceId);
24374
24629
  return { code };
24375
24630
  }
24376
- (_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');
24377
24631
  this._PKInfo[inviteeRoomId] = {
24378
24632
  inviteSessionId,
24379
24633
  inviterRoomId: this._mainRoomId,
@@ -24381,11 +24635,9 @@
24381
24635
  inviterUserAutoMix: autoMix,
24382
24636
  inviteeRoomId,
24383
24637
  };
24384
- (_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({
24385
- inviteeRoomId,
24386
- inviteeUserId,
24387
- options,
24388
- }));
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);
24389
24641
  return { code: exports.RCRTCCode.SUCCESS };
24390
24642
  });
24391
24643
  }
@@ -24396,34 +24648,31 @@
24396
24648
  * @param extra 附加信息,可随取消邀请连麦消息透传给被邀请者
24397
24649
  */
24398
24650
  cancelRequestJoinOtherRoom(inviteeRoomId, inviteeUserId, extra) {
24399
- 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;
24400
24652
  return __awaiter(this, void 0, void 0, function* () {
24401
- (_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({
24402
24655
  inviteeRoomId,
24403
24656
  inviteeUserId,
24404
24657
  extra,
24405
- userId: this._context.getCurrentId(),
24406
- roomId: this._mainRoomId,
24407
- }));
24658
+ }), traceId);
24408
24659
  if (!(engine.validate('inviteeRoomId', inviteeRoomId, engine.notEmptyString, true)
24409
24660
  && engine.validate('inviteeUserId', inviteeUserId, engine.notEmptyString, true))) {
24410
- (_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({
24411
24662
  status: RCLoggerStatus.FAILED,
24412
24663
  code: exports.RCRTCCode.PARAMS_ERROR,
24413
24664
  msg: 'params error -> inviteeRoomId or inviteeUserId',
24414
- }));
24665
+ }), traceId);
24415
24666
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24416
24667
  }
24417
24668
  if (!this._PKInfo[inviteeRoomId]) {
24418
- (_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`);
24419
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({
24420
24670
  status: RCLoggerStatus.FAILED,
24421
24671
  code: exports.RCRTCCode.PARAMS_ERROR,
24422
24672
  msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24423
- }));
24673
+ }), traceId);
24424
24674
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24425
24675
  }
24426
- (_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}`);
24427
24676
  const inviteInfo = {
24428
24677
  inviterRoomId: this._mainRoomId,
24429
24678
  inviterUserId: this._context.getCurrentId(),
@@ -24438,24 +24687,17 @@
24438
24687
  inviteSessionId: this._PKInfo[inviteeRoomId].inviteSessionId,
24439
24688
  inviteInfo: JSON.stringify(inviteInfo),
24440
24689
  };
24441
- (_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)}`);
24442
24690
  const code = yield this._context.cancelRoomPK(params);
24443
24691
  if (code !== engine.ErrorCode.SUCCESS) {
24444
- (_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}`);
24445
- (_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({
24446
24693
  status: RCLoggerStatus.FAILED,
24447
24694
  code,
24448
- msg: `The request to connect with ${inviteeUserId} user in room ${inviteeRoomId} is not initiated`,
24449
- }));
24695
+ }), traceId);
24450
24696
  return { code };
24451
24697
  }
24452
- (_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');
24453
- (_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({
24454
24699
  status: RCLoggerStatus.SUCCESSED,
24455
- inviteeRoomId,
24456
- inviteeUserId,
24457
- extra,
24458
- }));
24700
+ }), traceId);
24459
24701
  delete this._PKInfo[inviteeRoomId];
24460
24702
  return { code: exports.RCRTCCode.SUCCESS };
24461
24703
  });
@@ -24469,35 +24711,32 @@
24469
24711
  * @param options.extra 附加信息,可随响应连麦消息透传给邀请者
24470
24712
  */
24471
24713
  responseJoinOtherRoom(inviterRoomId, inviterUserId, agree, options) {
24472
- 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;
24473
24715
  return __awaiter(this, void 0, void 0, function* () {
24474
- (_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({
24475
24718
  inviterRoomId,
24476
24719
  inviterUserId,
24477
24720
  agree,
24478
24721
  options,
24479
- userId: this._context.getCurrentId(),
24480
- roomId: this._mainRoomId,
24481
- }));
24722
+ }), traceId);
24482
24723
  if (!(engine.validate('inviterRoomId', inviterRoomId, engine.notEmptyString, true)
24483
24724
  && engine.validate('inviterUserId', inviterUserId, engine.notEmptyString, true))) {
24484
- (_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({
24485
24726
  status: RCLoggerStatus.FAILED,
24486
24727
  code: exports.RCRTCCode.PARAMS_ERROR,
24487
24728
  msg: 'params error -> inviterRoomId or inviterUserId',
24488
- }));
24729
+ }), traceId);
24489
24730
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24490
24731
  }
24491
24732
  if (!this._PKInfo[inviterRoomId]) {
24492
- (_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`);
24493
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({
24494
24734
  status: RCLoggerStatus.FAILED,
24495
24735
  code: exports.RCRTCCode.PARAMS_ERROR,
24496
24736
  msg: `User ${inviterUserId} in room ${inviterRoomId} did not send a request for connection`,
24497
- }));
24737
+ }), traceId);
24498
24738
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24499
24739
  }
24500
- (_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 || {})}`);
24501
24740
  const { inviteSessionId, inviterUserAutoMix } = this._PKInfo[inviterRoomId];
24502
24741
  const autoMix = engine.isBoolean(options === null || options === void 0 ? void 0 : options.autoMix) ? options === null || options === void 0 ? void 0 : options.autoMix : true;
24503
24742
  const value = {
@@ -24527,27 +24766,17 @@
24527
24766
  key: `${inviterRoomId}|${this._mainRoomId}`,
24528
24767
  value: JSON.stringify(value),
24529
24768
  };
24530
- (_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)}`);
24531
24769
  const code = yield this._context.responseRoomPK(params);
24532
24770
  if (code !== engine.ErrorCode.SUCCESS) {
24533
- (_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}`);
24534
- (_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({
24535
24772
  status: RCLoggerStatus.FAILED,
24536
24773
  code,
24537
- msg: '',
24538
- }));
24774
+ }), traceId);
24539
24775
  return { code };
24540
24776
  }
24541
- (_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');
24542
- (_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({
24543
24778
  status: RCLoggerStatus.SUCCESSED,
24544
- inviterRoomId,
24545
- inviterUserId,
24546
- agree,
24547
- options,
24548
- userId: this._context.getCurrentId(),
24549
- roomId: this._mainRoomId,
24550
- }));
24779
+ }), traceId);
24551
24780
  this._PKInfo[inviterRoomId].inviteeUserAutoMix = autoMix;
24552
24781
  return { code: exports.RCRTCCode.SUCCESS };
24553
24782
  });
@@ -24557,35 +24786,34 @@
24557
24786
  * @roomId 副房间的 roomId
24558
24787
  */
24559
24788
  joinOtherRoom(roomId) {
24560
- 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;
24561
24790
  return __awaiter(this, void 0, void 0, function* () {
24562
- (_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({
24563
24793
  roomId,
24564
- userId: this._context.getCurrentId(),
24565
- }));
24794
+ }), traceId);
24566
24795
  if (!(engine.validate('roomId', roomId, engine.notEmptyString, true))) {
24567
- (_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({
24568
24797
  status: RCLoggerStatus.FAILED,
24569
24798
  code: exports.RCRTCCode.PARAMS_ERROR,
24570
24799
  msg: 'params error -> roomId',
24571
- }));
24800
+ }), traceId);
24572
24801
  return { code: exports.RCRTCCode.PARAMS_ERROR };
24573
24802
  }
24574
24803
  if (this._context.getConnectionStatus() !== engine.ConnectionStatus.CONNECTED) {
24575
- (_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({
24576
24805
  status: RCLoggerStatus.FAILED,
24577
24806
  code: exports.RCRTCCode.SIGNAL_DISCONNECTED,
24578
24807
  msg: 'IM disconnected',
24579
- }));
24808
+ }), traceId);
24580
24809
  return { code: exports.RCRTCCode.SIGNAL_DISCONNECTED };
24581
24810
  }
24582
- (_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}`);
24583
24811
  if (this._joinedPKRooms[roomId]) {
24584
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({
24585
24813
  status: RCLoggerStatus.FAILED,
24586
24814
  code: exports.RCRTCCode.REPERT_JOIN_ROOM,
24587
24815
  msg: 'Join the room repeatedly',
24588
- }));
24816
+ }), traceId);
24589
24817
  return { code: exports.RCRTCCode.REPERT_JOIN_ROOM };
24590
24818
  }
24591
24819
  const livingType = exports.RCLivingType.VIDEO; // signal 不处理 livingType 故写死 RCLivingType.VIDEO
@@ -24596,23 +24824,18 @@
24596
24824
  const room = new RCLivingRoom(this._context, this._runtime, roomId, this._service, this._initOptions, livingType, false, false, false, this._clientSessionId);
24597
24825
  const { code, data } = yield room.__innerInit(RTCMode.LIVE, undefined, livingType, innerUserData);
24598
24826
  if (code !== exports.RCRTCCode.SUCCESS) {
24599
- (_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}`);
24600
- (_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({
24601
24828
  status: RCLoggerStatus.FAILED,
24602
24829
  code,
24603
- msg: '',
24604
- }));
24830
+ }), traceId);
24605
24831
  return { code: code };
24606
24832
  }
24607
- (_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)}`);
24608
24833
  // 回调主直播房间,已加入 PK 房间
24609
24834
  this._joinedPKRooms[roomId] = room;
24610
- yield this._onJoinedPKRoom(roomId, room);
24611
- (_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({
24612
24837
  status: RCLoggerStatus.SUCCESSED,
24613
- roomId,
24614
- userId: this._context.getCurrentId(),
24615
- }));
24838
+ }), traceId);
24616
24839
  return {
24617
24840
  room, code: exports.RCRTCCode.SUCCESS, userIds: room.getRemoteUserIds(), tracks: room.getRemoteTracks(),
24618
24841
  };
@@ -24624,8 +24847,11 @@
24624
24847
  * @param isQuitPK 是否要结束连麦
24625
24848
  */
24626
24849
  leaveOtherRoom(room, isQuitPK) {
24850
+ var _a, _b, _c, _d;
24627
24851
  return __awaiter(this, void 0, void 0, function* () {
24628
- 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));
24629
24855
  });
24630
24856
  }
24631
24857
  /**
@@ -24663,6 +24889,9 @@
24663
24889
  this.cdnValues = cdnValues;
24664
24890
  this.enable = enable;
24665
24891
  }
24892
+ get kind() {
24893
+ return RCCommandKind.ENABLE_INNER_CDN;
24894
+ }
24666
24895
  execute(store, invoker) {
24667
24896
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
24668
24897
  return __awaiter(this, void 0, void 0, function* () {
@@ -24748,6 +24977,9 @@
24748
24977
  this.livingType = livingType;
24749
24978
  this.traceId = traceId;
24750
24979
  }
24980
+ get kind() {
24981
+ return RCCommandKind.RTC_IDENTITY_CHANGE;
24982
+ }
24751
24983
  execute(store, invoker) {
24752
24984
  var _a;
24753
24985
  return __awaiter(this, void 0, void 0, function* () {
@@ -24903,9 +25135,8 @@
24903
25135
  var _a;
24904
25136
  const { userId } = parseTrackId(resourceId);
24905
25137
  // 是否是主房间资源
24906
- // const isHostRoomResource = !!this._roomResources[userId]?.find(item => getTrackId(item) === resourceId)
24907
25138
  const isHostRoomResource = !!((_a = this._store.getResourcesByUserId(userId)) === null || _a === void 0 ? void 0 : _a.find((item) => getTrackId(item) === resourceId));
24908
- // 是否是主房间资源
25139
+ // 是否是副房间资源
24909
25140
  let isPKRoomResource = false;
24910
25141
  /**
24911
25142
  * 无副房间时,只验证是否为主房间资源
@@ -24937,7 +25168,7 @@
24937
25168
  * 副房间不可调用
24938
25169
  */
24939
25170
  if (!this._store.isMainRoom) {
24940
- (_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');
24941
25172
  return { code: exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM };
24942
25173
  }
24943
25174
  return this._mcuConfigBuilder;
@@ -25027,7 +25258,7 @@
25027
25258
  * @override
25028
25259
  * 加入 PK 房间回调
25029
25260
  */
25030
- _onJoinedPKRoom(roomId, room) {
25261
+ _onJoinedPKRoom(roomId, traceId) {
25031
25262
  return __awaiter(this, void 0, void 0, function* () {
25032
25263
  /**
25033
25264
  * 加入副房间之后,如果己方发布过资源,且参与连麦,
@@ -25036,8 +25267,7 @@
25036
25267
  this._invoker.push(new ExchangeWithPushOtherRoomCommand(roomId, (pcName) => ({
25037
25268
  pushOtherRooms: this._getPushOtherRoomsParams(),
25038
25269
  headers: this._getRTCReqestHeaders(pcName),
25039
- }), this._roomPKHandler));
25040
- // push(async () => this._onLeavePKRoom(roomId))
25270
+ }), this._roomPKHandler, traceId));
25041
25271
  });
25042
25272
  }
25043
25273
  /**
@@ -25226,7 +25456,7 @@
25226
25456
  this._appListener = null;
25227
25457
  this._crtUserId = this._context.getCurrentId();
25228
25458
  this._service = new RCMediaService(runtime, _context, _initOption.mediaServer);
25229
- 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);
25230
25460
  /**
25231
25461
  * 利用 store 存储数据
25232
25462
  */
@@ -25234,7 +25464,6 @@
25234
25464
  this._peerCManager.setStore(this._store);
25235
25465
  }
25236
25466
  _getReqHeaders(livingType) {
25237
- var _a, _b;
25238
25467
  return __awaiter(this, void 0, void 0, function* () {
25239
25468
  // 直播观众端 RoomId 与 UserId 保持一致
25240
25469
  const roomId = this._crtUserId;
@@ -25242,22 +25471,17 @@
25242
25471
  if (!this._rtcToken) {
25243
25472
  const { code, data } = yield this._context.getRTCToken(roomId, RTCMode.LIVE, livingType);
25244
25473
  if (code !== engine.ErrorCode.SUCCESS) {
25245
- (_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}`);
25246
25474
  return { code: exports.RCRTCCode.SIGNAL_ERROR };
25247
25475
  }
25248
25476
  this._rtcToken = data.rtcToken;
25249
25477
  }
25478
+ /**
25479
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
25480
+ */
25481
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
25250
25482
  return {
25251
25483
  code: exports.RCRTCCode.SUCCESS,
25252
- headers: {
25253
- 'App-Key': this._context.getAppkey(),
25254
- UserId: this._crtUserId,
25255
- RoomId: roomId,
25256
- RoomType: RTCMode.LIVE,
25257
- Token: this._rtcToken,
25258
- 'Peer-Connection-Id': this._pcName,
25259
- 'Client-Session-Id': this._clientSessionId,
25260
- },
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),
25261
25485
  };
25262
25486
  });
25263
25487
  }
@@ -25294,7 +25518,7 @@
25294
25518
  });
25295
25519
  }
25296
25520
  __subscribe(liveUrl, livingType, mediaType, subTiny = false) {
25297
- 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;
25298
25522
  return __awaiter(this, void 0, void 0, function* () {
25299
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({
25300
25524
  liveUrl,
@@ -25315,8 +25539,7 @@
25315
25539
  !this._fromRetry && ((_e = this._pc) === null || _e === void 0 ? void 0 : _e.clearReTryExchangeTimer());
25316
25540
  this._fromRetry = false;
25317
25541
  if (!engine.isString(liveUrl)) {
25318
- (_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}`);
25319
- (_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({
25320
25543
  status: RCLoggerStatus.FAILED,
25321
25544
  code: exports.RCRTCCode.PARAMS_ERROR,
25322
25545
  msg: `params error -> liveUrl: ${liveUrl}`,
@@ -25324,8 +25547,8 @@
25324
25547
  return { code: exports.RCRTCCode.PARAMS_ERROR, tracks };
25325
25548
  }
25326
25549
  if (![exports.RCLivingType.AUDIO, exports.RCLivingType.VIDEO].includes(livingType)) {
25327
- (_l = (_k = this._context) === null || _k === void 0 ? void 0 : _k.logger) === null || _l === void 0 ? void 0 : _l.error(`livingType is invalid: ${livingType}`);
25328
- (_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({
25329
25552
  status: RCLoggerStatus.FAILED,
25330
25553
  code: exports.RCRTCCode.PARAMS_ERROR,
25331
25554
  msg: `params error -> livingType: ${livingType}`,
@@ -25333,8 +25556,7 @@
25333
25556
  return { code: exports.RCRTCCode.PARAMS_ERROR, tracks };
25334
25557
  }
25335
25558
  if (![exports.RCMediaType.AUDIO_ONLY, exports.RCMediaType.VIDEO_ONLY, exports.RCMediaType.AUDIO_VIDEO].includes(mediaType)) {
25336
- (_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}`);
25337
- (_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({
25338
25560
  status: RCLoggerStatus.FAILED,
25339
25561
  code: exports.RCRTCCode.PARAMS_ERROR,
25340
25562
  msg: `params error -> -> mediaType: ${mediaType}`,
@@ -25343,7 +25565,7 @@
25343
25565
  }
25344
25566
  // 允许观众动态切换大小流订阅,或重复订阅同一资源
25345
25567
  if (this._liveUrl && this._liveUrl !== liveUrl) {
25346
- (_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({
25347
25569
  status: RCLoggerStatus.FAILED,
25348
25570
  code: exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,
25349
25571
  msg: 'repeat subscribe',
@@ -25367,10 +25589,10 @@
25367
25589
  // 构建 http req headers
25368
25590
  const { code, headers } = yield this._getReqHeaders(livingType);
25369
25591
  if (code !== exports.RCRTCCode.SUCCESS) {
25370
- (_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({
25371
25593
  status: RCLoggerStatus.FAILED,
25372
25594
  code,
25373
- msg: '',
25595
+ msg: 'getRTCToken failed',
25374
25596
  }));
25375
25597
  return { code, tracks };
25376
25598
  }
@@ -25394,25 +25616,21 @@
25394
25616
  };
25395
25617
  const resp = yield this._service.broadcastSubscribe(headers, body);
25396
25618
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
25397
- (_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}`);
25398
- (_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({
25399
25620
  status: RCLoggerStatus.FAILED,
25400
25621
  code: resp.code,
25401
- msg: `andience subscribe failed: ${resp.code}`,
25402
25622
  }));
25403
25623
  return { code: resp.code, tracks };
25404
25624
  }
25405
25625
  const data = resp.data;
25406
25626
  if (data.resultCode !== exports.RCRTCCode.SUCCESS) {
25407
- (_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}`);
25408
- (_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({
25409
25628
  status: RCLoggerStatus.FAILED,
25410
25629
  code: data.resultCode,
25411
- msg: `andience subscribe failed! code: ${data.resultCode}; message: ${data.message}`,
25630
+ msg: data.message,
25412
25631
  }));
25413
25632
  return { code: data.resultCode, tracks };
25414
25633
  }
25415
- (_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}`);
25416
25634
  this._livingType = livingType;
25417
25635
  this._mediaType = mediaType;
25418
25636
  this._subTiny = subTiny;
@@ -25431,7 +25649,7 @@
25431
25649
  readyTracks && this._updateTrackIdSSRCMap(answer.sdp, readyTracks);
25432
25650
  // 缓存订阅资源的ssrc和msid
25433
25651
  // AbstractStatParser.formatSourceIdMapFromSdp(answer.sdp, 'subscribe');
25434
- (_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({
25435
25653
  status: RCLoggerStatus.SUCCESSED,
25436
25654
  liveUrl,
25437
25655
  }));
@@ -25460,7 +25678,7 @@
25460
25678
  });
25461
25679
  }
25462
25680
  __unsubscribe() {
25463
- 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;
25464
25682
  return __awaiter(this, void 0, void 0, function* () {
25465
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({
25466
25684
  liveUrl: this._liveUrl,
@@ -25479,19 +25697,15 @@
25479
25697
  const { headers } = yield this._getReqHeaders();
25480
25698
  const { code } = yield this._service.broadcastExit(headers);
25481
25699
  if (code !== exports.RCRTCCode.SUCCESS) {
25482
- (_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}`);
25483
- (_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({
25484
25701
  status: RCLoggerStatus.FAILED,
25485
25702
  code,
25486
- msg: `broadcast unsubscribe failed: ${code}`,
25487
25703
  }));
25488
25704
  }
25489
25705
  else {
25490
- (_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');
25491
- (_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({
25492
25707
  status: RCLoggerStatus.SUCCESSED,
25493
25708
  liveUrl: this._liveUrl,
25494
- msg: 'broadcast unsubscribe success',
25495
25709
  }));
25496
25710
  this._subscribedList = [];
25497
25711
  }
@@ -25515,16 +25729,17 @@
25515
25729
  this._appListener = listener;
25516
25730
  }
25517
25731
  _onTrackReady(evt) {
25518
- var _a, _b, _c, _d;
25732
+ var _a, _b, _c, _d, _e, _f;
25519
25733
  const { track } = evt.receiver;
25520
25734
  const mediaType = track.kind === 'audio' ? exports.RCMediaType.AUDIO_ONLY : exports.RCMediaType.VIDEO_ONLY;
25521
25735
  const rTrack = this._subTracks[mediaType];
25522
25736
  rTrack.__innerSetMediaStreamTrack(track);
25523
25737
  try {
25524
- (_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);
25525
25740
  }
25526
25741
  catch (error) {
25527
- (_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));
25528
25743
  }
25529
25744
  }
25530
25745
  }
@@ -25590,14 +25805,12 @@
25590
25805
  // 北极星数据
25591
25806
  this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this, PolarisRole.Audience);
25592
25807
  this._polarisReport.sendR1();
25593
- 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);
25594
25809
  // 注册监听 rtc_ntf 信令数据,解码后拉取指定房间数据
25595
25810
  this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
25596
- var _a, _b;
25597
25811
  // 1. 拉取数据,非本房间可不拉取
25598
25812
  // 2. 拉取完成后调用原通知方法 this.singalDataChange(_roomId)
25599
25813
  const { time, type, roomId } = this._context.decodeRtcNotify(buffer);
25600
- (_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 })}`);
25601
25814
  switch (type) {
25602
25815
  case 1:
25603
25816
  // RTC KV拉取
@@ -25614,7 +25827,7 @@
25614
25827
  this._setInitData();
25615
25828
  }
25616
25829
  _startPull(roomId, timestamp) {
25617
- var _a, _b;
25830
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25618
25831
  return __awaiter(this, void 0, void 0, function* () {
25619
25832
  if (this._isPulling) {
25620
25833
  return;
@@ -25625,14 +25838,17 @@
25625
25838
  this._isPulling = false;
25626
25839
  return;
25627
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);
25628
25843
  const { code, data } = yield this._context.pullRTCRoomEntry(roomId);
25629
25844
  if (code === engine.ErrorCode.SUCCESS) {
25630
25845
  this._isPulling = false;
25631
25846
  this._pullTime = data.syncTime || 0;
25632
25847
  const kvEntries = (data === null || data === void 0 ? void 0 : data.kvEntries) || [];
25633
- (_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)}`);
25634
- 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);
25635
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);
25636
25852
  });
25637
25853
  }
25638
25854
  /**
@@ -25694,10 +25910,7 @@
25694
25910
  });
25695
25911
  }
25696
25912
  _assertRoomDestroyed() {
25697
- var _a, _b;
25698
25913
  if (this._destroyed) {
25699
- const msg = 'This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance.';
25700
- (_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);
25701
25914
  return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED;
25702
25915
  }
25703
25916
  }
@@ -25710,26 +25923,18 @@
25710
25923
  * * key RC_RTC_SESSIONID value: sessionId
25711
25924
  * * key RC_CDN value: CDN 资源数据
25712
25925
  */
25713
- singalDataChange(singalData, roomId) {
25714
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
25715
- (_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({
25716
- singalData,
25717
- roomId,
25718
- userId: this._crtUserId,
25719
- }));
25926
+ singalDataChange(singalData, roomId, traceId) {
25927
+ var _a, _b, _c;
25720
25928
  if (roomId !== this._roomId) {
25721
- (_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}`);
25722
- (_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({
25723
25930
  status: RCLoggerStatus.FAILED,
25724
- code: '',
25725
- msg: `id inconsistency -> params id:${roomId},current id:${this._roomId}`,
25726
- }));
25931
+ msg: `roomId inconsistency -> params roomId:${roomId}, current roomId:${this._roomId}`,
25932
+ }), traceId);
25727
25933
  return;
25728
25934
  }
25729
- (_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 || {})}`);
25730
25935
  const allMcuUris = [];
25731
- const CDNUrisStr = (_j = singalData.filter((item) => item.key === 'RC_CDN')[0]) === null || _j === void 0 ? void 0 : _j.value;
25732
- 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);
25733
25938
  singalData.forEach((data) => {
25734
25939
  const { key, value, timestamp, uid, } = data;
25735
25940
  const isResKey = key.indexOf('RC_RES_') !== -1;
@@ -25739,7 +25944,7 @@
25739
25944
  const anchorUris = JSON.parse(serverUris.uris || '[]');
25740
25945
  allMcuUris.push(...mcuUris);
25741
25946
  // 处理主播发布的分流资源
25742
- this._diffAnchorResource(anchorUris, uid);
25947
+ this._diffAnchorResource(anchorUris, uid, traceId);
25743
25948
  return;
25744
25949
  }
25745
25950
  // 处理主播列表
@@ -25747,21 +25952,15 @@
25747
25952
  const anchorUserIds = JSON.parse(value || '[]');
25748
25953
  const { joinUserIds, leftUserIds } = this._diffAnchorList(anchorUserIds);
25749
25954
  if (joinUserIds.length > 0) {
25750
- this._handleNewJoinedAnchor(joinUserIds);
25955
+ this._handleNewJoinedAnchor(joinUserIds, traceId);
25751
25956
  }
25752
25957
  if (leftUserIds.length > 0) {
25753
- this._handleLeftedAnchor(leftUserIds);
25958
+ this._handleLeftedAnchor(leftUserIds, traceId);
25754
25959
  }
25755
25960
  }
25756
25961
  });
25757
25962
  // 处理直播间 MCU 合流资源资源
25758
- this._diffRoomResource(allMcuUris);
25759
- (_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({
25760
- status: RCLoggerStatus.SUCCESSED,
25761
- singalData,
25762
- roomId,
25763
- userId: this._crtUserId,
25764
- }));
25963
+ this._diffRoomResource(allMcuUris, traceId);
25765
25964
  }
25766
25965
  /**
25767
25966
  * 计算加入离开的主播 ID 列表
@@ -25774,19 +25973,18 @@
25774
25973
  joinUserIds,
25775
25974
  };
25776
25975
  }
25777
- _handleNewJoinedAnchor(list) {
25976
+ _handleNewJoinedAnchor(list, traceId) {
25778
25977
  var _a, _b;
25779
25978
  // 更新 _roomAnchorList
25780
25979
  this._roomAnchorList.push(...list);
25781
25980
  // 触发 app 主播加入监听
25782
- (_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({
25783
- 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({
25784
25982
  eventType: 'onAnchorJoin',
25785
25983
  list,
25786
- }));
25984
+ }), traceId);
25787
25985
  this._callAppListener('onAnchorJoin', list);
25788
25986
  }
25789
- _handleLeftedAnchor(list) {
25987
+ _handleLeftedAnchor(list, traceId) {
25790
25988
  var _a, _b;
25791
25989
  return __awaiter(this, void 0, void 0, function* () {
25792
25990
  // 更新 _roomAnchorList
@@ -25802,18 +26000,17 @@
25802
26000
  tracks.forEach((item) => delete this._remoteTracks[item.getTrackId()]);
25803
26001
  }
25804
26002
  // 触发 app 主播离开监听
25805
- (_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({
25806
- 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({
25807
26004
  eventType: 'onAnchorLeave',
25808
26005
  list,
25809
- }));
26006
+ }), traceId);
25810
26007
  this._callAppListener('onAnchorLeave', list);
25811
26008
  });
25812
26009
  }
25813
26010
  /**
25814
26011
  * 计算新发布和取消发布的合流资源
25815
26012
  */
25816
- _diffRoomResource(uris) {
26013
+ _diffRoomResource(uris, traceId) {
25817
26014
  var _a, _b;
25818
26015
  return __awaiter(this, void 0, void 0, function* () {
25819
26016
  const newPubTracks = [];
@@ -25849,31 +26046,23 @@
25849
26046
  });
25850
26047
  // 通知 APP 新发布的 tracks
25851
26048
  if (newPubTracks.length > 0) {
25852
- (_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({
25853
- 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({
25854
26050
  eventType: 'onTrackPublish',
25855
26051
  trackIds: newPubTracks.map((track) => track.getTrackId()),
25856
- }));
26052
+ }), traceId);
25857
26053
  this._callAppListener('onTrackPublish', newPubTracks);
25858
26054
  }
25859
26055
  if (unpubTracks.length > 0) {
25860
- this._onUserUnpublish(unpubTracks, 'onTrackUnpublish');
26056
+ this._onUserUnpublish(unpubTracks, 'onTrackUnpublish', traceId);
25861
26057
  }
25862
26058
  });
25863
26059
  }
25864
26060
  /**
25865
26061
  * 计算主播发布和取消发布的资源,以及资源的状态变更
25866
26062
  */
25867
- _diffAnchorResource(uris, userId) {
25868
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26063
+ _diffAnchorResource(uris, userId, traceId) {
26064
+ var _a, _b, _c, _d, _e, _f;
25869
26065
  return __awaiter(this, void 0, void 0, function* () {
25870
- /**
25871
- * 设置房间内 RTC 资源 ssrc 和 trackId map
25872
- */
25873
- uris.forEach((res) => {
25874
- const { ssrc, resourceId } = JSON.parse(res.uri);
25875
- this._store.setTrackIdSSRCMap(ssrc, resourceId);
25876
- });
25877
26066
  // 当前资源清单
25878
26067
  const nowRes = this._roomAnchorRes[userId] || (this._roomAnchorRes[userId] = []);
25879
26068
  const { publishedList, unpublishedList, modifiedList } = diffPublishResources(nowRes, uris);
@@ -25911,17 +26100,19 @@
25911
26100
  // 重新订阅二次发布资源
25912
26101
  if (subedTracks.length) {
25913
26102
  const trackIds = subedTracks.map((item) => item.getTrackId());
25914
- (_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)}`);
25915
26103
  const { code } = yield push(() => this._subscribeHandle(subedTracks, true));
25916
26104
  if (code !== exports.RCRTCCode.SUCCESS) {
25917
- (_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
+ }));
25918
26110
  }
25919
26111
  }
25920
- (_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({
25921
- 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({
25922
26113
  eventType: 'onAnchorTrackPublish',
25923
26114
  trackIds: newTracks.map((track) => track.getTrackId()),
25924
- }));
26115
+ }), traceId);
25925
26116
  this._callAppListener('onAnchorTrackPublish', newTracks);
25926
26117
  }
25927
26118
  if (unpublishedList.length) {
@@ -25936,7 +26127,7 @@
25936
26127
  const trackId = getTrackId(item);
25937
26128
  return this._remoteTracks[trackId];
25938
26129
  });
25939
- yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish');
26130
+ yield this._onUserUnpublish(tracks, 'onAnchorTrackUnpublish', traceId);
25940
26131
  }
25941
26132
  if (modifiedList.length) {
25942
26133
  const resIds = nowRes.map(getTrackId);
@@ -25948,27 +26139,17 @@
25948
26139
  nowRes[index].state = item.state;
25949
26140
  const rTrack = this._remoteTracks[id];
25950
26141
  rTrack.__innerSetRemoteMuted(item.state === 0);
25951
- if (rTrack.isAudioTrack()) {
25952
- (_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({
25953
- status: RCLoggerStatus.SUCCESSED,
25954
- eventType: 'onAudioMuteChange',
25955
- trackId: rTrack.getTrackId(),
25956
- }));
25957
- this._callAppListener('onAudioMuteChange', rTrack);
25958
- }
25959
- else {
25960
- (_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({
25961
- status: RCLoggerStatus.SUCCESSED,
25962
- eventType: 'onVideoMuteChange',
25963
- trackId: rTrack.getTrackId(),
25964
- }));
25965
- this._callAppListener('onVideoMuteChange', rTrack);
25966
- }
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);
25967
26148
  }
25968
26149
  }
25969
26150
  });
25970
26151
  }
25971
- _onUserUnpublish(tracks, eventName) {
26152
+ _onUserUnpublish(tracks, eventName, traceId) {
25972
26153
  var _a, _b;
25973
26154
  return __awaiter(this, void 0, void 0, function* () {
25974
26155
  // 需要替业务层取消订阅,业务层只需关注 UI 变化
@@ -25980,18 +26161,16 @@
25980
26161
  delete this._remoteTracks[item.getTrackId()];
25981
26162
  });
25982
26163
  // 通知 APP 取消发布的 tracks
25983
- (_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({
25984
- 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({
25985
26165
  eventType: eventName,
25986
26166
  trackIds: tracks.map((track) => track.getTrackId()),
25987
- }));
26167
+ }), traceId);
25988
26168
  this._callAppListener(eventName, tracks);
25989
26169
  });
25990
26170
  }
25991
26171
  _callAppListener(eventType, ...attrs) {
25992
- var _a, _b, _c, _d, _e;
25993
- (_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)}`);
25994
- 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];
25995
26174
  if (!handle) {
25996
26175
  return;
25997
26176
  }
@@ -25999,7 +26178,7 @@
25999
26178
  handle(...attrs);
26000
26179
  }
26001
26180
  catch (error) {
26002
- (_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));
26003
26182
  }
26004
26183
  }
26005
26184
  /**
@@ -26008,17 +26187,15 @@
26008
26187
  _reTryExchange() {
26009
26188
  return __awaiter(this, void 0, void 0, function* () {
26010
26189
  push(() => __awaiter(this, void 0, void 0, function* () {
26011
- var _a, _b, _c, _d, _e;
26190
+ var _a;
26012
26191
  const { reqBody } = yield this._createSubscribeParams(this._subscribedList, {}, true);
26013
26192
  // 发送 /exchange 请求
26014
26193
  const resp = yield this._exchangeHandle(reqBody);
26015
26194
  if (resp.code !== exports.RCRTCCode.SUCCESS) {
26016
- (_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}`);
26017
26195
  return { code: resp.code };
26018
26196
  }
26019
26197
  const { sdp: answer, resultCode } = resp.data;
26020
26198
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
26021
- (_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}`);
26022
26199
  return { code: resultCode };
26023
26200
  }
26024
26201
  // 请求成功,清除 ice 断线重连的定时器
@@ -26026,7 +26203,7 @@
26026
26203
  const mcuSubList = this._subscribedList.filter((item) => item.track.isMCUTrack());
26027
26204
  if (mcuSubList.length > 0) {
26028
26205
  const mcuTrackId = mcuSubList[0].track.getTrackId();
26029
- 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;
26030
26207
  const currentMsid = [this._roomId, 'RongCloudRTC'].join('_');
26031
26208
  answer.sdp = answer.sdp.replace(new RegExp(sdpMsid, 'g'), currentMsid);
26032
26209
  }
@@ -26093,23 +26270,28 @@
26093
26270
  });
26094
26271
  }
26095
26272
  _subscribeHandle(tracks, forceReq = false) {
26096
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26273
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26097
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);
26098
26280
  const roomStatusCode = this._assertRoomDestroyed();
26099
26281
  if (roomStatusCode) {
26100
- (_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({
26101
26283
  status: RCLoggerStatus.FAILED,
26102
26284
  code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,
26103
26285
  msg: 'room destroyed',
26104
- }));
26286
+ }), traceId);
26105
26287
  return { code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26106
26288
  }
26107
26289
  if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack || item.track instanceof RCRemoteTrack), true)) {
26108
- (_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({
26109
26291
  status: RCLoggerStatus.FAILED,
26110
26292
  code: exports.RCRTCCode.PARAMS_ERROR,
26111
26293
  msg: 'params error -> tracks',
26112
- }));
26294
+ }), traceId);
26113
26295
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26114
26296
  }
26115
26297
  const { pc, pcName } = this._peerCManager.createPeerCList(tracks)[0];
@@ -26140,23 +26322,15 @@
26140
26322
  trackChanged = true;
26141
26323
  });
26142
26324
  if (!trackChanged && !forceReq) {
26143
- (_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({
26144
- status: RCLoggerStatus.FAILED,
26145
- 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,
26146
26327
  msg: 'repeat subscribe',
26147
- }));
26328
+ }), traceId);
26148
26329
  return { code: exports.RCRTCCode.SUCCESS };
26149
26330
  }
26150
26331
  // 北极星上报
26151
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.BEGIN, R2TrackIds);
26152
- (_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({
26153
- status: RCLoggerStatus.SUCCESSED,
26154
- trackIds: tracks.map(getTrackIdFromAttr),
26155
- roomId: this._roomId,
26156
- userId: this._crtUserId,
26157
- forceReq,
26158
- }));
26159
- 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);
26160
26334
  });
26161
26335
  }
26162
26336
  /**
@@ -26170,12 +26344,11 @@
26170
26344
  const trackId = [msid, track.kind === 'audio' ? exports.RCMediaType.AUDIO_ONLY : exports.RCMediaType.VIDEO_ONLY].join('_');
26171
26345
  const rTrack = this._remoteTracks[trackId];
26172
26346
  if (!rTrack) {
26173
- (_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}`);
26174
26348
  return;
26175
26349
  }
26176
26350
  rTrack.__innerSetMediaStreamTrack(track);
26177
- (_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({
26178
- 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({
26179
26352
  eventType: 'onTrackReady',
26180
26353
  trackId: rTrack.getTrackId(),
26181
26354
  }));
@@ -26184,31 +26357,23 @@
26184
26357
  }
26185
26358
  _getReqHeaders() {
26186
26359
  const userId = this._crtUserId;
26360
+ /**
26361
+ * 如果是单 peerConnection 则不需要 在 Header中添加 'Peer-Connection-Id'
26362
+ */
26363
+ const peerConnectionId = this._useMutilPeerC ? { 'Peer-Connection-Id': this._pcName } : {};
26187
26364
  // 直播观众端 RoomId 与 UserId 保持一致
26188
- return {
26189
- 'App-Key': this._context.getAppkey(),
26190
- RoomId: userId,
26191
- Token: this._joinResData.token,
26192
- RoomType: RTCMode.LIVE,
26193
- UserId: userId,
26194
- 'Session-Id': this._sessionId,
26195
- 'Peer-Connection-Id': this._pcName,
26196
- 'Client-Session-Id': this._clientSessionId,
26197
- };
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);
26198
26366
  }
26199
26367
  _exchangeHandle(body) {
26200
26368
  return this._service.broadcastSubscribe(this._getReqHeaders(), body);
26201
26369
  }
26202
- _updateSubListHandle(tracks, forceReq = false) {
26203
- 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;
26204
26372
  return __awaiter(this, void 0, void 0, function* () {
26205
- const roomStatusCode = this._assertRoomDestroyed();
26206
- if (roomStatusCode) {
26207
- return { code: exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED };
26208
- }
26209
- if (!engine.validate('resources', tracks, () => engine.isArray(tracks) && tracks.every((res) => res instanceof RCRemoteTrack || res.track instanceof RCRemoteTrack), true)) {
26210
- return { code: exports.RCRTCCode.PARAMS_ERROR };
26211
- }
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);
26212
26377
  let attrs = tracks.map((item) => (item instanceof RCRemoteTrack ? { track: item } : Object.assign({}, item)));
26213
26378
  // resourceId 去重,并做数据深拷贝
26214
26379
  const map = {};
@@ -26243,6 +26408,10 @@
26243
26408
  changed = true;
26244
26409
  }
26245
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);
26246
26415
  return { code: exports.RCRTCCode.SUCCESS };
26247
26416
  }
26248
26417
  }
@@ -26252,12 +26421,6 @@
26252
26421
  // 连通率相关埋点-订阅开始
26253
26422
  recordQualitySubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26254
26423
  recordQualityUnsubscribeData(this._roomId, this._clientSessionId, this._sessionId);
26255
- (_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({
26256
- trackIds: tracks.map(getTrackIdFromAttr),
26257
- roomId: this._roomId,
26258
- userId: this._crtUserId,
26259
- forceReq,
26260
- }));
26261
26424
  // MediaServer 交互
26262
26425
  const { reqBody } = yield this._createSubscribeParams(attrs, {}, false);
26263
26426
  const result = yield this._exchangeHandle(reqBody);
@@ -26267,16 +26430,24 @@
26267
26430
  crtSubList.forEach((item) => {
26268
26431
  resourceIds.push(item.track.getTrackId());
26269
26432
  });
26270
- (_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);
26271
26434
  }
26272
26435
  if (result.code !== exports.RCRTCCode.SUCCESS) {
26273
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);
26274
26441
  return { code: result.code };
26275
26442
  }
26276
26443
  const { sdp: answer, resultCode, message, subscribedList, } = result.data;
26277
26444
  if (resultCode !== exports.RCRTCCode.SUCCESS) {
26278
26445
  reportQualitySubscribeAndUnsubscribeData(attrs, resultCode);
26279
- (_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);
26280
26451
  return { code: resultCode };
26281
26452
  }
26282
26453
  // 修改 answer.sdp 中 msid
@@ -26292,6 +26463,11 @@
26292
26463
  const resCode = yield this._pc.setRemoteAnswer(answer.sdp);
26293
26464
  if (resCode !== exports.RCRTCCode.SUCCESS) {
26294
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);
26295
26471
  return { code: resCode };
26296
26472
  }
26297
26473
  reportQualitySubscribeAndUnsubscribeData(attrs, resCode);
@@ -26314,6 +26490,11 @@
26314
26490
  }
26315
26491
  // 更新本地订阅关系
26316
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);
26317
26498
  return failedList.length ? { code: exports.RCRTCCode.SUCCESS, failedList } : { code: exports.RCRTCCode.SUCCESS };
26318
26499
  });
26319
26500
  }
@@ -26321,17 +26502,16 @@
26321
26502
  * 对比 cdn_uris 资源
26322
26503
  * @param newCDNUris 新的 cdn_uris 数据
26323
26504
  */
26324
- _diffCDNUris(newCDNUris) {
26505
+ _diffCDNUris(newCDNUris, traceId) {
26325
26506
  var _a, _b, _c, _d, _e, _f;
26326
26507
  return __awaiter(this, void 0, void 0, function* () {
26327
26508
  /**
26328
26509
  * CDN 资源减少: 上次 CDNUris 中有 url,变更后无 url
26329
26510
  */
26330
26511
  if (this._CDNUris.url && !newCDNUris.url) {
26331
- (_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({
26332
- 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({
26333
26513
  eventType: 'onCDNInfoDisable',
26334
- }));
26514
+ }), traceId);
26335
26515
  this._callAppListener('onCDNInfoDisable');
26336
26516
  /**
26337
26517
  * 更新内存中存储的 cdn_uris 数据
@@ -26345,12 +26525,11 @@
26345
26525
  * 上次 CDNUris 无 url,变更后有 url
26346
26526
  */
26347
26527
  if (!this._CDNUris || (!this._CDNUris.url && newCDNUris.url)) {
26348
- (_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({
26349
- 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({
26350
26529
  eventType: 'onCDNInfoEnable',
26351
26530
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26352
26531
  fps: `FPS_${newCDNUris.fps}`,
26353
- }));
26532
+ }), traceId);
26354
26533
  this._callAppListener('onCDNInfoEnable', {
26355
26534
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26356
26535
  fps: `FPS_${newCDNUris.fps}`,
@@ -26363,12 +26542,11 @@
26363
26542
  const isHChange = (this._CDNUris.h && newCDNUris.h && (this._CDNUris.h !== newCDNUris.h));
26364
26543
  const isFpsChange = (this._CDNUris.fps && newCDNUris.fps && (this._CDNUris.fps !== newCDNUris.fps));
26365
26544
  if (isWChange || isHChange || isFpsChange) {
26366
- (_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({
26367
- 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({
26368
26546
  eventType: 'onCDNInfoChange',
26369
26547
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26370
26548
  fps: `FPS_${newCDNUris.fps}`,
26371
- }));
26549
+ }), traceId);
26372
26550
  this._callAppListener('onCDNInfoChange', {
26373
26551
  resolution: `W${newCDNUris.w}_H${newCDNUris.h}`,
26374
26552
  fps: `FPS_${newCDNUris.fps}`,
@@ -26385,14 +26563,18 @@
26385
26563
  * _CDNUris 无 url 时,说明未开启 CDN 推送
26386
26564
  * @returns CDNPlayUrl
26387
26565
  */
26388
- _getCDNPlayUrl(params) {
26389
- var _a, _b, _c, _d, _e, _f;
26566
+ _getCDNPlayUrl(params, traceId) {
26567
+ var _a, _b;
26390
26568
  return __awaiter(this, void 0, void 0, function* () {
26391
26569
  const { w, h, fps } = params;
26392
26570
  const kind = this._initOptions.pullInnerCDNProtocol || exports.RCInnerCDNPullKind.FLV;
26393
26571
  const useHttps = (this._initOptions.pullInnerCDNUseHttps === exports.RCInnerCDNPullIsHttps.NOT_HTTPS) ? exports.RCInnerCDNPullIsHttps.NOT_HTTPS : exports.RCInnerCDNPullIsHttps.HTTPS;
26394
26572
  if (!this._CDNUris.url) {
26395
- (_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);
26396
26578
  return { code: exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY };
26397
26579
  }
26398
26580
  const headers = {
@@ -26421,12 +26603,10 @@
26421
26603
  const paramsStr = paramsArr.join('&');
26422
26604
  let requestUrl = `${this._CDNUris.url}?`;
26423
26605
  paramsStr && (requestUrl += paramsStr);
26424
- const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl);
26606
+ const { code, res } = yield this._service.getCDNResourceInfo(headers, requestUrl, traceId);
26425
26607
  if (code !== exports.RCRTCCode.SUCCESS) {
26426
- (_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}`);
26427
26608
  return { code };
26428
26609
  }
26429
- (_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}`);
26430
26610
  return {
26431
26611
  code,
26432
26612
  CDNPlayUrl: res === null || res === void 0 ? void 0 : res.data.pull_url,
@@ -26438,28 +26618,27 @@
26438
26618
  * @returns CDNPlayUrl
26439
26619
  */
26440
26620
  getCDNPlayUrl(resolution, fps) {
26441
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26621
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26442
26622
  return __awaiter(this, void 0, void 0, function* () {
26443
- (_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({
26444
26625
  resolution,
26445
26626
  fps,
26446
- }));
26627
+ }), traceId);
26447
26628
  if (resolution && !isValidResolution(resolution)) {
26448
- (_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');
26449
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({
26450
26630
  status: RCLoggerStatus.FAILED,
26451
26631
  code: exports.RCRTCCode.PARAMS_ERROR,
26452
26632
  msg: 'params error -> resolution',
26453
- }));
26633
+ }), traceId);
26454
26634
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26455
26635
  }
26456
26636
  if (fps && !isValidFPS(fps)) {
26457
- (_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');
26458
- (_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({
26459
26638
  status: RCLoggerStatus.FAILED,
26460
26639
  code: exports.RCRTCCode.PARAMS_ERROR,
26461
26640
  msg: 'params error -> fps',
26462
- }));
26641
+ }), traceId);
26463
26642
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26464
26643
  }
26465
26644
  const { width, height } = resolution ? transResolution(resolution) : { width: null, height: null };
@@ -26468,12 +26647,7 @@
26468
26647
  width && (params.w = width);
26469
26648
  height && (params.h = height);
26470
26649
  fpsNum && (params.fps = fpsNum);
26471
- (_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({
26472
- status: RCLoggerStatus.SUCCESSED,
26473
- resolution,
26474
- fps,
26475
- }));
26476
- return this._getCDNPlayUrl(params);
26650
+ return this._getCDNPlayUrl(params, traceId);
26477
26651
  });
26478
26652
  }
26479
26653
  /**
@@ -26496,33 +26670,34 @@
26496
26670
  __unsubscribe(tracks) {
26497
26671
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26498
26672
  return __awaiter(this, void 0, void 0, function* () {
26499
- (_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({
26500
26675
  trackIds: tracks.map((track) => track.getTrackId()),
26501
- roomId: this._roomId,
26502
- userId: this._crtUserId,
26503
- }));
26504
- if (!engine.validate('tracks', tracks, () => engine.isArray(tracks) && tracks.length > 0 && tracks.every((item) => item instanceof RCRemoteTrack), true)) {
26505
- (_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) {
26506
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({
26507
26688
  status: RCLoggerStatus.FAILED,
26508
26689
  code: exports.RCRTCCode.PARAMS_ERROR,
26509
26690
  msg: 'params error -> tracks',
26510
- }));
26691
+ }), traceId);
26511
26692
  return { code: exports.RCRTCCode.PARAMS_ERROR };
26512
26693
  }
26513
26694
  // 计算剩余订阅列表
26514
26695
  const crtSubList = this._subscribedList.map((item) => (Object.assign({}, item)))
26515
26696
  .filter((item) => !tracks.includes(item.track));
26516
26697
  // 北极星上报
26517
- (_g = this._polarisReport) === null || _g === void 0 ? void 0 : _g.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26518
- (_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({
26519
- status: RCLoggerStatus.SUCCESSED,
26520
- trackIds: tracks.map((track) => track.getTrackId()),
26521
- roomId: this._roomId,
26522
- userId: this._crtUserId,
26523
- }));
26698
+ (_j = this._polarisReport) === null || _j === void 0 ? void 0 : _j.sendR2(R2Action.SUBSCRIBE, R2Status.END, tracks.map((item) => item.getTrackId()));
26524
26699
  recordUnsubscribeCommand(true);
26525
- return this._updateSubListHandle(crtSubList, false);
26700
+ return this._updateSubListHandle(crtSubList, false, traceId);
26526
26701
  });
26527
26702
  }
26528
26703
  /**
@@ -26593,15 +26768,18 @@
26593
26768
  * 断线重连后处理逻辑, SDK 内部处理调用
26594
26769
  */
26595
26770
  __onReconnected() {
26596
- var _a, _b;
26771
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26597
26772
  return __awaiter(this, void 0, void 0, function* () {
26598
26773
  /**
26599
26774
  * 重新加入房间后,从头拉取全量资源
26600
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);
26601
26778
  const { code } = yield this._context.joinLivingRoomAsAudience(this._roomId, RTCMode.LIVE);
26602
26779
  if (code !== engine.ErrorCode.SUCCESS) {
26603
- (_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);
26604
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);
26605
26783
  });
26606
26784
  }
26607
26785
  /**
@@ -26621,8 +26799,7 @@
26621
26799
  (_a = this._audioLevelReport) === null || _a === void 0 ? void 0 : _a.clearAudioLevelReportTimer();
26622
26800
  this._audioLevelReport = new RCAudioLevelReport(this);
26623
26801
  this._audioLevelReport.onAudioLevelChange(handler, gap || 1000);
26624
- (_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({
26625
- 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({
26626
26803
  handler: handler === null || handler === void 0 ? void 0 : handler.name,
26627
26804
  gap,
26628
26805
  }));
@@ -27901,7 +28078,7 @@
27901
28078
  }
27902
28079
  reportSDKInfo() {
27903
28080
  this._context.reportSDKInfo({
27904
- 'plugin-rtc': "5.6.3-alpha.2",
28081
+ 'plugin-rtc': "5.6.3-alpha.5",
27905
28082
  });
27906
28083
  }
27907
28084
  }
@@ -28523,15 +28700,19 @@ message probuf {
28523
28700
  * @param valueInfo 全量资源数据
28524
28701
  * @param objectName 全量 URI 消息名
28525
28702
  */
28526
- setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28703
+ setRTCTotalRes(roomId, messageList, valueInfo, objectName, mcuValInfo, cdnValInfo) {
28527
28704
  return __awaiter(this, void 0, void 0, function* () {
28528
28705
  const params = {
28529
28706
  objectName,
28530
- content: this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true),
28707
+ content: [],
28531
28708
  valueInfo: [
28532
28709
  this.codec.encode(RTCPB.RtcValueInfo, { key: 'uris', value: valueInfo }, true),
28533
28710
  ],
28534
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
+ });
28535
28716
  mcuValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true));
28536
28717
  cdnValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'cdn_uris', value: cdnValInfo }, true));
28537
28718
  const sourceData = this.codec.encode(RTCPB.RtcUserSetDataInput, params);
@@ -28890,7 +29071,7 @@ message probuf {
28890
29071
  console.error('Please use the https protocol or use `http://localhost` to open the page!');
28891
29072
  return false;
28892
29073
  }
28893
- engine.VersionManage.add('plugin-rtc', "5.6.3-alpha.2");
29074
+ engine.VersionManage.add('plugin-rtc', "5.6.3-alpha.5");
28894
29075
  if (!engine.VersionManage.validEngine("^5.6.0")) {
28895
29076
  console.error(`The current engine version '${engine.VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
28896
29077
  return false;
@@ -28904,8 +29085,8 @@ message probuf {
28904
29085
  RTCLogger.setLogger(originLogger);
28905
29086
  logger.setLogger(originLogger);
28906
29087
  originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
28907
- 'RCRTC Version': "5.6.3-alpha.2",
28908
- Commit: "2fda2b34be0736183519f005f2d4157acd8a3161",
29088
+ 'RCRTC Version': "5.6.3-alpha.5",
29089
+ Commit: "48fe4c6914037db2dfd263f31aba741834041487",
28909
29090
  'browserInfo.browser': browserInfo.browser,
28910
29091
  'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
28911
29092
  'browserInfo.version': browserInfo.version,