@byteplus/rtc 4.56.2 → 4.58.0

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.
@@ -1,88 +1,280 @@
1
- // Generated by dts-bundle-generator v6.13.0
1
+ // Generated by dts-bundle-generator v8.0.1
2
2
 
3
+ import { EventEmitter } from 'eventemitter3';
3
4
 
4
- /** {en}
5
- * @brief Basic beauty effect mode.
6
- */
7
- export declare enum EffectBeautyMode {
5
+ declare abstract class ExtensionBase extends EventEmitter {
6
+ abstract name: string;
7
+ abstract type: RTCExtensionType;
8
+ abstract init(engineParams?: any): Promise<void>;
9
+ protected abstract _enable: boolean;
10
+ isOpen(): boolean;
11
+ abstract destroy(): void;
12
+ isSupported(): Promise<boolean>;
13
+ monitor?: any;
14
+ get _reportName(): string;
15
+ }
16
+ declare abstract class PreProcessingExtension extends ExtensionBase {
17
+ type: RTCExtensionType;
18
+ abstract effect(track: ITrack, processTrack: MediaStreamTrack): Promise<MediaStreamTrack>;
19
+ abstract applyConstraints(streamIndex: StreamIndex, constraints: MediaTrackConstraints): void;
20
+ }
21
+ declare class IRTCBeautyExtension {
22
+ constructor(options: IRTCBeautyExtensionConfig);
8
23
 
9
- /** {en}
10
- * @brief Brightness.
24
+ /**
25
+ * @brief Check the compatibility of current browser.
26
+ * @return Compatibility check result.
11
27
  */
12
- EFFECT_WHITE_MODE = 0,
28
+ checkCompatibility: () => Promise<CompatibilityCheckResult>;
13
29
 
14
- /** {en}
15
- * @brief Smoothness.
30
+ /**
31
+ * @brief Enable basic beauty effects.
32
+ * @notes + Call [setBeautyIntensity](#setbeautyintensity) to set the beauty effect intensity. If you do not set the intensity, the brightness, smoothness, and sharpness intensity will default to 0.5.
33
+ * + Call [disable](#disable) to turn off basic beauty effects.
34
+ * + This API is not applicable to screen capturing.
16
35
  */
17
- EFFECT_SMOOTH_MODE = 1,
36
+ enableBeauty: () => Promise<void>;
18
37
 
19
- /** {en}
20
- * @brief Sharpness.
38
+ /**
39
+ * @hidden
40
+ * @deprecated since 4.52, use enableBeauty instead.
41
+ * @brief Enable basic beauty effects.
42
+ * @notes + Call [setBeautyIntensity](#setbeautyintensity) to set the beauty effect intensity. If you do not set the intensity, the brightness, smoothness, and sharpness intensity will default to 0.5.
43
+ * + Call [disable](#disable) to turn off basic beauty effects.
44
+ * + This API is not applicable to screen capturing.
21
45
  */
22
- EFFECT_SHARPEN_MODE = 2
46
+ enable: () => Promise<void>;
47
+
48
+ /**
49
+ * @brief Disable basic beauty effects.
50
+ */
51
+ disableBeauty: () => Promise<void>;
52
+
53
+ /**
54
+ * @hidden
55
+ * @deprecated since 4.52, use disableBeauty instead.
56
+ * @brief Disable basic beauty effects.
57
+ */
58
+ disable: () => Promise<void>;
59
+
60
+ /**
61
+ * @brief Set the beauty effect intensity.
62
+ * @param beautyMode Basic beauty effect.
63
+ * @param intensity Beauty effect intensity in range of [0,1], default to 0.5. When you set it to 0, the beauty effect will be turned off.
64
+ * @notes + If you call this API before calling [enable](#enable), the default settings of beauty effect intensity will adjust accordingly.
65
+ * + If you destroy the engine, the beauty effect settings will be invalid.
66
+ */
67
+ setBeautyIntensity: (beautyMode: EffectBeautyMode, intensity: number) => void;
68
+
69
+ /**
70
+ * @brief Enable virtual background.
71
+ * @notes + Call [setBackgroundMode](#setbackgroundmode) to set the virtual background mode. If you do not set the mode, the blur background will be enabled.
72
+ * + Call [disableVirtualBackground](#disablevirtualbackground) to turn off virtual background.
73
+ * + This API is not applicable to screen capturing.
74
+ */
75
+ enableVirtualBackground: () => Promise<void>;
76
+
77
+ /**
78
+ * @brief Disable virtual background.
79
+ */
80
+ disableVirtualBackground: () => Promise<void>;
81
+
82
+ /**
83
+ * @brief Set the virtual background mode.
84
+ * @param mode Virtual background mode.
85
+ * @notes After turning on the virtual background, you can call this API to switch the used virtual background mode.
86
+ */
87
+ setBackgroundMode: (mode: BackgroundMode) => void;
88
+
89
+ /**
90
+ * @brief Get the current virtual background image.
91
+ * @return The URL of the current virtual background image.
92
+ */
93
+ getBackgroundImage: () => string;
94
+
95
+ /**
96
+ * @brief Set the virtual background image.
97
+ * @param url URL of the virtual background image.
98
+ * @return
99
+ * @notes + You can upload a .JPG, .PNG, or .JPEG file.
100
+ * + If the image’s aspect ratio doesn't match the video's, the shortest side (either height or width) of the image will be stretched proportionally to match the video. Then the image will be cropped to fill in the video.
101
+ * + The transparent area in the image will be filled with black.
102
+ */
103
+ loadBackgroundImage: (url: string) => Promise<void>;
104
+
105
+ /**
106
+ * @brief Set the priority of the facial recognition AI algorithm.
107
+ * @param type The priority of the facial recognition AI algorithm.
108
+ */
109
+ setAIModelType: (type: BackgroundAIModelType) => void;
110
+ }
111
+ declare class RTCBeautyExtension extends PreProcessingExtension implements IRTCBeautyExtension {
112
+ name: string;
113
+ protected _enable: boolean;
114
+ static _loadingProcess?: Promise<void>;
115
+ static _sdk?: ArSdk;
116
+ static _sdkUrl: any;
117
+ static _sdkSourceUrl: any;
118
+ static _sdkHash?: string;
119
+ static _sdkAuthServer?: string;
120
+ static _authFileUrl?: string;
121
+ private _beautyExt?;
122
+ private _backgroundExt?;
123
+ private _enableBeauty;
124
+ private _enableBackground;
125
+ private _fps;
126
+ private _backgroundBackend;
127
+ private _backgroundAIModelType;
128
+ private _backgroundMode;
129
+ private _beautyDefaultValue;
130
+ private _preTrack;
131
+ constructor(options?: IRTCBeautyExtensionConfig);
132
+ static loadWebARSDK(): Promise<void>;
133
+ initWebArSDK(): Promise<void>;
134
+ init(engineParams: any): Promise<void>;
135
+ checkCompatibility(): Promise<CompatibilityCheckResult>;
136
+ effect(track: ITrack, processTrack?: MediaStreamTrack): Promise<MediaStreamTrack>;
137
+ enable(): Promise<void>;
138
+ enableBeauty(): Promise<void>;
139
+ disable(): Promise<void>;
140
+ disableBeauty(): Promise<void>;
141
+ enableVirtualBackground(): Promise<void>;
142
+ disableVirtualBackground(): Promise<void>;
143
+ setBeautyIntensity(beautyMode: EffectBeautyMode, intensity: number): void;
144
+ setBackgroundMode(mode: BackgroundMode): void;
145
+ getBackgroundImage(): string;
146
+ loadBackgroundImage(url: string): Promise<void>;
147
+ setAIModelType(type: BackgroundAIModelType): void;
148
+ applyConstraints(streamIndex: StreamIndex, constraints: MediaTrackConstraints): void;
149
+ isSupported(): Promise<boolean>;
150
+ isOpen(): boolean;
151
+ destroy(): void;
152
+ private _rtcSdkApiCall;
153
+ }
154
+ declare enum RTCExtensionType {
155
+ CAPTURE = 0,
156
+ PRE_PROCESSING = 1,
157
+ ENCODE = 2,
158
+ TRANSFER = 3,
159
+ POST_PROCESSING = 4,
160
+ DECODE = 5,
161
+ RENDERING = 6
162
+ }
163
+ declare enum SourceType {
164
+ EXTERNAL = 0,
165
+ INTERNAL = 1
166
+ }
167
+ declare enum StreamIndex {
168
+
169
+ /**
170
+ * @brief A mainstream is a media stream either captured by the internal module or from the custom source.
171
+ */
172
+ STREAM_INDEX_MAIN = 0,
173
+
174
+ /**
175
+ * @brief Screen-sharing stream, including screen-sharing video streams and/ or audio streams from sound cards
176
+ */
177
+ STREAM_INDEX_SCREEN = 1
23
178
  }
24
179
 
25
- /** {en}
26
- * @brief Virtual background mode.
180
+ /**
181
+ * @brief Whether to use CPU or GPU mode. CPU mode is set by default.
27
182
  */
28
- export declare enum BackgroundMode {
183
+ export declare enum BackgroundAIBackend {
29
184
 
30
- /** {en}
31
- * @brief Blur background.
185
+ /**
186
+ * @brief CPU mode.
32
187
  */
33
- BACKGROUND_BLUR = "blur",
188
+ CPU = -1,
34
189
 
35
- /** {en}
36
- * @brief Image background.
190
+ /**
191
+ * @brief GPU mode. The SDK will check whether the current browser supports GPU mode, and will automatically fall back to CPU mode if GPU mode is not supported.
37
192
  */
38
- BACKGROUND_IMAGE = "image"
193
+ GPU = 1
39
194
  }
40
195
 
41
- /** {en}
196
+ /**
42
197
  * @brief The priority of the facial recognition AI algorithm.
43
198
  */
44
199
  export declare enum BackgroundAIModelType {
45
200
 
46
- /** {en}
201
+ /**
47
202
  * @brief Performance mode.
48
203
  */
49
204
  PERFORMANCE = 0,
50
205
 
51
- /** {en}
206
+ /**
52
207
  * @brief Quality mode.
53
208
  */
54
209
  QUALITY = 1
55
210
  }
56
211
 
57
- /** {en}
58
- * @brief Whether to use CPU or GPU mode. CPU mode is set by default.
212
+ /**
213
+ * @brief Virtual background mode.
59
214
  */
60
- export declare enum BackgroundAIBackend {
215
+ export declare enum BackgroundMode {
61
216
 
62
- /** {en}
63
- * @brief CPU mode.
217
+ /**
218
+ * @brief Blur background.
64
219
  */
65
- CPU = -1,
220
+ BACKGROUND_BLUR = "blur",
66
221
 
67
- /** {en}
68
- * @brief GPU mode. The SDK will check whether the current browser supports GPU mode, and will automatically fall back to CPU mode if GPU mode is not supported.
222
+ /**
223
+ * @brief Image background.
69
224
  */
70
- GPU = 1
225
+ BACKGROUND_IMAGE = "image"
226
+ }
227
+
228
+ /**
229
+ * @brief Basic beauty effect mode.
230
+ */
231
+ export declare enum EffectBeautyMode {
232
+
233
+ /**
234
+ * @brief Brightness.
235
+ */
236
+ EFFECT_WHITE_MODE = 0,
237
+
238
+ /**
239
+ * @brief Smoothness.
240
+ */
241
+ EFFECT_SMOOTH_MODE = 1,
242
+
243
+ /**
244
+ * @brief Sharpness.
245
+ */
246
+ EFFECT_SHARPEN_MODE = 2
247
+ }
248
+ export interface ArSdk {
249
+ canvas?: HTMLCanvasElement;
250
+ video?: {
251
+ start: () => Promise<void>;
252
+ stop: () => Promise<void>;
253
+ };
254
+ extensions: any;
255
+ setOptions: (options: any) => void;
256
+ setDocumentTemplate: (template: any) => Promise<void>;
257
+ initialize: (options: any) => Promise<void>;
258
+ setStreamInput: (stream: MediaStream) => Promise<void>;
259
+ startFrame: () => void;
260
+ stopFrame: () => void;
261
+ setCanvasSize: (width: number, height: number) => void;
262
+ checkCompatibility: () => Promise<CompatibilityCheckResult>;
71
263
  }
72
264
 
73
- /** {en}
265
+ /**
74
266
  * @brief Compatibility check result.
75
267
  */
76
268
  export interface CompatibilityCheckResult {
77
269
 
78
- /** {en}
270
+ /**
79
271
  * @brief Whether the system is compatible.
80
272
  * &ensp; `true`: The system meets the requirements.
81
273
  * &ensp; `false`: Incompatible.
82
274
  */
83
275
  isCompatible: boolean;
84
276
 
85
- /** {en}
277
+ /**
86
278
  * @brief Incompatible reasons.</br>
87
279
  * &ensp; + 0: Other unknown reasons.
88
280
  * &ensp; + 1: Browser does not support getUserMedia API.
@@ -92,13 +284,13 @@ export interface CompatibilityCheckResult {
92
284
  */
93
285
  reasons: number[];
94
286
 
95
- /** {en}
287
+ /**
96
288
  * @brief Extra message.
97
289
  */
98
290
  message?: string;
99
291
  }
100
292
 
101
- /** {en}
293
+ /**
102
294
  * @brief Beauty extension configurations.
103
295
  */
104
296
  export interface IRTCBeautyExtensionConfig {
@@ -119,114 +311,31 @@ export interface IRTCBeautyExtensionConfig {
119
311
  */
120
312
  sdkAuthServer?: string;
121
313
 
122
- /** {en}
314
+ /**
123
315
  * @brief The authentication file's URL.
124
316
  */
125
317
  authFileUrl?: string;
126
318
 
127
- /** {en}
319
+ /**
128
320
  * @brief Whether to use CPU or GPU mode. CPU mode is set by default.
129
321
  */
130
322
  aiBackend?: BackgroundAIBackend;
131
323
 
132
- /** {en}
324
+ /**
133
325
  * @brief The priority of the facial recognition AI algorithm.
134
326
  */
135
327
  aiModelType?: BackgroundAIModelType;
136
328
  }
137
- export declare class IRTCBeautyExtension {
138
- constructor(options: IRTCBeautyExtensionConfig);
139
-
140
- /** {en}
141
- * @brief Check the compatibility of current browser.
142
- * @return Compatibility check result.
143
- */
144
- checkCompatibility: () => Promise<CompatibilityCheckResult>;
145
-
146
- /** {en}
147
- * @brief Enable basic beauty effects.
148
- * @notes + Call [setBeautyIntensity](#setbeautyintensity) to set the beauty effect intensity. If you do not set the intensity, the brightness, smoothness, and sharpness intensity will default to 0.5.
149
- * + Call [disable](#disable) to turn off basic beauty effects.
150
- * + This API is not applicable to screen capturing.
151
- */
152
- enableBeauty: () => Promise<void>;
153
-
154
- /** {en}
155
- * @hidden
156
- * @deprecated since 4.52, use enableBeauty instead.
157
- * @brief Enable basic beauty effects.
158
- * @notes + Call [setBeautyIntensity](#setbeautyintensity) to set the beauty effect intensity. If you do not set the intensity, the brightness, smoothness, and sharpness intensity will default to 0.5.
159
- * + Call [disable](#disable) to turn off basic beauty effects.
160
- * + This API is not applicable to screen capturing.
161
- */
162
- enable: () => Promise<void>;
163
-
164
- /** {en}
165
- * @brief Disable basic beauty effects.
166
- */
167
- disableBeauty: () => Promise<void>;
168
-
169
- /** {en}
170
- * @hidden
171
- * @deprecated since 4.52, use disableBeauty instead.
172
- * @brief Disable basic beauty effects.
173
- */
174
- disable: () => Promise<void>;
175
-
176
- /** {en}
177
- * @brief Set the beauty effect intensity.
178
- * @param beautyMode Basic beauty effect.
179
- * @param intensity Beauty effect intensity in range of [0,1], default to 0.5. When you set it to 0, the beauty effect will be turned off.
180
- * @notes + If you call this API before calling [enable](#enable), the default settings of beauty effect intensity will adjust accordingly.
181
- * + If you destroy the engine, the beauty effect settings will be invalid.
182
- */
183
- setBeautyIntensity: (beautyMode: EffectBeautyMode, intensity: number) => void;
184
-
185
- /** {en}
186
- * @brief Enable virtual background.
187
- * @notes + Call [setBackgroundMode](#setbackgroundmode) to set the virtual background mode. If you do not set the mode, the blur background will be enabled.
188
- * + Call [disableVirtualBackground](#disablevirtualbackground) to turn off virtual background.
189
- * + This API is not applicable to screen capturing.
190
- */
191
- enableVirtualBackground: () => Promise<void>;
192
-
193
- /** {en}
194
- * @brief Disable virtual background.
195
- */
196
- disableVirtualBackground: () => Promise<void>;
197
-
198
- /** {en}
199
- * @brief Set the virtual background mode.
200
- * @param mode Virtual background mode.
201
- * @notes After turning on the virtual background, you can call this API to switch the used virtual background mode.
202
- */
203
- setBackgroundMode: (mode: BackgroundMode) => void;
204
-
205
- /** {en}
206
- * @brief Get the current virtual background image.
207
- * @return The URL of the current virtual background image.
208
- */
209
- getBackgroundImage: () => string;
210
-
211
- /** {en}
212
- * @brief Set the virtual background image.
213
- * @param url URL of the virtual background image.
214
- * @return
215
- * @notes + You can upload a .JPG, .PNG, or .JPEG file.
216
- * + If the image’s aspect ratio doesn't match the video's, the shortest side (either height or width) of the image will be stretched proportionally to match the video. Then the image will be cropped to fill in the video.
217
- * + The transparent area in the image will be filled with black.
218
- */
219
- loadBackgroundImage: (url: string) => Promise<void>;
220
-
221
- /** {en}
222
- * @brief Set the priority of the facial recognition AI algorithm.
223
- * @param type The priority of the facial recognition AI algorithm.
224
- */
225
- setAIModelType: (type: BackgroundAIModelType) => void;
329
+ export interface ITrack {
330
+ sourceType: SourceType;
331
+ mediaType: "audio" | "video";
332
+ mediaTrack: MediaStreamTrack;
333
+ streamIndex: number;
334
+ channelCount: number;
226
335
  }
227
336
 
228
337
  export {
229
- IRTCBeautyExtension as default,
338
+ RTCBeautyExtension as default,
230
339
  };
231
340
 
232
341
  export {};