@tencent-rtc/mcp 1.3.4 → 1.3.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.
Files changed (102) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/chatuikit/android/features/theme.md +363 -0
  3. package/resource/doc/chatuikit/{android/client_api_Android.md → faq/android_sdk/client-api.md} +0 -2
  4. package/resource/doc/chatuikit/faq/common/product.md +8 -0
  5. package/resource/doc/chatuikit/faq/flutter_sdk/faq.md +53 -0
  6. package/resource/doc/chatuikit/{iOS/client_api_iOS.md → faq/ios_sdk/client-api.md} +0 -2
  7. package/resource/doc/chatuikit/flutter/features/theme.md +379 -0
  8. package/resource/doc/chatuikit/flutter/integration.md +413 -0
  9. package/resource/doc/chatuikit/flutter/workflow.md +941 -0
  10. package/resource/doc/chatuikit/iOS/features/theme.md +416 -0
  11. package/resource/doc/chatuikit/iOS/workflow.md +0 -0
  12. package/resource/doc/chatuikit/react/components/chat-setting.md +86 -0
  13. package/resource/doc/chatuikit/react/components/contact-list.md +1093 -0
  14. package/resource/doc/chatuikit/react/components/search.md +745 -0
  15. package/resource/doc/chatuikit/vue/components/chat-setting.md +64 -0
  16. package/resource/doc/chatuikit/vue/components/contact-list.md +679 -0
  17. package/resource/doc/chatuikit/vue/components/search.md +1384 -0
  18. package/resource/doc/livekit/live/android/workflow.md +137 -6
  19. package/resource/doc/livekit/live/ios/live-audience-list.md +339 -0
  20. package/resource/doc/livekit/live/ios/live-audio-effect.md +370 -0
  21. package/resource/doc/livekit/live/ios/live-barrage.md +517 -0
  22. package/resource/doc/livekit/live/ios/live-base-beauty.md +247 -0
  23. package/resource/doc/livekit/live/ios/live-co-guest-interaction.md +518 -0
  24. package/resource/doc/livekit/live/ios/live-gift.md +783 -0
  25. package/resource/doc/livekit/live/ios/live-host-interaction.md +815 -0
  26. package/resource/doc/livekit/live/ios/live-integration.md +931 -0
  27. package/resource/doc/livekit/live/ios/live-live-list.md +485 -0
  28. package/resource/doc/livekit/live/ios/workflow.md +454 -0
  29. package/resource/doc/rtcengine/web/plugin/20-advanced-customized-capture-rendering.md +87 -0
  30. package/resource/doc/rtcengine/web/plugin/21-advanced-auto-play-policy.md +87 -0
  31. package/resource/doc/rtcengine/web/plugin/22-advanced-audio-mixer.md +175 -0
  32. package/resource/doc/rtcengine/web/plugin/23-advanced-support-detection.md +221 -0
  33. package/resource/doc/rtcengine/web/plugin/24-advanced-network-quality.md +140 -0
  34. package/resource/doc/rtcengine/web/plugin/25-advanced-device-change.md +99 -0
  35. package/resource/doc/rtcengine/web/plugin/26-advanced-publish-cdn-stream.md +451 -0
  36. package/resource/doc/rtcengine/web/plugin/27-advanced-small-stream.md +151 -0
  37. package/resource/doc/rtcengine/web/plugin/28-advanced-beauty.md +322 -0
  38. package/resource/doc/rtcengine/web/plugin/29-advanced-water-mark.md +149 -0
  39. package/resource/doc/rtcengine/web/plugin/30-advanced-cross-room-link.md +96 -0
  40. package/resource/doc/rtcengine/web/plugin/31-advanced-plugins-overview.md +330 -0
  41. package/resource/doc/rtcengine/web/plugin/34-advanced-proxy.md +248 -0
  42. package/resource/doc/rtcengine/web/plugin/35-advanced-ai-denoiser.md +81 -0
  43. package/resource/doc/rtcengine/web/plugin/36-advanced-virtual-background.md +242 -0
  44. package/resource/doc/rtcengine/web/plugin/37-advanced-voice-changer.md +99 -0
  45. package/resource/doc/rtcengine/web/plugin/39-advanced-video-decoder.md +33 -0
  46. package/resource/doc/rtcengine/web/plugin/40-advanced-video-mixer.md +379 -0
  47. package/resource/doc/rtcengine/web/plugin/41-advanced-small-stream-auto-switcher.md +91 -0
  48. package/resource/doc/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +315 -0
  49. package/resource/doc/rtcengine/web/plugin/43-advanced-face-detection.md +180 -0
  50. package/tools/chat/get-native-chat-feature-detail.js +30 -0
  51. package/tools/chat/get-native-chat-feature-detail.js.map +1 -0
  52. package/tools/chat/get-native-chat-integration.js +30 -12
  53. package/tools/chat/get-native-chat-integration.js.map +1 -1
  54. package/tools/common/get-faq.js +2 -4
  55. package/tools/common/get-faq.js.map +1 -1
  56. package/tools/definitions/get_native_chat_feature_detail_def.js +32 -0
  57. package/tools/definitions/get_native_chat_feature_detail_def.js.map +1 -0
  58. package/tools/definitions/get_native_chat_uikit_integration_def.js +19 -7
  59. package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
  60. package/tools/definitions/{get_native_live_extra_features_def.js → get_native_live_uikit_extra_features_def.js} +3 -3
  61. package/tools/definitions/get_native_live_uikit_extra_features_def.js.map +1 -0
  62. package/tools/definitions/{get_native_live_interaction_def.js → get_native_live_uikit_interaction_def.js} +3 -3
  63. package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -0
  64. package/tools/definitions/get_web_chat_uikit_component_detail_def.js +49 -10
  65. package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -1
  66. package/tools/index.js +6 -4
  67. package/tools/index.js.map +1 -1
  68. package/tools/live/{get_native_live_extra_features.js → get_native_live_uikit_extra_features.js} +4 -4
  69. package/tools/live/get_native_live_uikit_extra_features.js.map +1 -0
  70. package/tools/live/{get_native_live_interaction.js → get_native_live_uikit_interaction.js} +4 -4
  71. package/tools/live/get_native_live_uikit_interaction.js.map +1 -0
  72. package/tools/rtcengine/get-rtcengine-web-sdk-integration.js.map +1 -1
  73. package/tools/rtcengine/get-trtc-sdk-faq.js +32 -0
  74. package/tools/rtcengine/get-trtc-sdk-faq.js.map +1 -0
  75. package/tools/rtcengine/get-trtc-web-sdk-faq.js +1 -1
  76. package/tools/rtcengine/get-trtc-web-sdk-integration.js.map +1 -1
  77. package/tools/rtcengine/get-trtc-web-sdk-plugin.js +45 -0
  78. package/tools/rtcengine/get-trtc-web-sdk-plugin.js.map +1 -0
  79. package/utils/handle-component-name.js +0 -16
  80. package/utils/handle-component-name.js.map +1 -1
  81. package/utils/report-cls-client.js +1 -1
  82. package/utils/report-es-client.js +1 -1
  83. package/resource/doc/chatuikit/android/generate_UserSig.md +0 -306
  84. package/resource/doc/chatuikit/android/integrarte_only_tuichat_Android.md +0 -290
  85. package/resource/doc/chatuikit/android/quick_start_Android.md +0 -138
  86. package/resource/doc/chatuikit/android/show_typing_Android.md +0 -43
  87. package/resource/doc/chatuikit/flutter/generate_UserSig.md +0 -306
  88. package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +0 -133
  89. package/resource/doc/chatuikit/iOS/generate_UserSig.md +0 -306
  90. package/resource/doc/chatuikit/iOS/integrate_only_tuichat_iOS.md +0 -748
  91. package/resource/doc/chatuikit/iOS/quick_start_iOS.md +0 -163
  92. package/resource/doc/chatuikit/iOS/show_typing_iOS.md +0 -52
  93. package/tools/definitions/get_native_live_extra_features_def.js.map +0 -1
  94. package/tools/definitions/get_native_live_interaction_def.js.map +0 -1
  95. package/tools/live/get_native_live_extra_features.js.map +0 -1
  96. package/tools/live/get_native_live_interaction.js.map +0 -1
  97. /package/resource/doc/chatuikit/android/{integrate_tuikit_Android.md → integration.md} +0 -0
  98. /package/resource/doc/chatuikit/{faq/native_sdk/faq.md → android/workflow.md} +0 -0
  99. /package/resource/doc/chatuikit/{flutter/client_api_Flutter.md → faq/flutter_sdk/client-api.md} +0 -0
  100. /package/resource/doc/chatuikit/iOS/{integrate_tuikit_iOS.md → integration.md} +0 -0
  101. /package/resource/doc/chatuikit/react/components/{chatheader.md → chat-header.md} +0 -0
  102. /package/resource/doc/chatuikit/vue/components/{chatheader.md → chat-header.md} +0 -0
@@ -0,0 +1,322 @@
1
+ ## Function Description
2
+
3
+ This document primarily describes how to use the beauty plugin.
4
+
5
+ ## Prerequisites
6
+
7
+ - Pricing see [RTC-Engine Packages](https://trtc.io/document/56025).
8
+ - [TRTC SDK](https://www.npmjs.com/package/trtc-sdk-v5) version must be >= 5.5.0
9
+ - System and configuration requirements for various platforms are as follows:
10
+
11
+ <table>
12
+ <tr>
13
+ <td rowspan="1" colspan="1">Platform</td>
14
+
15
+ <td rowspan="1" colspan="1">Operating System</td>
16
+
17
+ <td rowspan="1" colspan="1">Browser Version</td>
18
+
19
+ <td rowspan="1" colspan="1">FPS</td>
20
+
21
+ <td rowspan="1" colspan="1">Recommended Configuration</td>
22
+
23
+ <td rowspan="1" colspan="1">Remarks</td>
24
+ </tr>
25
+
26
+ <tr>
27
+ <td rowspan="8" colspan="1">Web</td>
28
+
29
+ <td rowspan="2" colspan="1">Windows</td>
30
+
31
+ <td rowspan="2" colspan="1">Chrome 90+<br>Firefox 90+<br>Edge 97+</td>
32
+
33
+ <td rowspan="1" colspan="1">30</td>
34
+
35
+ <td rowspan="1" colspan="1">Memory: 16GB<br>CPU: i5-10500<br>GPU: Dedicated 2GB</td>
36
+
37
+ <td rowspan="3" colspan="1">It is recommended to use the latest version of Chrome browser<br> <b> (Enable hardware acceleration in the browser)</b></td>
38
+ </tr>
39
+
40
+ <tr>
41
+ <td rowspan="1" colspan="1">15</td>
42
+
43
+ <td rowspan="1" colspan="1">Memory: 8GB<br>CPU: i3-8300<br>GPU: Integrated Intel 1GB</td>
44
+ </tr>
45
+
46
+ <tr>
47
+ <td rowspan="1" colspan="1">Mac</td>
48
+
49
+ <td rowspan="1" colspan="1">Chrome 98+<br>Firefox 96+<br>Safari 14+</td>
50
+
51
+ <td rowspan="1" colspan="1">30</td>
52
+
53
+ <td rowspan="1" colspan="1">2019 MacBook<br>Memory: 16GB (2667MHz)<br>CPU: i7 (6-core 2.60GHz)<br>GPU: AMD Radeon 5300M</td>
54
+ </tr>
55
+
56
+ <tr>
57
+ <td rowspan="3" colspan="1">Android</td>
58
+
59
+ <td rowspan="3" colspan="1">Chrome<br>Firefox Browser
60
+
61
+ <td rowspan="1" colspan="1">30</td>
62
+
63
+ <td rowspan="1" colspan="1">High-end devices (e.g., Qualcomm Snapdragon 8 Gen1)</td>
64
+
65
+ <td rowspan="3" colspan="1">It is recommended to use Chrome, or Firefox browsers and other mainstream browsers<br>
66
+ </tr>
67
+
68
+ <tr>
69
+ <td rowspan="1" colspan="1">20</td>
70
+
71
+ <td rowspan="1" colspan="1">Mid-range devices (e.g., MediaTek Dimensity 8000-MAX)</td>
72
+ </tr>
73
+
74
+ <tr>
75
+ <td rowspan="1" colspan="1">10</td>
76
+
77
+ <td rowspan="1" colspan="1">Low-end devices (e.g., Qualcomm Snapdragon 660)</td>
78
+ </tr>
79
+
80
+ <tr>
81
+ <td rowspan="2" colspan="1">iOS</td>
82
+
83
+ <td rowspan="2" colspan="1">Chrome<br>Safari<br>Firefox</td>
84
+
85
+ <td rowspan="1" colspan="1">30</td>
86
+
87
+ <td rowspan="1" colspan="1">iPhone 13</td>
88
+
89
+ <td rowspan="2" colspan="1">- Requires iOS 14.4 or above<br>- It is recommended to use Chrome or Safari browsers<br></td>
90
+ </tr>
91
+
92
+ <tr>
93
+ <td rowspan="1" colspan="1">20</td>
94
+
95
+ <td rowspan="1" colspan="1">iPhone XR</td>
96
+ </tr>
97
+
98
+ </table>
99
+
100
+ ## Implementation Steps
101
+
102
+ ### Step 1: Register the Plugin
103
+
104
+ Before using it, you need to register the plugin. Below is an example code for registering the plugin:
105
+
106
+ ```js
107
+ import TRTC from 'trtc-sdk-v5';
108
+ import { Beauty } from 'trtc-sdk-v5/plugins/video-effect/beauty';
109
+
110
+ const trtc = TRTC.create({ plugins: [Beauty] });
111
+ ```
112
+
113
+ ### Step 2: Start the Local Camera
114
+
115
+ ```js
116
+ await trtc.startLocalVideo({
117
+ view: 'local-video' // Fill in the div id
118
+ });
119
+ ```
120
+
121
+ ### Step 3: Using Beauty and built-in Effects
122
+
123
+ #### Beauty Effect
124
+
125
+ The beauty effect can be controlled using three interfaces for starting, updating, and stopping:
126
+
127
+ - `trtc.startPlugin('Beauty', options)` to enable the beauty effect.
128
+ - `trtc.updatePlugin('Beauty', options)` to update the beauty effect parameters.
129
+ - `trtc.stopPlugin('Beauty')` to stop the beauty effect.
130
+
131
+ The `options` parameter supports six beauty effect parameters:
132
+
133
+ ```ts
134
+ type BeautifyOptions = {
135
+ whiten?: number; // Whitening 0-1
136
+ dermabrasion?: number; // Dermabrasion 0-1
137
+ lift?: number; // Face Slimming 0-1
138
+ shave?: number; // Jaw Shaving 0-1
139
+ eye?: number; // Enlarged Eyes 0-1
140
+ chin?: number; // Chin Adjustment 0-1
141
+ }
142
+ ```
143
+
144
+ #### Built-in Effects
145
+
146
+ The plugin offers build-in video effects, here is the list:
147
+
148
+ | EffectId | Name |
149
+ |---------------------|--------------------|
150
+ | EDE5D18065451445 | Milk-Bottle-Face-Mask |
151
+ | 7A62218064EF7959 | Felt-Hairband |
152
+ | B4D63180653948C3 | Bangs-Headband |
153
+ | D7C6418064B90F4C | Cute-Kitty |
154
+ | 1D6EB18069D76A62 | Polka-Dot-Girl |
155
+ | CBE7618065D9D76F | Heart-Fireworks |
156
+ | 9B86618065596018 | Cute-Piggy |
157
+ | 428C518065369ACF | Double-Braids |
158
+ | B30E218064F7B397 | Vibrant-Stickers |
159
+ | AE3C81806521B49B | Rabbit-Sauce |
160
+
161
+ We use `EffectId` to identify the effect which will be apply.
162
+
163
+ ```ts
164
+ type EffectListOptions = {
165
+ id: string;
166
+ intensity?: number; // specify the strength of the effect
167
+ }
168
+ ```
169
+
170
+ #### Example Code
171
+
172
+ When starting the plugin, the `options` should also include the current user's login information (sdkAppId, userId, userSig) for verification.
173
+
174
+ Here are some code examples:
175
+
176
+ ```javascript
177
+ // Enable the plugin
178
+ const options = {
179
+ sdkAppId: 0,
180
+ userId: '',
181
+ userSig: '',
182
+
183
+ // BeautifyOptions
184
+ whiten: 0.5, // Whitening 0-1
185
+ dermabrasion: 0.5, // Dermabrasion 0-1
186
+ lift: 0.5, // Face Slimming 0-1
187
+ shave: 0.5, // Jaw Shaving 0-1
188
+ eye: 0.5, // Enlarged Eyes 0-1
189
+ chin: 0.5, // Chin Adjustment 0-1
190
+
191
+ // EffectListOptions Array
192
+ effect: [{
193
+ id: '7A62218064EF7959', // the effect id
194
+ intensity: 0.7 // specify the strength of the effect
195
+ }]
196
+ }
197
+ try {
198
+ await trtc.startPlugin('Beauty', options);
199
+ } catch (error) {
200
+ console.error('Beauty start failed', error);
201
+ }
202
+ ```
203
+
204
+ ```javascript
205
+ // Update beauty parameters
206
+ const options = {
207
+ whiten: 0.5, // Whitening 0-1
208
+ dermabrasion: 0.5, // Dermabrasion 0-1
209
+ lift: 0.5, // Face Slimming 0-1
210
+ shave: 0.5, // Jaw Shaving 0-1
211
+ eye: 0.5, // Enlarged Eyes 0-1
212
+ chin: 0.5, // Chin Adjustment 0-1
213
+
214
+ effect: [{
215
+ id: '7A62218064EF7959', // the effect id
216
+ intensity: 0.7, // specify the strength of the effect
217
+ },{
218
+ id: 'D7C6418064B90F4C', // the effect id
219
+ intensity: 0.7, // specify the strength of the effect
220
+ }]
221
+ }
222
+ try {
223
+ await trtc.updatePlugin('Beauty', options);
224
+ } catch (error) {
225
+ console.error('Beauty update failed', error);
226
+ }
227
+ ```
228
+
229
+ ```javascript
230
+ // Stop the beauty effect
231
+ try {
232
+ await trtc.stopPlugin('Beauty');
233
+ } catch (error) {
234
+ console.error('Beauty stop failed', error);
235
+ }
236
+ ```
237
+
238
+ ## API Documentation
239
+
240
+ ### trtc.startPlugin('Beauty', options)
241
+
242
+ Enable the beauty effect.
243
+
244
+ #### options
245
+
246
+ | Name | Type | Attributes | Description |
247
+ |------------|----------|------------|-----------------------------------|
248
+ | sdkAppId | `number` | Required | Current application ID |
249
+ | userId | `string` | Required | Current user ID |
250
+ | userSig | `string` | Required | UserSig corresponding to the user ID |
251
+ | whiten | `number` | Optional | Whitening, range [0,1] |
252
+ | dermabrasion | `number` | Optional | Dermabrasion, range [0,1] |
253
+ | lift | `number` | Optional | Face slimming, range [0,1] |
254
+ | shave | `number` | Optional | Jaw shaving, range [0,1] |
255
+ | eye | `number` | Optional | Enlarged eyes, range [0,1] |
256
+ | chin | `number` | Optional | Chin adjustment, range [0,1] |
257
+ | effect | `Array<EffectListOptions>` | Optional | effect list |
258
+ | onError | `(error) => {}` | Optional | Callback for errors that occur during runtime <br> - error.code=10000003 indicates high rendering latency <br> - error.code=10000006 indicates insufficient browser feature support, which may lead to lagging. Recommended solutions can be found in the Common Issues section at the end of the document. |
259
+
260
+ EffectListOptions:
261
+
262
+ | Name | Type | Attributes | Description |
263
+ |------------|----------|------------|-----------------------------------|
264
+ | id | `number` | Required | The effect id |
265
+ | intensity | `string` | Required | the strength of the effect |
266
+
267
+ ### trtc.updatePlugin('Beauty', options)
268
+
269
+ Allows modification of beauty parameters.
270
+
271
+ #### options
272
+
273
+ | Name | Type | Attributes | Description |
274
+ |------------|----------|------------|-----------------------------------|
275
+ | whiten | `number` | Optional | Whitening, range [0,1] |
276
+ | dermabrasion | `number` | Optional | Dermabrasion, range [0,1] |
277
+ | lift | `number` | Optional | Face slimming, range [0,1] |
278
+ | shave | `number` | Optional | Jaw shaving, range [0,1] |
279
+ | eye | `number` | Optional | Enlarged eyes, range [0,1] |
280
+ | chin | `number` | Optional | Chin adjustment, range [0,1] |
281
+ | effect | `Array<EffectListOptions>` | Optional | effect list |
282
+
283
+ EffectListOptions:
284
+
285
+ | Name | Type | Attributes | Description |
286
+ |------------|----------|------------|-----------------------------------|
287
+ | id | `number` | Required | The effect id |
288
+ | intensity | `string` | Required | the strength of the effect |
289
+
290
+ ### trtc.stopPlugin('Beauty')
291
+
292
+ Disables the beauty effect.
293
+
294
+ ## Frequently Asked Questions
295
+
296
+ **1. When running the demo in Chrome, the video appears upside down and laggy**
297
+
298
+ This plugin uses GPU acceleration, and you need to enable hardware acceleration mode in your browser settings. You can copy and paste `chrome://settings/system` into your browser's address bar and enable hardware acceleration mode.
299
+
300
+ **2. When device performance is insufficient and causes high latency with long rendering times**
301
+
302
+ You can reduce video resolution or frame rate by listening to events.
303
+
304
+ ```javascript
305
+ async function onError(error) {
306
+ const { code } = error;
307
+ if (code === 10000003 || code === 10000006) {
308
+ // Reduce resolution and frame rate
309
+ await trtc.updateLocalVideo({
310
+ option: {
311
+ profile: '480p_2'
312
+ },
313
+ });
314
+ // await trtc.stopPlugin('Beauty'); // Or disable the plugin
315
+ }
316
+ }
317
+
318
+ await trtc.startPlugin('Beauty', {
319
+ ...// Other parameters
320
+ onError,
321
+ });
322
+ ```
@@ -0,0 +1,149 @@
1
+ ## Function Description
2
+
3
+ This article introduces how to use the watermark plugin to add image watermarks on camera streams.
4
+
5
+ ## Prerequisites
6
+
7
+ - TRTC Web SDK version >= 5.3.0.
8
+
9
+ ## Implementation Steps
10
+
11
+ ### Install Watermark Plugin
12
+
13
+ ```javascript
14
+ import { Watermark } from 'trtc-sdk-v5/plugins/video-effect/watermark';
15
+
16
+ let trtc = TRTC.create({ plugins: [Watermark] });
17
+ ```
18
+
19
+ ### Open Camera
20
+
21
+ ```javascript
22
+ await trtc.startLocalVideo({
23
+ view: 'local-video'
24
+ option: {
25
+ mirror: false
26
+ }
27
+ });
28
+ ```
29
+
30
+ ### Start Watermark Plugin
31
+
32
+ ```javascript
33
+ await trtc.startPlugin('Watermark', {
34
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/trtc-watermark-test.png'
35
+ });
36
+ ```
37
+
38
+ After testing, you can replace the test image URL with your own watermark image. It is recommended to use a transparent PNG format.
39
+
40
+ ### Stop Watermark Plugin
41
+
42
+ ```javascript
43
+ await trtc.stopPlugin('Watermark');
44
+ ```
45
+
46
+ ## API Description
47
+
48
+ ### trtc.startPlugin('Watermark', options)
49
+
50
+ Start watermark plugin.
51
+
52
+ #### options
53
+
54
+ | Name | Type | Attributes | Description |
55
+ |-----------|----------------------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
56
+ | imageUrl | `string` | Required | Image watermark URL |
57
+ | x | `string` | Optional | Watermark left margin |
58
+ | y | `string` | Optional | Watermark top margin |
59
+ | size | `string \| number \| object` | Optional | When passing a string: <br> - `"cover"` scales the background image to fully cover the background area, which may cause parts of the background image to be invisible. <br> - `"contain"` scales the background image to fit entirely within the background area, possibly leaving some areas blank. <br> When passing a number: <br> - `x` scales the background image by x times, e.g., 0.5, with a valid range of `(0,1]` <br> When passing an object: <br> - You can specify manually by passing `{width: 200, height: 300}` <br> The default is `cover` |
60
+
61
+ **Example:**
62
+
63
+ ```javascript
64
+ await trtc.startPlugin('Watermark', {
65
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/tv2.png',
66
+ size: 'contain'
67
+ });
68
+ ```
69
+
70
+ ```javascript
71
+ await trtc.startPlugin('Watermark', {
72
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/tv2.png',
73
+ size: 'cover'
74
+ });
75
+ ```
76
+
77
+ ```javascript
78
+ await trtc.startPlugin('Watermark', {
79
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/tv2.png',
80
+ x: 0,
81
+ y: 0,
82
+ size: 0.5
83
+ });
84
+ ```
85
+
86
+ ```javascript
87
+ await trtc.startPlugin('Watermark', {
88
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/tv2.png',
89
+ x: 0,
90
+ y: 0,
91
+ size: {
92
+ width: 100,
93
+ height: 200
94
+ }
95
+ });
96
+ ```
97
+
98
+ ### trtc.updatePlugin('Watermark', options)
99
+
100
+ Update the watermark image, position, and size.
101
+
102
+ #### options
103
+
104
+ | Name | Type | Attributes | Description |
105
+ |-----------|----------------------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
106
+ | imageUrl | `string` | Required | Image watermark URL |
107
+ | x | `string` | Optional | Watermark left margin |
108
+ | y | `string` | Optional | Watermark top margin |
109
+ | size | `string \| number \| object` | Optional | When passing a string: <br> - `"cover"` scales the background image to fully cover the background area, which may cause parts of the background image to be invisible. <br> - `"contain"` scales the background image to fit entirely within the background area, possibly leaving some areas blank. <br> When passing a number: <br> - `x` scales the background image by x times, e.g., 0.5, with a valid range of `(0,1]` <br> When passing an object: <br> - You can specify manually by passing `{width: 200, height: 300}` <br> The default is `cover` |
110
+
111
+ ```javascript
112
+ await trtc.updatePlugin('Watermark', {
113
+ imageUrl: 'https://web.sdk.qcloud.com/trtc/webrtc/test/qer-test/watermark/tv2.png',
114
+ x: 100,
115
+ y: 200,
116
+ size: {
117
+ width: 50,
118
+ height: 50
119
+ }
120
+ });
121
+ ```
122
+
123
+ ### trtc.stopPlugin('Watermark')
124
+
125
+ Stop watermark plugin.
126
+
127
+ **Example:**
128
+
129
+ ```javascript
130
+ await trtc.stopPlugin('Watermark');
131
+ ```
132
+
133
+ ## Q&A
134
+
135
+ **1. Is the watermark mirrored?**
136
+
137
+ The local preview image is enabled by default, so the watermark will also be mirrored. You can disable the local preview mirror image.
138
+
139
+ ```javascript
140
+ await trtc.updateLocalVideo({
141
+ option: {
142
+ mirror: false
143
+ }
144
+ });
145
+ ```
146
+
147
+ **2. Why does the screen flashes black briefly after updating the watermark?**
148
+
149
+ Update SDK to v5.8.6+.
@@ -0,0 +1,96 @@
1
+ ## Feature Description
2
+
3
+ By default, audio and video streams in different rooms are isolated, and only users in the same room can communicate via audio and video. The cross-room connection feature allows users in different rooms to communicate via audio and video.
4
+
5
+ In live streaming scenarios, this feature supports communication between anchors and allows audiences in both rooms to watch the other anchor. This document explains how to use the CrossRoom plugin to implement cross-room connections.
6
+
7
+ Cross-room connections support two modes:
8
+ - **Room-level connection**: Connect with all anchors in the target room.
9
+ - **User-level connection**: Connect with a specific anchor in the target room.
10
+
11
+ ## How It Works
12
+
13
+ - **Room-level connection**: Push the audio and video streams of all anchors in the current room to the target room, and push the audio and video streams of all anchors in the target room to the current room.
14
+ - **User-level connection**: Push your own audio and video streams from the current room to the target room, and push the audio and video streams of the specified anchor in the target room to the current room.
15
+
16
+ ## Steps to Use
17
+
18
+ > **Note**: Ensure your SDK version is >= v5.8.0
19
+
20
+ ### 1. Start Cross-Room Connection
21
+
22
+ ```js
23
+ import { CrossRoom } from 'trtc-sdk-v5/plugins/cross-room';
24
+
25
+ const trtc = TRTC.create({ plugins: [CrossRoom] });
26
+
27
+ await trtc.enterRoom({ sdkAppId, userId: 'user1', userSig, roomId: 7777 });
28
+
29
+ // Connect user1 in room 7777 with user2 in room 8888. The stream of user2 will be pushed to room 7777, and the stream of user1 will be pushed to room 8888.
30
+ await trtc.startPlugin('CrossRoom', {
31
+ roomId: 8888,
32
+ // Choose either roomId or strRoomId
33
+ // strRoomId: '8888'
34
+ userId: 'user2' // If not provided, it indicates a room-level cross-room connection
35
+ });
36
+ ```
37
+
38
+ #### Parameter Description
39
+
40
+ | Parameter Name | Type | Required | Description |
41
+ |----------------|----------|----------|------------------------------------------|
42
+ | roomId | Number | No | Target room ID. |
43
+ | strRoomId | String | No | Target room string-type ID, choose either roomId or strRoomId. |
44
+ | userId | String | No | Anchor ID in the target room. If not provided, it indicates a room-level connection. |
45
+
46
+ ---
47
+
48
+ ### 2. Update Mute Status of Cross-Room Anchor
49
+
50
+ After starting a cross-room connection, the streams of anchors in the target room will be pushed to the current room, and all users in the current room can receive the audio and video streams of the anchor.
51
+
52
+ You can use the following interface to restrict the upstream capabilities (audio/main video/substream) of the cross-room anchor in the current room, affecting all users in the room.
53
+
54
+ If a certain upstream capability is disabled, users in the current room will not be able to receive or subscribe to the corresponding audio or video streams.
55
+
56
+ ```js
57
+ await trtc.updatePlugin('CrossRoom', {
58
+ updateList: [{
59
+ roomId: 8888,
60
+ // strRoomId: '8888'
61
+ userId: 'user2', // If not provided, it indicates a room-level cross-room connection
62
+ muteAudio: true,
63
+ muteVideo: false,
64
+ muteSubStream: false,
65
+ }]
66
+ });
67
+ ```
68
+
69
+ #### Parameter Description
70
+
71
+ | Parameter Name | Type | Required | Description |
72
+ |------------------------|----------|----------|------------------------------------------|
73
+ | updateList | Array | Yes | List of cross-room anchors whose mute status needs to be updated. |
74
+ | updateList[0].roomId | Number | No | Target room ID. |
75
+ | updateList[0].strRoomId| String | No | Target room string-type ID, choose either roomId or strRoomId. |
76
+ | updateList[0].userId | String | No | Anchor ID in the target room. If not provided, it indicates a room-level connection. |
77
+ | updateList[0].muteAudio| Boolean | No | Whether to stop the audio stream of the cross-room anchor from target room. |
78
+ | updateList[0].muteVideo| Boolean | No | Whether to stop the main video stream of the cross-room anchor from target room. |
79
+ | updateList[0].muteSubStream| Boolean | No | Whether to stop the substream video of the cross-room anchor from target room. |
80
+
81
+ ---
82
+
83
+ ### 3. Stop Cross-Room Connection
84
+
85
+ ```js
86
+ await trtc.stopPlugin('CrossRoom', { roomId: 8888 }); // Stop the cross-room connection with the specified room
87
+
88
+ await trtc.stopPlugin('CrossRoom'); // Stop all cross-room connections initiated by the current user
89
+ ```
90
+
91
+ #### Parameter Description
92
+
93
+ | Parameter Name | Type | Required | Description |
94
+ |----------------|----------|----------|------------------------------------------|
95
+ | roomId | Number | No | Target room ID. |
96
+ | strRoomId | String | No | Target room string-type ID, choose either roomId or strRoomId. |