@byteplus/rtc 4.62.3 → 4.62.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.
@@ -69,18 +69,19 @@ export declare class IRTCBeautyExtension {
69
69
  setBackgroundMode: (mode: BackgroundMode) => void;
70
70
 
71
71
  /**
72
- * @brief Get the current virtual background image.
72
+ * @brief Get the current virtual background image. Ensure that the background mode is set to `BACKGROUND_IMAGE`.
73
73
  * @return The URL of the current virtual background image.
74
74
  */
75
75
  getBackgroundImage: () => string;
76
76
 
77
77
  /**
78
- * @brief Set the virtual background image.
78
+ * @brief Set the virtual background image. Ensure that the background mode is set to `BACKGROUND_IMAGE`.
79
79
  * @param url URL of the virtual background image.
80
80
  * @return
81
81
  * @notes + You can upload a .JPG, .PNG, or .JPEG file.
82
- * + 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.
83
- * + The transparent area in the image will be filled with black.
82
+ * + 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.
83
+ * + The transparent area in the image will be filled with black.
84
+ * + The setting can be stored and continue to be effective throughout the duration of the extension's lifecycle.
84
85
  */
85
86
  loadBackgroundImage: (url: string) => Promise<void>;
86
87
 
@@ -89,9 +90,41 @@ export declare class IRTCBeautyExtension {
89
90
  * @param type The priority of the facial recognition AI algorithm.
90
91
  */
91
92
  setAIModelType: (type: BackgroundAIModelType) => void;
93
+
94
+ /**
95
+ * @brief Sets the radius of the blur effect, measured in pixels (px). Ensure that the background mode is set to `BACKGROUND_BLUR`.
96
+ * @param radius The radius of the blur effect. The blur radius defaults to 20 px.
97
+ * The valid range for the radius is [0, ∞). However, note that the blur effect will no longer change beyond the half of the longer side of the video.
98
+ * For example, in a video of 640x480, if you set a blur radius greater than 320 pixels, it will have the same effect as setting it to 320 pixels.
99
+ * @notes The setting can be stored and continue to be effective throughout the duration of the extension's lifecycle.
100
+ */
92
101
  setBackgroundBlurRadius: (radius: number) => void;
102
+
103
+ /**
104
+ * @brief Set the background color. Ensure that the background mode is set to `BACKGROUND_COLOR`.
105
+ * @param color Color specified as RGBA(red, green, blue, alpha) or #RRGGBBAA.
106
+ * Each component's value ranges from 0 to 255. The alpha component represents the opacity of the color and ranges from `0` (transparent) to `1` (opaque).
107
+ * For example, rgba(255, 255, 255, 1) represents the color white with full opacity.
108
+ * Alternatively, you can also use the hexadecimal color format #RRGGBBAA, where each pair of digits represents the values for red, green, blue, and alpha components. The alpha component ranges from 00 (transparent) to FF (opaque). For example, #FFFFFFFF represents the color white with full opacity.
109
+ * @return + `true`: Success.
110
+ * + `false`: Failure.
111
+ * @notes The setting can be stored and continue to be effective throughout the duration of the extension's lifecycle.
112
+ */
93
113
  setBackgroundColor: (color: string) => boolean;
114
+
115
+ /**
116
+ * @brief Sets the URL of the virtual background video. Ensure that the background mode is set to `BACKGROUND_VIDEO`.
117
+ * @param url URL of the virtual background video.
118
+ * @return promise.reject() is used to throw an exception.
119
+ * @notes The setting can be stored and continue to be effective throughout the duration of the extension's lifecycle.
120
+ */
94
121
  loadBackgroundVideo: (url: string) => Promise<void>;
122
+
123
+ /**
124
+ * @brief Gets the URL of the virtual background video. Ensure that the background mode is set to `BACKGROUND_VIDEO`.
125
+ * @return URL of the virtual background video.
126
+ * @notes The setting can be stored and continue to be effective throughout the duration of the extension's lifecycle.
127
+ */
95
128
  getBackgroundVideo: () => string;
96
129
  }
97
130
 
@@ -133,15 +166,23 @@ export declare enum BackgroundAIModelType {
133
166
  export declare enum BackgroundMode {
134
167
 
135
168
  /**
136
- * @brief Blur background.
169
+ * @brief Blur background. The blur radius defaults to 20 px. You can specify the blur level via `setBackgroundBlurRadius`.
137
170
  */
138
171
  BACKGROUND_BLUR = "blur",
139
172
 
140
173
  /**
141
- * @brief Image background.
174
+ * @brief Image. You need to specify the image via `loadBackgroundImage` before any visible modification will take effect.
142
175
  */
143
176
  BACKGROUND_IMAGE = "image-url",
177
+
178
+ /**
179
+ * @brief Solid color. You need to specify the color via `setBackgroundColor` before any visible modification will take effect.
180
+ */
144
181
  BACKGROUND_COLOR = "color",
182
+
183
+ /**
184
+ * @brief Video. Specify the video via `loadBackgroundVideo` before any visible modification will take effect.
185
+ */
145
186
  BACKGROUND_VIDEO = "video-url"
146
187
  }
147
188