@tencent-rtc/mcp 1.3.3 → 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.
- package/package.json +1 -1
- package/resource/doc/chatuikit/android/features/theme.md +363 -0
- package/resource/doc/chatuikit/{android/client_api_Android.md → faq/android_sdk/client-api.md} +0 -2
- package/resource/doc/chatuikit/faq/common/product.md +8 -0
- package/resource/doc/chatuikit/faq/flutter_sdk/faq.md +53 -0
- package/resource/doc/chatuikit/{iOS/client_api_iOS.md → faq/ios_sdk/client-api.md} +0 -2
- package/resource/doc/chatuikit/flutter/features/theme.md +379 -0
- package/resource/doc/chatuikit/flutter/integration.md +413 -0
- package/resource/doc/chatuikit/flutter/workflow.md +941 -0
- package/resource/doc/chatuikit/iOS/features/theme.md +416 -0
- package/resource/doc/chatuikit/iOS/workflow.md +0 -0
- package/resource/doc/chatuikit/react/components/chat-setting.md +86 -0
- package/resource/doc/chatuikit/react/components/contact-list.md +1093 -0
- package/resource/doc/chatuikit/react/components/search.md +745 -0
- package/resource/doc/chatuikit/vue/components/chat-setting.md +64 -0
- package/resource/doc/chatuikit/vue/components/contact-list.md +679 -0
- package/resource/doc/chatuikit/vue/components/search.md +1384 -0
- package/resource/doc/livekit/live/android/workflow.md +137 -6
- package/resource/doc/livekit/live/ios/live-audience-list.md +339 -0
- package/resource/doc/livekit/live/ios/live-audio-effect.md +370 -0
- package/resource/doc/livekit/live/ios/live-barrage.md +517 -0
- package/resource/doc/livekit/live/ios/live-base-beauty.md +247 -0
- package/resource/doc/livekit/live/ios/live-co-guest-interaction.md +518 -0
- package/resource/doc/livekit/live/ios/live-gift.md +783 -0
- package/resource/doc/livekit/live/ios/live-host-interaction.md +815 -0
- package/resource/doc/livekit/live/ios/live-integration.md +931 -0
- package/resource/doc/livekit/live/ios/live-live-list.md +485 -0
- package/resource/doc/livekit/live/ios/workflow.md +454 -0
- package/resource/doc/rtcengine/web/plugin/20-advanced-customized-capture-rendering.md +87 -0
- package/resource/doc/rtcengine/web/plugin/21-advanced-auto-play-policy.md +87 -0
- package/resource/doc/rtcengine/web/plugin/22-advanced-audio-mixer.md +175 -0
- package/resource/doc/rtcengine/web/plugin/23-advanced-support-detection.md +221 -0
- package/resource/doc/rtcengine/web/plugin/24-advanced-network-quality.md +140 -0
- package/resource/doc/rtcengine/web/plugin/25-advanced-device-change.md +99 -0
- package/resource/doc/rtcengine/web/plugin/26-advanced-publish-cdn-stream.md +451 -0
- package/resource/doc/rtcengine/web/plugin/27-advanced-small-stream.md +151 -0
- package/resource/doc/rtcengine/web/plugin/28-advanced-beauty.md +322 -0
- package/resource/doc/rtcengine/web/plugin/29-advanced-water-mark.md +149 -0
- package/resource/doc/rtcengine/web/plugin/30-advanced-cross-room-link.md +96 -0
- package/resource/doc/rtcengine/web/plugin/31-advanced-plugins-overview.md +330 -0
- package/resource/doc/rtcengine/web/plugin/34-advanced-proxy.md +248 -0
- package/resource/doc/rtcengine/web/plugin/35-advanced-ai-denoiser.md +81 -0
- package/resource/doc/rtcengine/web/plugin/36-advanced-virtual-background.md +242 -0
- package/resource/doc/rtcengine/web/plugin/37-advanced-voice-changer.md +99 -0
- package/resource/doc/rtcengine/web/plugin/39-advanced-video-decoder.md +33 -0
- package/resource/doc/rtcengine/web/plugin/40-advanced-video-mixer.md +379 -0
- package/resource/doc/rtcengine/web/plugin/41-advanced-small-stream-auto-switcher.md +91 -0
- package/resource/doc/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +315 -0
- package/resource/doc/rtcengine/web/plugin/43-advanced-face-detection.md +180 -0
- package/tools/chat/get-native-chat-feature-detail.js +30 -0
- package/tools/chat/get-native-chat-feature-detail.js.map +1 -0
- package/tools/chat/get-native-chat-integration.js +30 -12
- package/tools/chat/get-native-chat-integration.js.map +1 -1
- package/tools/common/get-faq.js +2 -4
- package/tools/common/get-faq.js.map +1 -1
- package/tools/definitions/get_native_chat_feature_detail_def.js +32 -0
- package/tools/definitions/get_native_chat_feature_detail_def.js.map +1 -0
- package/tools/definitions/get_native_chat_uikit_integration_def.js +19 -7
- package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
- package/tools/definitions/{get_native_live_extra_features_def.js → get_native_live_uikit_extra_features_def.js} +3 -3
- package/tools/definitions/get_native_live_uikit_extra_features_def.js.map +1 -0
- package/tools/definitions/{get_native_live_interaction_def.js → get_native_live_uikit_interaction_def.js} +3 -3
- package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -0
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js +49 -10
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -1
- package/tools/definitions/record_prompt_def.js +42 -11
- package/tools/definitions/record_prompt_def.js.map +1 -1
- package/tools/definitions/record_result_def.js +1 -1
- package/tools/index.js +6 -4
- package/tools/index.js.map +1 -1
- package/tools/live/{get_native_live_extra_features.js → get_native_live_uikit_extra_features.js} +4 -4
- package/tools/live/get_native_live_uikit_extra_features.js.map +1 -0
- package/tools/live/{get_native_live_interaction.js → get_native_live_uikit_interaction.js} +4 -4
- package/tools/live/get_native_live_uikit_interaction.js.map +1 -0
- package/tools/rtcengine/get-rtcengine-web-sdk-integration.js.map +1 -1
- package/tools/rtcengine/get-trtc-sdk-faq.js +32 -0
- package/tools/rtcengine/get-trtc-sdk-faq.js.map +1 -0
- package/tools/rtcengine/get-trtc-web-sdk-faq.js +1 -1
- package/tools/rtcengine/get-trtc-web-sdk-integration.js.map +1 -1
- package/tools/rtcengine/get-trtc-web-sdk-plugin.js +45 -0
- package/tools/rtcengine/get-trtc-web-sdk-plugin.js.map +1 -0
- package/utils/handle-component-name.js +0 -16
- package/utils/handle-component-name.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/chatuikit/android/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/android/integrarte_only_tuichat_Android.md +0 -290
- package/resource/doc/chatuikit/android/quick_start_Android.md +0 -138
- package/resource/doc/chatuikit/android/show_typing_Android.md +0 -43
- package/resource/doc/chatuikit/flutter/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +0 -133
- package/resource/doc/chatuikit/iOS/generate_UserSig.md +0 -306
- package/resource/doc/chatuikit/iOS/integrate_only_tuichat_iOS.md +0 -748
- package/resource/doc/chatuikit/iOS/quick_start_iOS.md +0 -163
- package/resource/doc/chatuikit/iOS/show_typing_iOS.md +0 -52
- package/tools/definitions/get_native_live_extra_features_def.js.map +0 -1
- package/tools/definitions/get_native_live_interaction_def.js.map +0 -1
- package/tools/live/get_native_live_extra_features.js.map +0 -1
- package/tools/live/get_native_live_interaction.js.map +0 -1
- /package/resource/doc/chatuikit/android/{integrate_tuikit_Android.md → integration.md} +0 -0
- /package/resource/doc/chatuikit/{faq/native_sdk/faq.md → android/workflow.md} +0 -0
- /package/resource/doc/chatuikit/{flutter/client_api_Flutter.md → faq/flutter_sdk/client-api.md} +0 -0
- /package/resource/doc/chatuikit/iOS/{integrate_tuikit_iOS.md → integration.md} +0 -0
- /package/resource/doc/chatuikit/react/components/{chatheader.md → chat-header.md} +0 -0
- /package/resource/doc/chatuikit/vue/components/{chatheader.md → chat-header.md} +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
## Function Description
|
|
2
|
+
|
|
3
|
+
This document will describe how to implement the virtual background feature during a call.
|
|
4
|
+
|
|
5
|
+
| Original Camera | Background Blur | Background Image |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| <img src="https://qcloudimg.tencent-cloud.cn/raw/28a9246a5e1071ea0200bfde6d2b110b.jpg" /> | <img src="https://qcloudimg.tencent-cloud.cn/raw/a605b69b39cea73a6ebfde6324e93fff.jpg" /> | <img src="https://qcloudimg.tencent-cloud.cn/raw/fec848fc9ff4a2b4dbfc49a5f4c2fb3d.jpg" /> |
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Pricing see [RTC-Engine Packages](https://trtc.io/document/56025).
|
|
12
|
+
- [TRTC SDK](https://www.npmjs.com/package/trtc-sdk-v5) version must be >= 5.5.0
|
|
13
|
+
- System and configuration requirements for various platforms are as follows:
|
|
14
|
+
|
|
15
|
+
<table>
|
|
16
|
+
<tr>
|
|
17
|
+
<td rowspan="1" colspan="1">Platform</td>
|
|
18
|
+
|
|
19
|
+
<td rowspan="1" colspan="1">Operating System</td>
|
|
20
|
+
|
|
21
|
+
<td rowspan="1" colspan="1">Browser Version</td>
|
|
22
|
+
|
|
23
|
+
<td rowspan="1" colspan="1">FPS</td>
|
|
24
|
+
|
|
25
|
+
<td rowspan="1" colspan="1">Recommended Configuration</td>
|
|
26
|
+
|
|
27
|
+
<td rowspan="1" colspan="1">Remarks</td>
|
|
28
|
+
</tr>
|
|
29
|
+
|
|
30
|
+
<tr>
|
|
31
|
+
<td rowspan="8" colspan="1">Web</td>
|
|
32
|
+
|
|
33
|
+
<td rowspan="2" colspan="1">Windows</td>
|
|
34
|
+
|
|
35
|
+
<td rowspan="2" colspan="1">Chrome 90+<br>Firefox 90+<br>Edge 97+</td>
|
|
36
|
+
|
|
37
|
+
<td rowspan="1" colspan="1">30</td>
|
|
38
|
+
|
|
39
|
+
<td rowspan="1" colspan="1">Memory: 16GB<br>CPU: i5-10500<br>GPU: Dedicated 2GB</td>
|
|
40
|
+
|
|
41
|
+
<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>
|
|
42
|
+
</tr>
|
|
43
|
+
|
|
44
|
+
<tr>
|
|
45
|
+
<td rowspan="1" colspan="1">15</td>
|
|
46
|
+
|
|
47
|
+
<td rowspan="1" colspan="1">Memory: 8GB<br>CPU: i3-8300<br>GPU: Integrated Intel 1GB</td>
|
|
48
|
+
</tr>
|
|
49
|
+
|
|
50
|
+
<tr>
|
|
51
|
+
<td rowspan="1" colspan="1">Mac</td>
|
|
52
|
+
|
|
53
|
+
<td rowspan="1" colspan="1">Chrome 98+<br>Firefox 96+<br>Safari 15+</td>
|
|
54
|
+
|
|
55
|
+
<td rowspan="1" colspan="1">30</td>
|
|
56
|
+
|
|
57
|
+
<td rowspan="1" colspan="1">2019 MacBook<br>Memory: 16GB (2667MHz)<br>CPU: i7 (6-core 2.60GHz)<br>GPU: AMD Radeon 5300M</td>
|
|
58
|
+
</tr>
|
|
59
|
+
|
|
60
|
+
<tr>
|
|
61
|
+
<td rowspan="3" colspan="1">Android</td>
|
|
62
|
+
|
|
63
|
+
<td rowspan="3" colspan="1">Chrome<br>Firefox Browser
|
|
64
|
+
|
|
65
|
+
<td rowspan="1" colspan="1">30</td>
|
|
66
|
+
|
|
67
|
+
<td rowspan="1" colspan="1">High-end devices (e.g., Qualcomm Snapdragon 8 Gen1)</td>
|
|
68
|
+
|
|
69
|
+
<td rowspan="3" colspan="1">It is recommended to use Chrome, or Firefox browsers and other mainstream browsers<br>
|
|
70
|
+
</tr>
|
|
71
|
+
|
|
72
|
+
<tr>
|
|
73
|
+
<td rowspan="1" colspan="1">20</td>
|
|
74
|
+
|
|
75
|
+
<td rowspan="1" colspan="1">Mid-range devices (e.g., MediaTek Dimensity 8000-MAX)</td>
|
|
76
|
+
</tr>
|
|
77
|
+
|
|
78
|
+
<tr>
|
|
79
|
+
<td rowspan="1" colspan="1">10</td>
|
|
80
|
+
|
|
81
|
+
<td rowspan="1" colspan="1">Low-end devices (e.g., Qualcomm Snapdragon 660)</td>
|
|
82
|
+
</tr>
|
|
83
|
+
|
|
84
|
+
<tr>
|
|
85
|
+
<td rowspan="2" colspan="1">iOS</td>
|
|
86
|
+
|
|
87
|
+
<td rowspan="2" colspan="1">Chrome<br>Safari<br>Firefox</td>
|
|
88
|
+
|
|
89
|
+
<td rowspan="1" colspan="1">30</td>
|
|
90
|
+
|
|
91
|
+
<td rowspan="1" colspan="1">iPhone 13</td>
|
|
92
|
+
|
|
93
|
+
<td rowspan="2" colspan="1">- Requires iOS 14.4 or above<br>- It is recommended to use Chrome or Safari browsers<br></td>
|
|
94
|
+
</tr>
|
|
95
|
+
|
|
96
|
+
<tr>
|
|
97
|
+
<td rowspan="1" colspan="1">20</td>
|
|
98
|
+
|
|
99
|
+
<td rowspan="1" colspan="1">iPhone XR</td>
|
|
100
|
+
</tr>
|
|
101
|
+
|
|
102
|
+
</table>
|
|
103
|
+
|
|
104
|
+
## Implementation Steps
|
|
105
|
+
|
|
106
|
+
### Deploying Static Resources
|
|
107
|
+
|
|
108
|
+
This plugin relies on certain static resource files. To ensure that the browser can load and run these files properly, follow these steps:
|
|
109
|
+
1. Publish the `node_modules/trtc-sdk-v5/assets` directory to a CDN or a static resource server.
|
|
110
|
+
2. Pass your CDN URL to the `assetsPath` parameter when creating the `trtc` instance, for example: `TRTC.create({ assetsPath: 'https://xxxx/assets' })`. The SDK will load the required resource files as needed.
|
|
111
|
+
> - If your version is below `v5.10.0`, you need to download and extract [assets.zip](https://web.sdk.qcloud.com/trtc/webrtc/v5/assets/assets.zip), then publish it to a CDN or a static resource server.
|
|
112
|
+
> - If the Host URL of the files in the directory is different from the Host URL of the web application, you need to enable the CORS policy for the file domain.
|
|
113
|
+
> - Do not place the directory files under an HTTP service, as loading HTTP resources from an HTTPS domain will be blocked by browser security policies.
|
|
114
|
+
> - If you are using the **Face Centering** feature after version `v5.11.0`, please redeploy the assets.
|
|
115
|
+
|
|
116
|
+
### Checking Browser Support (v5.8.1+)
|
|
117
|
+
```javascript
|
|
118
|
+
import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
|
|
119
|
+
if (!VirtualBackground.isSupported()) {
|
|
120
|
+
// Virtual background is not supported
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
### Registering the Plugin
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
|
|
127
|
+
|
|
128
|
+
const trtc = TRTC.create({ plugins: [VirtualBackground], assetsPath: 'https://xxxx/assets' });
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Starting the Local Camera
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
await trtc.startLocalVideo();
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Enabling the Virtual Background Plugin
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
await trtc.startPlugin('VirtualBackground', {
|
|
141
|
+
sdkAppId: 123123,
|
|
142
|
+
userId: 'userId_123',
|
|
143
|
+
userSig: 'your_userSig'
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> Note: The first time you enable this feature, it requires loading computing resources, which has been automatically processed for you. For a more ultimate startup experience, please refer to the end of the document: [FAQ > How to speed up startup?](##-FAQ)
|
|
148
|
+
|
|
149
|
+
### Updating Parameters as Needed
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Changing to an image background
|
|
153
|
+
await trtc.updatePlugin('VirtualBackground', {
|
|
154
|
+
type: 'image',
|
|
155
|
+
src: 'https://picsum.photos/seed/picsum/200/300'
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Disabling Virtual Background
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
await trtc.stopPlugin('VirtualBackground');
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## API Documentation
|
|
166
|
+
|
|
167
|
+
### trtc.startPlugin('VirtualBackground', options)
|
|
168
|
+
|
|
169
|
+
Used to enable the virtual background.
|
|
170
|
+
|
|
171
|
+
#### options
|
|
172
|
+
|
|
173
|
+
| Name | Type | Attributes | Description |
|
|
174
|
+
|------------|-----------|------------|-----------------------------------------|
|
|
175
|
+
| sdkAppId | `number` | Required | Current application ID |
|
|
176
|
+
| userId | `string` | Required | Current user ID |
|
|
177
|
+
| userSig | `string` | Required | UserSig corresponding to the user ID |
|
|
178
|
+
| type | `string` | Optional | - `image` for image background <br> - `blur` for background blur (default) |
|
|
179
|
+
| enableFaceCentering | `boolean` | Optional | `false` (default), (Since v5.11.0), set to true to enable automatic face centering |
|
|
180
|
+
| enableEffectOptimization | `boolean` | Optional | `false` (default), experimental feature, set to true to reduce black edges and jagged edges around characters. Currently only supported on PC and since v5.13.0. |
|
|
181
|
+
| blurLevel | `number` | Optional | - Set the level of blur when `type` is set to `blur`. Default value is 3, with a range from 1 to 10. |
|
|
182
|
+
| src | `string` | Required if type is `image` | Image URL, such as `https://picsum.photos/seed/picsum/200/300` |
|
|
183
|
+
| onAbort | `(error) => {}` | Optional | Callback for errors that occur during runtime <br> Recommended solutions can be found in the Common Issues section at the end of the document. |
|
|
184
|
+
|
|
185
|
+
**Example:**
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
await trtc.startPlugin('VirtualBackground', {
|
|
189
|
+
sdkAppId: 123123,
|
|
190
|
+
userId: 'userId_123',
|
|
191
|
+
userSig: 'your_userSig',
|
|
192
|
+
type: 'image',
|
|
193
|
+
src: 'https://picsum.photos/seed/picsum/200/300'
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### trtc.updatePlugin('VirtualBackground', options)
|
|
198
|
+
|
|
199
|
+
Allows modification of virtual background parameters.
|
|
200
|
+
|
|
201
|
+
#### options
|
|
202
|
+
|
|
203
|
+
| Name | Type | Attributes | Description |
|
|
204
|
+
|------------|----------|------------|-----------------------------------------|
|
|
205
|
+
| type | `string` | Required | - `image` for image background <br> - `blur` for background blur |
|
|
206
|
+
| enableFaceCentering (Since v5.11.0) | `boolean` | Optional |`false`(default)
|
|
207
|
+
| blurLevel | `number` | Optional | - Set the level of blur when `type` is set to `blur`. Default value is 3, with a range from 1 to 10. |
|
|
208
|
+
| src | `string` | Required if type is `image` | Image URL, such as `https://picsum.photos/seed/picsum/200/300` |
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
await trtc.updatePlugin('VirtualBackground', {
|
|
214
|
+
type: 'blur',
|
|
215
|
+
blurLevel: 6
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### trtc.stopPlugin('VirtualBackground')
|
|
220
|
+
|
|
221
|
+
Disables the virtual background.
|
|
222
|
+
|
|
223
|
+
## FAQs
|
|
224
|
+
|
|
225
|
+
**1. When running the demo in Chrome, the video appears upside down and laggy**
|
|
226
|
+
|
|
227
|
+
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.
|
|
228
|
+
|
|
229
|
+
**2. When device performance is insufficient, causing high latency and rendering issues**
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
async function onAbort(error) {
|
|
234
|
+
await trtc.stopPlugin('VirtualBackground'); // Stop the plugin
|
|
235
|
+
// Or lower the resolution and restart the plugin
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
await trtc.startPlugin('VirtualBackground', {
|
|
239
|
+
...// Other parameters
|
|
240
|
+
onAbort,
|
|
241
|
+
});
|
|
242
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
## Feature Description
|
|
2
|
+
|
|
3
|
+
This document describes how to use the Voice Changer Plugin.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Pricing see [RTC-Engine Packages](https://trtc.io/document/56025#f10b65d1-6e8d-41e3-8686-84909b00a1a2).
|
|
8
|
+
- TRTC Web SDK version >= 5.10
|
|
9
|
+
- Supported browsers: Chrome 66+, Edge 79+, Safari 15+, Firefox 76+, Chrome for Android 126+
|
|
10
|
+
|
|
11
|
+
## Implementation Process
|
|
12
|
+
|
|
13
|
+
### 1. Import and register the plugin
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { VoiceChanger } from 'trtc-sdk-v5/plugins/voice-changer';
|
|
17
|
+
|
|
18
|
+
let trtc = TRTC.create({ plugins: [VoiceChanger] });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Enable microphone
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
await trtc.startLocalAudio();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Use the voice changer plugin
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
await trtc.startPlugin('VoiceChanger', {
|
|
31
|
+
voiceType: 1,
|
|
32
|
+
sdkAppId: 123456,
|
|
33
|
+
userId: 'user_123',
|
|
34
|
+
userSig: 'XXXXXXXX'
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Update parameters after activation
|
|
38
|
+
await trtc.updatePlugin('VoiceChanger', {
|
|
39
|
+
voiceType: 2,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Disable the plugin before stopping microphone
|
|
43
|
+
await trtc.stopPlugin('VoiceChanger');
|
|
44
|
+
await trtc.stopLocalAudio();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## API Reference
|
|
49
|
+
|
|
50
|
+
### trtc.startPlugin('VoiceChanger', options)
|
|
51
|
+
|
|
52
|
+
Enable voice changing effects
|
|
53
|
+
|
|
54
|
+
#### options
|
|
55
|
+
| Name | Type | Attributes | Description |
|
|
56
|
+
|------------|----------|----------------------------------------------------------------|-------------|
|
|
57
|
+
| sdkAppId | `number` | Current application's sdkAppId |
|
|
58
|
+
| userId | `string` | Current user's userId |
|
|
59
|
+
| userSig | `string` | Current user's userSig |
|
|
60
|
+
| voiceType | `number` | 1-Mischievous Kid 2-Loli 3-Uncle 4-Heavy Metal 5-Cold 6-Foreign Accent 7-Caged Beast 8-Otaku 9-Strong Current 10-Heavy Machinery 11-Ethereal |
|
|
61
|
+
|
|
62
|
+
**Example:**
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
await trtc.startLocalAudio();
|
|
66
|
+
await trtc.startPlugin('VoiceChanger', {
|
|
67
|
+
voiceType: 1,
|
|
68
|
+
sdkAppId: 123456,
|
|
69
|
+
userId: 'user_123',
|
|
70
|
+
userSig: 'XXXXXXXX'
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### trtc.updatePlugin('VoiceChanger', options)
|
|
75
|
+
|
|
76
|
+
Modify voice changing effects
|
|
77
|
+
|
|
78
|
+
#### options
|
|
79
|
+
|
|
80
|
+
| Name | Type | Attributes | Description |
|
|
81
|
+
|------------|----------|--------------|-------------------------------------|
|
|
82
|
+
| voiceType | `number` | 1-Mischievous Kid 2-Loli 3-Uncle 4-Heavy Metal 5-Cold 6-Foreign Accent 7-Caged Beast 8-Otaku 9-Strong Current 10-Heavy Machinery 11-Ethereal |
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
await trtc.updatePlugin('VoiceChanger', {
|
|
88
|
+
voiceType: 2,
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### trtc.stopPlugin('VoiceChanger')
|
|
93
|
+
|
|
94
|
+
Disable voice changing effects
|
|
95
|
+
```javascript
|
|
96
|
+
// Disable the plugin before stopping microphone
|
|
97
|
+
await trtc.stopPlugin('VoiceChanger');
|
|
98
|
+
await trtc.stopLocalAudio();
|
|
99
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
## Feature Description
|
|
2
|
+
|
|
3
|
+
This document introduces how to use the TRTCVideoDecoder plugin to enable video decoder fallback capability. The plugin supports fallback to software decoding when regular decoding fails.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- TRTC Web SDK version >= 5.9.0
|
|
8
|
+
|
|
9
|
+
- [Contact us](https://trtc.io/contact) to enable decoder fallback capability
|
|
10
|
+
|
|
11
|
+
## Implementation Steps
|
|
12
|
+
|
|
13
|
+
### Deploy Static Resources
|
|
14
|
+
|
|
15
|
+
The plugin relies on some static resource files. To ensure that the browser can load and run these files properly, you need to complete the following steps:
|
|
16
|
+
1. Publish the `node_modules/trtc-sdk-v5/assets` directory to a CDN or static resource server.
|
|
17
|
+
2. Pass your CDN address to the `assetsPath` parameter when creating the `trtc` instance, for example: `TRTC.create({ assetsPath: 'https://xxx/assets' })`. The SDK will load the required resource files as needed.
|
|
18
|
+
> - If your version is below `v5.10.0`, you need to publish the `videodec.wasm` and `videodec_simd.wasm` files from the `node_modules/trtc-sdk-v5/plugins/video-decoder` directory to the CDN, and ensure they are in the same public directory, such as `xxx/assets`.
|
|
19
|
+
> - If the host URL of the directory files is different from the host URL of the web application, you need to enable the CORS policy for the file domain.
|
|
20
|
+
> - Do not place the directory files under an HTTP service, as loading HTTP resources under an HTTPS domain will be blocked by browser security policies.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 2. Import and Register Plugin
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import TRTCVideoDecoder from 'trtc-sdk-v5/plugins/video-decoder';
|
|
27
|
+
|
|
28
|
+
const trtc = TRTC.create({ plugins: [TRTCVideoDecoder], assetsPath: 'https://example.com/assets/' });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Plugin Activation
|
|
32
|
+
|
|
33
|
+
The plugin functionality will automatically activate the fallback logic when SDK regular decoding fails, using software decoding method to decode.
|