@xylink/xy-rtc-sdk 3.10.0-beta.4 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.MD +36 -13
  2. package/lib/action/index.d.ts +61 -45
  3. package/lib/enum/analyser.d.ts +7 -0
  4. package/lib/enum/client.d.ts +8 -2
  5. package/lib/enum/constraints.d.ts +11 -16
  6. package/lib/enum/device.d.ts +0 -6
  7. package/lib/enum/errorCode.d.ts +5 -2
  8. package/lib/enum/index.d.ts +45 -7
  9. package/lib/enum/polling.d.ts +2 -0
  10. package/lib/feature/customMessage/index.d.ts +29 -0
  11. package/lib/feature/edu/index.d.ts +34 -0
  12. package/lib/feature/edu/index.type.d.ts +29 -0
  13. package/lib/feature/index.d.ts +3 -1
  14. package/lib/feature/{speaker.d.ts → speaker/index.d.ts} +29 -9
  15. package/lib/feature/speaker/index.type.d.ts +17 -0
  16. package/lib/index.d.ts +82 -28
  17. package/lib/interface/baseModule.type.d.ts +9 -0
  18. package/lib/interface/clientInterface.type.d.ts +128 -0
  19. package/lib/interface/contentTrackInterface.type.d.ts +15 -0
  20. package/lib/interface/event.type.d.ts +444 -0
  21. package/lib/interface/videoAudioTrackInterface.type.d.ts +17 -0
  22. package/lib/main/ability/const.d.ts +4 -1
  23. package/lib/main/ability/index.d.ts +7 -1
  24. package/lib/main/{auth.d.ts → auth/index.d.ts} +29 -19
  25. package/lib/main/client.d.ts +594 -633
  26. package/lib/main/clientBase.d.ts +40 -0
  27. package/lib/main/clientState.d.ts +56 -0
  28. package/lib/main/{deviceManager.d.ts → device/index.d.ts} +45 -13
  29. package/lib/{type/device.d.ts → main/device/index.type.d.ts} +65 -16
  30. package/lib/main/helper/index.d.ts +118 -0
  31. package/lib/main/helper/index.type.d.ts +12 -0
  32. package/lib/main/layout/index.d.ts +118 -105
  33. package/lib/main/layout/index.type.d.ts +282 -0
  34. package/lib/main/layout/polling.d.ts +212 -0
  35. package/lib/main/layout/state.d.ts +163 -0
  36. package/lib/main/layout/template.d.ts +15 -7
  37. package/lib/main/media/index.d.ts +177 -0
  38. package/lib/main/media/index.type.d.ts +29 -0
  39. package/lib/main/meeting/control.d.ts +107 -0
  40. package/lib/main/meeting/control.type.d.ts +24 -0
  41. package/lib/main/{meeting.d.ts → meeting/index.d.ts} +51 -7
  42. package/lib/main/meeting/verify.d.ts +70 -0
  43. package/lib/main/meeting/verify.type.d.ts +12 -0
  44. package/lib/main/peer.d.ts +120 -41
  45. package/lib/main/plugin/index.d.ts +28 -0
  46. package/lib/{tools/quality.d.ts → main/quality/index.d.ts} +2 -2
  47. package/lib/{tools → main/quality}/quality.worker.d.ts +1 -1
  48. package/lib/main/{qualityManager.d.ts → quality/report.d.ts} +11 -5
  49. package/lib/main/render/index.d.ts +116 -0
  50. package/lib/main/render/index.type.d.ts +36 -0
  51. package/lib/main/{videoManager.d.ts → render/videoManager.d.ts} +78 -28
  52. package/lib/main/render/videoManager.type.d.ts +66 -0
  53. package/lib/main/roster/index.d.ts +39 -0
  54. package/lib/main/server/index.d.ts +79 -0
  55. package/lib/main/server/index.type.d.ts +21 -0
  56. package/lib/main/signal/index.d.ts +15 -0
  57. package/lib/main/socket/index.d.ts +95 -0
  58. package/lib/main/stream/index.d.ts +182 -0
  59. package/lib/main/track/baseTrack.d.ts +178 -0
  60. package/lib/main/track/contentTrack.d.ts +168 -0
  61. package/lib/main/track/customContentTrack.d.ts +18 -0
  62. package/lib/main/track/customVideoAudioTrack.d.ts +18 -0
  63. package/lib/main/track/helper.d.ts +65 -0
  64. package/lib/main/track/videoAudioCapture.d.ts +90 -0
  65. package/lib/main/track/videoAudioTrack.d.ts +273 -0
  66. package/lib/main/vom/index.d.ts +44 -0
  67. package/lib/main/vom/index.type.d.ts +1 -0
  68. package/lib/tools/analyser.d.ts +30 -7
  69. package/lib/tools/analyserManager.d.ts +55 -0
  70. package/lib/tools/dbManager.d.ts +12 -1
  71. package/lib/tools/{browser.d.ts → detectBrowser/index.d.ts} +53 -5
  72. package/lib/tools/detectStream/index.d.ts +84 -0
  73. package/lib/tools/detectStream/index.type.d.ts +56 -0
  74. package/lib/tools/detectTool/index.d.ts +191 -0
  75. package/lib/tools/detectTool/index.type.d.ts +51 -0
  76. package/lib/tools/emitter.d.ts +27 -6
  77. package/lib/tools/enum.d.ts +1 -1
  78. package/lib/tools/httpClient.d.ts +5 -1
  79. package/lib/tools/i18n.d.ts +1 -1
  80. package/lib/tools/index.d.ts +1 -8
  81. package/lib/tools/log/logger.d.ts +44 -24
  82. package/lib/tools/log/logger.worker.d.ts +1 -1
  83. package/lib/tools/log/loggerManager.d.ts +3 -2
  84. package/lib/tools/pressure/index.d.ts +33 -0
  85. package/lib/tools/pressure/index.type.d.ts +22 -0
  86. package/lib/tools/promiseQueue.d.ts +6 -0
  87. package/lib/tools/regex.d.ts +4 -0
  88. package/lib/tools/resize.d.ts +3 -0
  89. package/lib/tools/snapshot.d.ts +1 -1
  90. package/lib/tools/socket.d.ts +12 -2
  91. package/lib/tools/template/index.d.ts +11 -88
  92. package/lib/tools/template/mobile.d.ts +1 -1
  93. package/lib/tools/template/polling.d.ts +8 -0
  94. package/lib/tools/utils.d.ts +25 -16
  95. package/lib/tools/verify.d.ts +7 -0
  96. package/lib/type/ability.d.ts +1 -1
  97. package/lib/type/analyser.d.ts +26 -1
  98. package/lib/type/auth.d.ts +22 -22
  99. package/lib/type/base.d.ts +36 -32
  100. package/lib/type/capture.d.ts +9 -0
  101. package/lib/type/client.d.ts +379 -498
  102. package/lib/type/index.d.ts +25 -2
  103. package/lib/type/layout.d.ts +84 -47
  104. package/lib/type/logger.d.ts +19 -12
  105. package/lib/type/meeting.d.ts +89 -68
  106. package/lib/type/peer.d.ts +65 -1
  107. package/lib/type/polling.d.ts +194 -0
  108. package/lib/type/quality.d.ts +16 -6
  109. package/lib/type/socket.d.ts +0 -18
  110. package/lib/type/stream.d.ts +138 -108
  111. package/lib/type/track.d.ts +139 -0
  112. package/lib/xyrtc.cjs.js +1 -1
  113. package/lib/xyrtc.umd.js +1 -1
  114. package/package.json +13 -10
  115. package/lib/main/clientImplements.d.ts +0 -99
  116. package/lib/main/helper.d.ts +0 -104
  117. package/lib/main/stream.d.ts +0 -418
  118. package/lib/tools/detect.d.ts +0 -44
@@ -0,0 +1,107 @@
1
+ import XYRTCClient from '../client';
2
+ import { OriginalNotification, OriginalRealTimeNotification, IReturnResult, ISubTitle, IEPMessage, IWaitingState, IMeetingControl, IRecordStatusNotification, IRecordingStateChanged, XYBaseModule } from '../../type/index';
3
+ export declare class XYMeetingControl implements XYBaseModule {
4
+ private client;
5
+ private logger;
6
+ private action;
7
+ private onhold;
8
+ private handStatus;
9
+ private cacheMeetingControlMessage;
10
+ private recordStatusNotification;
11
+ private recordState;
12
+ constructor(client: XYRTCClient);
13
+ destroy(): void;
14
+ getOnHold(): boolean;
15
+ /**
16
+ * 设置本地是否在等候室
17
+ *
18
+ * @param { boolean } onhold - 是否在等候室
19
+ */
20
+ setOnHold(onhold: boolean): boolean;
21
+ /**
22
+ * 本地举手、结束发言等操作
23
+ *
24
+ * @param { 'handup' | 'handdown' | 'mute' } type 操作类型
25
+ * @param { boolean } handStatus 是否举手
26
+ * @returns { Promise<boolean> } 举手状态
27
+ */
28
+ onHand(type: 'handup' | 'handdown' | 'mute', handStatus: boolean): Promise<boolean>;
29
+ /**
30
+ * 处理联席主持人/主持人/改名权限 等消息
31
+ *
32
+ * @param { OriginalNotification } data - 消息内容
33
+ */
34
+ handleNotificationMessage(data: OriginalNotification): void;
35
+ /**
36
+ * 会控互动工具相关数据, 签到等
37
+ *
38
+ * @param { OriginalRealTimeNotification } data - 信令下发的原始数据
39
+ */
40
+ handleRealTimeNotificationMessage(data: OriginalRealTimeNotification): Promise<void>;
41
+ /**
42
+ * 获取签到文案
43
+ *
44
+ * @property { SignInTextParams } - 参数
45
+ * @returns { Promise<SignInText | null> } - 签到文案
46
+ */
47
+ private getSignInText;
48
+ /**
49
+ * 签到
50
+ *
51
+ * @property { string } questionnaireId - 业务ID
52
+ * @returns { Promise<IReturnResult> } - 签到结果
53
+ */
54
+ signIn(questionnaireId: string): Promise<IReturnResult>;
55
+ /**
56
+ * 上报Web轮询能力
57
+ */
58
+ reportPollingCapability(): Promise<void>;
59
+ /**
60
+ * 处理字幕、点名消息
61
+ *
62
+ * @param { ISubTitle } data - 字幕、点名消息
63
+ */
64
+ onSubTitle(data: ISubTitle): void;
65
+ /**
66
+ * 处理会控上报开启/关闭摄像头事件
67
+ *
68
+ * @param { Object } data - 远端数据
69
+ */
70
+ handleEPMessage(data: IEPMessage): void;
71
+ /**
72
+ * 处理等候室状态
73
+ *
74
+ * @param { IWaitingState } data
75
+ */
76
+ handleWaitingState(data: IWaitingState): void;
77
+ /**
78
+ * 会议重连后,重新处理缓存的会控消息
79
+ */
80
+ resendMeetingControlMessage(): Promise<void>;
81
+ /**
82
+ * 处理会控消息,如音频、主会场、content等
83
+ *
84
+ * @param { IMeetingControl } data 会控消息
85
+ */
86
+ onMeetingControlMessage(data: IMeetingControl): Promise<void>;
87
+ /**
88
+ * 处理本地录制结果上报Message
89
+ *
90
+ * @param { IRecordingStateChanged } data - 录制状态
91
+ */
92
+ onRecordingStateChangedMessage(data: IRecordingStateChanged): void;
93
+ /**
94
+ * 处理远端录制状态上报
95
+ *
96
+ * @param { IRecordStatusNotification } data - 录制状态
97
+ */
98
+ onRecordStatusNotificationMessage(data: IRecordStatusNotification): void;
99
+ /**
100
+ * 上报远端录制状态
101
+ */
102
+ emitRecordStatusNotification(): void;
103
+ /**
104
+ * 停止云端录制
105
+ */
106
+ stopCloudRecord(): IReturnResult | Promise<never>;
107
+ }
@@ -0,0 +1,24 @@
1
+ import { EVENT_TYPE } from '../../type/index';
2
+ /**
3
+ * 信令上报原始的消息
4
+ *
5
+ * @property { number } subType - 消息类型
6
+ * @property { string } content - 消息详细内容
7
+ * @property { string } requestId - 消息ID
8
+ */
9
+ export interface OriginalNotification {
10
+ subType: number;
11
+ content: string;
12
+ requestId: string;
13
+ }
14
+ /**
15
+ * 会控互动工具相关数据, 签到等
16
+ */
17
+ export interface OriginalRealTimeNotification {
18
+ count: number;
19
+ events: {
20
+ content: string;
21
+ type: EVENT_TYPE;
22
+ action: EVENT_TYPE;
23
+ }[];
24
+ }
@@ -2,10 +2,10 @@
2
2
  * Meeting Info Control
3
3
  *
4
4
  * Created at : 2022-10-27 13:58:22
5
- * Last modified : 2023-11-03 11:46:29
5
+ * Last modified : 2024-06-07 18:34:37
6
6
  */
7
- import { IRecordPermission, IExportUserInfo, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap, InviteInfo, MEETING_DIRECTION } from '../type';
8
- import Client from './client';
7
+ import { IConferenceInfo, IRecordPermission, IExportUserInfo, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap, InviteInfo, MEETING_DIRECTION, IVideoProfile, IMeetingControl, FocusViewAction } from '../../type/index';
8
+ import Client from '../client';
9
9
  declare class Meeting {
10
10
  private client;
11
11
  private logger;
@@ -18,6 +18,7 @@ declare class Meeting {
18
18
  private mediaConfig;
19
19
  private enterpriseConfig;
20
20
  private userInfo;
21
+ private meetingControlInfo;
21
22
  constructor(client: Client);
22
23
  getRecordPermission(): IRecordPermission;
23
24
  getLayoutImageAvatarMap(): Map<string, {
@@ -26,7 +27,15 @@ declare class Meeting {
26
27
  }>;
27
28
  getEnterpriseMediaConfig(): IMediaConfig;
28
29
  getUserInfo(): IExportUserInfo | null;
30
+ getConferenceInfo(): IConferenceInfo;
29
31
  getLayoutAvatarType(): LayoutAvatarType;
32
+ getMeetingControlInfo(): IMeetingControl | null;
33
+ /**
34
+ * 设置会控消息
35
+ *
36
+ * @param { IMeetingControl } info
37
+ */
38
+ setMeetingControlInfo(info: IMeetingControl): void;
30
39
  /**
31
40
  * 登录用户信息和个人云会议室信息
32
41
  */
@@ -68,6 +77,11 @@ declare class Meeting {
68
77
  * 获取个人云会议室信息,包含入会密码和个人云会议室号
69
78
  */
70
79
  getCloudMeetingRooms(): Promise<void>;
80
+ /**
81
+ * 获取会议控制信息, 包含是否是主持人、是否需要会控密码
82
+ *
83
+ */
84
+ handleMeetingControlInfo(): Promise<void>;
71
85
  /**
72
86
  * 设置Layout头像
73
87
  * 如果有自定义头像,无论oms配置什么,都显示自定义的图片头像
@@ -100,10 +114,10 @@ declare class Meeting {
100
114
  */
101
115
  private getVCConfInfo;
102
116
  /**
103
- * 获取Content水印内容
117
+ * 获取水印内容及范围
104
118
  *
105
119
  * @private
106
- * @param { string } confAuxProperties 水印内容
120
+ * @param { string } confAuxProperties - 水印配置信息
107
121
  */
108
122
  private getWatermarkContent;
109
123
  /**
@@ -114,6 +128,19 @@ declare class Meeting {
114
128
  * 2023-8-3 鉴于安全考虑,此接口需提供MeetingId字段;
115
129
  */
116
130
  getMeetingInviteInfo(): Promise<InviteInfo>;
131
+ /**
132
+ * 通过会控设置焦点画面
133
+ *
134
+ * @param { string } id - 指定切换到焦点画面的endpointId
135
+ * @returns
136
+ */
137
+ setMeetingFocusView(id: string, action: FocusViewAction): Promise<import("../../type/index").IReturnResult>;
138
+ /**
139
+ * 修改参会者名称,目前仅支持修改Local
140
+ *
141
+ * @param { string } newName - 新名称
142
+ */
143
+ rename(newName: string, callback?: () => void): Promise<import("../../type/index").IReturnResult | undefined>;
117
144
  /**
118
145
  * 企业配置信息
119
146
  *
@@ -127,6 +154,13 @@ declare class Meeting {
127
154
  * @param { MEETING_DIRECTION } direction - 配置上下行方向配置
128
155
  */
129
156
  processMediaConfig(direction: MEETING_DIRECTION): void;
157
+ /**
158
+ * 配置上行分辨率配置
159
+ *
160
+ * @param { MEETING_DIRECTION } direction - 配置上下行方向配置
161
+ * @param { IVideoProfile } profile - 配置最大分辨率/帧率
162
+ */
163
+ processVideoProfileConfig(direction: MEETING_DIRECTION, profile: IVideoProfile): void;
130
164
  /**
131
165
  * 企业配置信息
132
166
  *
@@ -134,6 +168,10 @@ declare class Meeting {
134
168
  * 2. 禁用语音转写英文翻译
135
169
  */
136
170
  setEnterpriseBuffetConfig(): Promise<void>;
171
+ /**
172
+ * 结束全体会议
173
+ */
174
+ endAllMeeting(): Promise<import("../../type/index").IReturnResult>;
137
175
  /**
138
176
  * 处理信令下发的等候室
139
177
  *
@@ -151,9 +189,15 @@ declare class Meeting {
151
189
  /**
152
190
  * 根据企业配置媒体能力,得到最终的请流参数
153
191
  *
154
- * @param {IReqInfo[]} reqInfoList 请流列表数据
155
- * @returns {IReqInfo[]}
192
+ * @param { IReqInfo[] } reqInfoList 请流列表数据
193
+ * @returns { IReqInfo[] } - 最终的请流列表
156
194
  */
157
195
  convertReqList(reqInfoList: IReqInfo[]): IReqInfo[];
196
+ /**
197
+ * 处理云会议室属性消息
198
+ *
199
+ * @param { object } data - 云会议室属性消息
200
+ */
201
+ handleConferencePropertiesMessage(data: any): void;
158
202
  }
159
203
  export default Meeting;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 校验模块,包含校验会议、会议密码等
3
+ *
4
+ * Created at : 2024-05-13 14:43:44
5
+ * Last modified : 2024-07-12 16:03:31
6
+ */
7
+ import { IReturnResult, XYBaseModule, XYCheckNumberParams } from '../../type/index';
8
+ import XYRTCClient from '../client';
9
+ export declare class Verify implements XYBaseModule {
10
+ private client;
11
+ private logger;
12
+ private action;
13
+ private meetingVerified;
14
+ constructor(client: XYRTCClient);
15
+ destroy(): void;
16
+ /**
17
+ * 校验会议室号
18
+ *
19
+ * @private
20
+ * @param { XYCheckNumberParams } params - 校验会议号参数
21
+ * @property { string } confNumber - 会议号
22
+ * @property { string } password - 会议密码
23
+ * @returns { Promise<IReturnResult> } - 结果
24
+ */
25
+ checkMeetingNumber(params: XYCheckNumberParams): Promise<IReturnResult>;
26
+ /**
27
+ * 校验会议室密码
28
+ *
29
+ * @param { XYCheckNumberParams } params - 呼叫的会议信息
30
+ * @property { string } params.confNumber - 会议号
31
+ * @property { string } params.password - 会议密码
32
+ * @returns { Promise<IReturnResult> } - 结果
33
+ */
34
+ checkMeetingPassword(params: XYCheckNumberParams): Promise<IReturnResult>;
35
+ /**
36
+ * 检查会议室类型是否支持
37
+ *
38
+ * @param { string } deviceType - 会议室类型
39
+ * @returns { boolean } - 是否支持呼叫
40
+ */
41
+ private isSupportedCall;
42
+ /**
43
+ * 处理密码验证逻辑
44
+ *
45
+ * @param { string } confNumber - 会议号
46
+ * @param { string } password - 密码
47
+ * @param { string | number } hideId - 是否是隐身入会模式
48
+ * @returns
49
+ */
50
+ private handlePasswordValidation;
51
+ /**
52
+ * 完成会议室校验,上报会议室信息
53
+ *
54
+ * @returns { Promise<IReturnResult> } - 校验结果
55
+ */
56
+ private completeMeetingVerify;
57
+ /**
58
+ * 校验会议室前置任务
59
+ *
60
+ * @returns { Promise<IReturnResult> } - 校验结果
61
+ */
62
+ private preVerifyTasks;
63
+ /**
64
+ * 校验会控主持密码
65
+ *
66
+ * @param { string } pwd - 会控密码
67
+ * @returns { Promise<IReturnResult> } - 校验结果
68
+ */
69
+ verifyControlPassword(pwd: string): Promise<IReturnResult>;
70
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 会议号和密码参数
3
+ *
4
+ * @param { string } confNumber - 必填,会议号
5
+ * @param { string } password - 可选,会议入会密码
6
+ * @param { string } __hideId - 可选,隐身ID
7
+ */
8
+ export interface XYCheckNumberParams {
9
+ confNumber: string;
10
+ password?: string;
11
+ __hideId?: string | number | undefined;
12
+ }
@@ -4,14 +4,13 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-25 18:53:01
6
6
  */
7
- import { IInvite, IStreamSender, ICandidate, PushType, ISenderMap } from '../type';
7
+ import { IStreamSender, ICandidate, PushType, ISenderMap, PeerState, ICEState } from '../type/index';
8
8
  import Client from './client';
9
9
  import Logger from '../tools/log/logger';
10
- import Stream from './stream';
10
+ import VideoAudioTrack from './track/videoAudioTrack';
11
+ import ContentTrack from './track/contentTrack';
11
12
  /**
12
- * Peer模块,用于管理 P2P 连接和内部事件
13
- *
14
- * @class Peer
13
+ * Peer模块,用于管理 P2S 连接和内部事件
15
14
  */
16
15
  export default class Peer {
17
16
  private connectTimer;
@@ -19,60 +18,92 @@ export default class Peer {
19
18
  client: Client;
20
19
  peerConnection: RTCPeerConnection | null;
21
20
  logger: Logger;
22
- invite: IInvite;
23
- peerStatus: {
24
- peerConnectionStatus: string;
25
- iceConnectionState: string;
21
+ connectState: {
22
+ peer: PeerState;
23
+ ice: ICEState;
26
24
  };
27
- stream: Stream;
28
25
  streamSenders: IStreamSender[];
29
26
  senderMap: ISenderMap;
30
27
  private senderTimer;
31
- private isRestartIceConnection;
32
- private isFirstConnected;
33
28
  private videoCodecs;
34
29
  private audioCodecs;
35
30
  private qualityWorker;
36
31
  private localIPAddress;
37
- constructor(client: Client, stream: Stream);
32
+ private peerLibStatus;
33
+ private firstCallState;
34
+ private peerCallState;
35
+ private isReceivedTrackMsg;
36
+ private isCreatedOffer;
37
+ private isReceivedAnswer;
38
+ private contentTrackSize;
39
+ private detectTrackMsgTimer;
40
+ private candidateList;
41
+ constructor(client: Client, isRenew?: boolean);
42
+ /**
43
+ * 初始化质量统计WebWorker模块
44
+ */
38
45
  private initQualityWorker;
39
- restart(): void;
40
46
  /**
41
47
  * 初始化Peer模块
42
48
  * 1. 创建PeerConnection
43
49
  * 2. 初始化监听事件
44
- *
45
- * @private
46
50
  */
47
51
  private init;
48
52
  /**
49
- * 向client发送呼叫状态
53
+ * 向Client发送消息
50
54
  *
51
55
  * @private
52
- * @param { string } type 消息Key
53
- * @param { string } code 状态码
54
- * @param { string } msg 消息内容
55
- * @param { any } detail 消息数据
56
+ * @param { XYClientEventKey } type - 消息Key
57
+ * @param { string } code - 状态码
58
+ * @param { string } msg - 消息内容
59
+ * @param { any } detail - 消息数据
56
60
  */
57
61
  private sendEmmit;
58
62
  /**
59
- * 停止呼叫状态检查timer
63
+ * 获取Peer是否连接成功
60
64
  *
61
- * @private
65
+ * @returns { boolean } - 是否连接成功
66
+ */
67
+ getPeerConnectionStatus(): boolean;
68
+ /**
69
+ * 停止状态检查定时器,重置重连状态
62
70
  */
63
71
  private stopConnectTimer;
64
72
  /**
65
- * 监听peer连接状态,Timeout:40s
73
+ * 启动检测监听到Track回调消息检测器
66
74
  *
67
- * @private
75
+ * 检测场景:当Peer连接成功,但是未收到Track消息,导致收音频/视频异常问题
76
+ * 检测次数:1次,如仍然失败,则直接退会
77
+ */
78
+ private startDetectTrackMsgTimer;
79
+ /**
80
+ * 清理Track回调检测器定时器
81
+ */
82
+ private stopDetectTrackMsgTimer;
83
+ /**
84
+ * 监听peer连接状态,Timeout:40s
68
85
  */
69
86
  private initTimer;
87
+ /**
88
+ * 处理各种与媒体协商失败报错异常
89
+ * 处理方式:上报结果并退会
90
+ *
91
+ * @param { string } code - 错误码
92
+ */
93
+ private handlePeerConnectError;
70
94
  /**
71
95
  * ice协商回调事件
72
96
  *
73
97
  * @private
74
98
  */
75
99
  private onHandleNegotiationNeeded;
100
+ /**
101
+ * 修改SDP内容
102
+ *
103
+ * @param { string } sdp - offer sdp报文信息
104
+ * @returns { string } - 修改后的报文
105
+ */
106
+ private appendExtmap;
76
107
  /**
77
108
  * 创建offer,并针对stream设置初始带宽
78
109
  *
@@ -93,11 +124,17 @@ export default class Peer {
93
124
  * 处理candidate消息
94
125
  *
95
126
  * @public
96
- * @param { ICandidate } body candidate消息内容
127
+ * @param { ICandidate } body - candidate消息内容
97
128
  */
98
129
  handleCandidate(body: ICandidate): Promise<void>;
99
130
  /**
100
- * 响应offer
131
+ * 缓存协商的Candidate节点信息
132
+ *
133
+ * @param { string } candidate - ICE Candidate协商节点信息
134
+ */
135
+ private cacheCandidateData;
136
+ /**
137
+ * 响应Answer
101
138
  *
102
139
  * @public
103
140
  * @param { RTCSessionDescriptionInit } answer answerSDP内容,设置到peerConnection上
@@ -116,33 +153,51 @@ export default class Peer {
116
153
  frameRate?: number | undefined;
117
154
  } | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
118
155
  /**
119
- * View the cb of ice connection status change
120
- * Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
156
+ * ICE Connection status change
121
157
  *
122
- * @private
123
- * @param { Event } e ice连接回调状态事件
158
+ * @param { Event } e - ICE状态回调事件
124
159
  */
125
160
  private onHandleIceConnectionStateChange;
126
161
  /**
127
- * peerConnection connect status change cb, only supports Chrome 72 or higher
128
- * pc.connectionState: connected,disconnected,failed,closed,connecting,new
162
+ * PeerConnection connect state change
129
163
  *
130
- * @private
164
+ * Only supports Chrome 72 or higher, Firefox 113 or higher
165
+ *
166
+ * @param { Event } e - ICE状态回调事件
131
167
  */
132
168
  private onHandleConnectionStateChange;
169
+ /**
170
+ * 统一处理WebRTC PeerConnection连接状态事件
171
+ */
172
+ private peerStateChange;
173
+ /**
174
+ * WebRTC ICE探测错误事件监听
175
+ *
176
+ * @param { Event } e - 错误信息
177
+ */
133
178
  onHandleIcecandidateerror(e: Event): void;
179
+ /**
180
+ * WebRTC ICE协商事件
181
+ *
182
+ * @param { any } ice - ICE报文
183
+ */
134
184
  private onHandleIcecandidate;
185
+ /**
186
+ * Peer已经连接成功
187
+ *
188
+ * @returns { boolean } - True或者False
189
+ */
190
+ get isPeerConnected(): boolean;
135
191
  /**
136
192
  * 重连PeerConnection
137
193
  *
138
- * @public
194
+ * @param { 'socket' | 'peer' } entry - 重连入口
139
195
  */
140
- restartIceConnection(isRestartIceConnection?: boolean): Promise<void>;
196
+ restartIceConnection(entry: 'socket' | 'peer'): Promise<void>;
141
197
  /**
142
198
  * 关闭PeerConnection连接、销毁状态
143
199
  */
144
- close(): void;
145
- setRestartIceConnection(isRestartIceConnection?: boolean): void;
200
+ destroy(): void;
146
201
  /**
147
202
  * Push people and content tracks of stream
148
203
  *
@@ -150,7 +205,7 @@ export default class Peer {
150
205
  * @param { Stream } stream - Stream Library
151
206
  * @param { PushType } pushType - 推送类型,All全推送、Video只推送video、Audio只推送audio、Content只推送content video流
152
207
  */
153
- publish(stream: Stream, pushType: PushType): void;
208
+ publish(track: VideoAudioTrack | ContentTrack, pushType: PushType): void;
154
209
  /**
155
210
  * people and content sender status
156
211
  *
@@ -173,8 +228,6 @@ export default class Peer {
173
228
  closeContentStream(): void;
174
229
  /**
175
230
  * Get peerConnection status
176
- *
177
- * @public
178
231
  */
179
232
  getPeerStatus(): boolean;
180
233
  /**
@@ -204,6 +257,16 @@ export default class Peer {
204
257
  * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
205
258
  */
206
259
  private streamConfigProcessor;
260
+ /**
261
+ * 计算一组StreamConfig中Track面积最小的尺寸信息
262
+ *
263
+ * @param { IStreamConfig[] } streamConfigList - An array of `IStreamConfig` objects
264
+ */
265
+ private calculateContentTrackSize;
266
+ /**
267
+ * 重置ContentTrack尺寸信息
268
+ */
269
+ resetContentTrackSize(): void;
207
270
  /**
208
271
  * 添加Track轨道数据
209
272
  *
@@ -233,6 +296,14 @@ export default class Peer {
233
296
  * @param { RTCRtpTransceiverDirection } direction - 通道方向
234
297
  */
235
298
  private replaceTrackProcessor;
299
+ /**
300
+ * 重置sender发送器的编码器scaleResolutionDownBy参数
301
+ *
302
+ * @param { MediaStreamTrack } track - MediaStreamTrack数据
303
+ * @param { RTCRtpSender } sender - 编码发送器
304
+ * @param { IStreamConfig } streamConfig - 自定义流配置
305
+ */
306
+ private resetEncodingsScale;
236
307
  /**
237
308
  * 向peer添加Track轨道数据
238
309
  *
@@ -242,6 +313,14 @@ export default class Peer {
242
313
  * @param { IStreamConfig } streamConfig 自定义Stream流对象
243
314
  */
244
315
  private addTransceiver;
316
+ /**
317
+ * 计算编码器分辨率裁剪比例
318
+ *
319
+ * @param { MediaStreamTrack } track - MediaStream Track
320
+ * @param { IStreamConfig } streamConfig - 自定义Stream流对象
321
+ * @returns { number } - 裁剪比例
322
+ */
323
+ private calculateScaleValue;
245
324
  /**
246
325
  * 关联自定义stream对象和Sender发送器数据
247
326
  *
@@ -0,0 +1,28 @@
1
+ /**
2
+ * WebRTC SDK AI Plugin Lib
3
+ *
4
+ * Created at : 2024-05-14 14:54:33
5
+ * Last modified : 2024-05-14 15:21:59
6
+ */
7
+ import XYRTCClient from '../client';
8
+ import { XYBaseModule } from '../../type/index';
9
+ export declare class XYPlugin implements XYBaseModule {
10
+ private logger;
11
+ private plugin;
12
+ constructor(client: XYRTCClient);
13
+ /**
14
+ * 获取所有可用的插件
15
+ * @returns { array } - 插件列表
16
+ */
17
+ getPlugin(): any[];
18
+ /**
19
+ * 销毁插件
20
+ */
21
+ destroy(): void;
22
+ /**
23
+ * 注册Web AI插件
24
+ *
25
+ * @param { Array } plugins - 插件列表
26
+ */
27
+ registerPlugins(plugins: any[]): void;
28
+ }
@@ -2,9 +2,9 @@
2
2
  * WebRTC SDK Quality Manager
3
3
  *
4
4
  * Created at : 2023-04-27 15:27:15
5
- * Last modified : 2023-05-18 19:35:24
5
+ * Last modified : 2024-04-23 19:03:09
6
6
  */
7
- import { IInternals, IWorkerVideoReceiver, IVideoReceiverMessage, IQualityConfig } from '../type';
7
+ import { IInternals, IWorkerVideoReceiver, IVideoReceiverMessage, IQualityConfig } from '../../type/index';
8
8
  declare class Quality {
9
9
  currentInternals: IInternals;
10
10
  nextInternals: IInternals;
@@ -4,7 +4,7 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  *
6
6
  * Created at : 2023-04-24 14:16:27
7
- * Last modified : 2023-05-10 18:48:22
7
+ * Last modified : 2024-06-06 16:01:56
8
8
  */
9
9
  declare const _default: {
10
10
  new (scriptURL: string | URL, options?: WorkerOptions | undefined): Worker;