@tencent-rtc/mcp 1.7.3 → 1.7.4
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/CHANGELOG.md +13 -0
- package/README.md +13 -13
- package/knowledge/path-meta.js +23 -1
- package/package.json +1 -1
- package/resource/index/manifest.json +1 -1
- package/resource/knowledge/callkit/best-practice/android/video-chat-dating.md +497 -0
- package/resource/knowledge/callkit/best-practice/flutter/android-keep-call-alive-background.md +79 -0
- package/resource/knowledge/callkit/best-practice/flutter/background-incoming-call-no-notification.md +99 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-keep-call-alive-background.md +93 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-startup-crash-version-voip.md +68 -0
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +386 -0
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +315 -0
- package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +204 -0
- package/resource/knowledge/callkit/preset/harmonyos/api.md +362 -0
- package/resource/knowledge/callkit/preset/harmonyos/integration.md +318 -0
- package/resource/knowledge/callkit/preset/miniprogram/api-uniapp.md +430 -0
- package/resource/knowledge/callkit/preset/miniprogram/api.md +293 -0
- package/resource/knowledge/callkit/preset/miniprogram/integration.md +294 -0
- package/resource/knowledge/callkit/preset/miniprogram/uniapp-integration.md +224 -0
- package/resource/knowledge/callkit/preset/uni-app/api.md +339 -0
- package/resource/knowledge/callkit/preset/uni-app/integration.md +243 -0
- package/resource/knowledge/chat/preset/react/h5/integration.md +964 -0
- package/resource/knowledge/chat/preset/vue/h5/integration.md +717 -0
- package/resource/knowledge/rtcengine/web/plugin/23-advanced-support-detection.md +6 -6
- package/resource/knowledge/rtcengine/web/plugin/31-advanced-plugins-overview.md +8 -6
- package/resource/knowledge/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +30 -10
- package/server.js +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
|
@@ -23,7 +23,7 @@ TRTC.isSupported().then(checkResult => {
|
|
|
23
23
|
|
|
24
24
|
### Option 1: Use Device Detector Plugin (including default UI)
|
|
25
25
|
|
|
26
|
-
The device detector plugin is used to test the user's media device(camera, microphone, speaker) and network which is recommended to be used before the user enters the room.
|
|
26
|
+
The device detector plugin is used to test the user's media device(camera, microphone, speaker) and network which is recommended to be used before the user enters the room.
|
|
27
27
|
|
|
28
28
|
> - Support TRTC Web SDK version >= v5.8.0
|
|
29
29
|
> - The plugin includes a default UI. If the UI does not meet your product design requirements, you can refer to Option 2 for a custom UI implementation.
|
|
@@ -38,7 +38,7 @@ const trtc = TRTC.create({ plugins: [DeviceDetector] });
|
|
|
38
38
|
const result = await trtc.startPlugin('DeviceDetector');
|
|
39
39
|
|
|
40
40
|
// 2. Test Media Device & Network Quality
|
|
41
|
-
const options = {
|
|
41
|
+
const options = {
|
|
42
42
|
networkDetect: { sdkAppId, userId, userSig }
|
|
43
43
|
}
|
|
44
44
|
const resultWithNetwork = await trtc.startPlugin('DeviceDetector', options);
|
|
@@ -70,11 +70,11 @@ Enable the mirror checkbox during camera detection
|
|
|
70
70
|
|
|
71
71
|
| Name | Type | Attributes | Description |
|
|
72
72
|
| --------------- | ------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
|
-
| sdkAppId |
|
|
73
|
+
| sdkAppId | number | required | Your sdkAppId |
|
|
74
74
|
| userId | string | required | The userId for testing uplink network quality. It should be different from downlinkUserId. |
|
|
75
75
|
| userSig | string | required | The [UserSig](https://trtc.io/document/35166) of the userId. |
|
|
76
|
-
| downlinkUserId | string |
|
|
77
|
-
| downlinkUserSig | string |
|
|
76
|
+
| downlinkUserId | string | optional | The userId for testing downlink network quality. It should be different from userId. Fill in downlinkUserId and downlinkUserSig will perform a downlink network test. |
|
|
77
|
+
| downlinkUserSig | string | optional | The [UserSig](https://trtc.io/document/35166) of the downlinkUserId. |
|
|
78
78
|
| roomId | number | optional | Optional. The default value is 8080. The value must be an integer of [1, 4294967294] |
|
|
79
79
|
|
|
80
80
|
##### trtc.stopPlugin('DeviceDetector')
|
|
@@ -125,7 +125,7 @@ The device connection checks if the user's device has a camera, microphone, and
|
|
|
125
125
|
|
|
126
126
|
```javascript
|
|
127
127
|
import TRTC from 'trtc-sdk-v5';
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
const cameraList = await TRTC.getCameraList();
|
|
130
130
|
const micList = await TRTC.getMicrophoneList();
|
|
131
131
|
const hasCameraDevice = cameraList.some(camera => camera.deviceId !== '');
|
|
@@ -28,6 +28,7 @@ TRTC Web SDK v5 provides a plugin system that supports on-demand loading of vari
|
|
|
28
28
|
| **AIDenoiser** | AI noise reduction with support for far-field cancellation mode | - | Exclusive Edition | Required | {@tutorial 35-advanced-ai-denoiser} |
|
|
29
29
|
| **VoiceChanger** | Voice effects with 11 voice types (child, loli, uncle, etc.) | ≥ 5.10.0 | Premium Edition | - | {@tutorial 37-advanced-voice-changer} |
|
|
30
30
|
| **RealtimeTranscriber** | Real-time speech transcription and translation, converting audio to text with multi-language translation | ≥ 5.15.0 | None | - | {@tutorial 42-advanced-realtime-transcriber} |
|
|
31
|
+
| **Chorus** | KTV chorus with lead/backup singer roles, lyrics sync
|
|
31
32
|
|
|
32
33
|
### Streaming & Mixing
|
|
33
34
|
|
|
@@ -42,6 +43,7 @@ TRTC Web SDK v5 provides a plugin system that supports on-demand loading of vari
|
|
|
42
43
|
|---------|---------|---------|---------|---------|---------|
|
|
43
44
|
| **DeviceDetector** | Device detection for camera, microphone, speaker, and network with default UI | ≥ 5.8.0 | None | - | {@tutorial 23-advanced-support-detection} |
|
|
44
45
|
| **Debug** | Debug mode with full log upload/export and audio/video dump | ≥ 5.8.0 | None | - | {@tutorial 18-basic-debug} |
|
|
46
|
+
| **TRTCVideoDecoder** | Video decoder fallback to software decoding on failure | ≥ 5.9
|
|
45
47
|
| **SmallStreamAutoSwitcher** | Automatic dual-stream switching for smooth streaming in poor network | ≥ 5.11.0 | None | - | {@tutorial 41-advanced-small-stream-auto-switcher} |
|
|
46
48
|
<!-- | **CustomEncryption** | Custom encryption for end-to-end audio/video encryption with built-in or custom algorithms | - | Contact us | - | - | -->
|
|
47
49
|
|
|
@@ -61,7 +63,7 @@ import TRTC from 'trtc-sdk-v5';
|
|
|
61
63
|
import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
|
|
62
64
|
import { AIDenoiser } from 'trtc-sdk-v5/plugins/ai-denoiser';
|
|
63
65
|
|
|
64
|
-
const trtc = TRTC.create({
|
|
66
|
+
const trtc = TRTC.create({
|
|
65
67
|
plugins: [VirtualBackground, AIDenoiser],
|
|
66
68
|
assetsPath: 'https://your-cdn/assets' // If plugins require static assets
|
|
67
69
|
});
|
|
@@ -89,7 +91,7 @@ Use `trtc.updatePlugin(pluginName, options)` to dynamically update plugin parame
|
|
|
89
91
|
```javascript
|
|
90
92
|
await trtc.updatePlugin('VirtualBackground', {
|
|
91
93
|
type: 'image',
|
|
92
|
-
|
|
94
|
+
src: 'https://example.com/background.jpg'
|
|
93
95
|
});
|
|
94
96
|
```
|
|
95
97
|
|
|
@@ -164,8 +166,8 @@ await trtc.updatePlugin('VideoMixer', {
|
|
|
164
166
|
});
|
|
165
167
|
|
|
166
168
|
// Publish mixed track
|
|
167
|
-
await trtc.startLocalVideo({
|
|
168
|
-
option: {
|
|
169
|
+
await trtc.startLocalVideo({
|
|
170
|
+
option: {
|
|
169
171
|
videoTrack: track,
|
|
170
172
|
profile: { width: 1920, height: 1080, bitrate: 2000 }
|
|
171
173
|
}
|
|
@@ -185,7 +187,7 @@ TRTCVideoDecoder automatically starts fallback logic on decode failure after reg
|
|
|
185
187
|
```javascript
|
|
186
188
|
import TRTCVideoDecoder from 'trtc-sdk-v5/plugins/video-decoder';
|
|
187
189
|
|
|
188
|
-
const trtc = TRTC.create({
|
|
190
|
+
const trtc = TRTC.create({
|
|
189
191
|
plugins: [TRTCVideoDecoder],
|
|
190
192
|
assetsPath: 'https://your-cdn/assets'
|
|
191
193
|
});
|
|
@@ -309,7 +311,7 @@ cp -r node_modules/trtc-sdk-v5/assets ./public/assets
|
|
|
309
311
|
Pass the asset path when creating TRTC instance:
|
|
310
312
|
|
|
311
313
|
```javascript
|
|
312
|
-
const trtc = TRTC.create({
|
|
314
|
+
const trtc = TRTC.create({
|
|
313
315
|
plugins: [VirtualBackground, AIDenoiser],
|
|
314
316
|
assetsPath: 'https://your-cdn.com/assets'
|
|
315
317
|
});
|
|
@@ -90,7 +90,7 @@ const robotId = await trtc.startPlugin('RealtimeTranscriber', {
|
|
|
90
90
|
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (data) => {
|
|
91
91
|
console.log(`👤 ${data.speakerUserId}:`);
|
|
92
92
|
console.log(` Original: ${data.sourceText}`);
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
if (data.translationTexts) {
|
|
95
95
|
Object.entries(data.translationTexts).forEach(([lang, text]) => {
|
|
96
96
|
console.log(` ${lang.toUpperCase()}: ${text}`);
|
|
@@ -119,7 +119,7 @@ Starts a real-time transcription task.
|
|
|
119
119
|
|
|
120
120
|
| Name | Type | Required | Description |
|
|
121
121
|
|------|------|----------|-------------|
|
|
122
|
-
| sourceLanguage | `string` | Required | Source language code
|
|
122
|
+
| sourceLanguage | `string` | Required | Source language code. Specifies the language of the source audio. Use a standard language code (for example, `'zh'`). For the list of supported languages, see [Supported Languages](#supported-languages) |
|
|
123
123
|
| translationLanguages | `string` \| `string[]` | Optional | Target translation language(s), supports single language or array, e.g., `'en'` or `['en', 'ja']` |
|
|
124
124
|
| userIdsToTranscribe | `string` \| `string[]` | Optional | User ID(s) to transcribe, defaults to `'all'` for all users, can also specify single or multiple user IDs |
|
|
125
125
|
| transcriberRobotId | `string` | Optional | Custom transcriber robot ID, auto-generated if not provided |
|
|
@@ -183,6 +183,30 @@ trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_STATE_CHANGED, (event) => {
|
|
|
183
183
|
});
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
#### Backend Resource Limitation Notification
|
|
187
|
+
|
|
188
|
+
When the backend AI service (ASR/translation) resources are limited, the SDK proactively notifies through the `TRTC.EVENT.ERROR` event (the backend sends this notification at most once per minute, and stops sending it once resources recover). In this case:
|
|
189
|
+
|
|
190
|
+
- `error.code` is always `5400` (SERVER_ERROR, indicating the server failed to process the request)
|
|
191
|
+
- `error.extraCode` is the downgrade event code, see the table below
|
|
192
|
+
- `error.data` carries `{ roomId, transcriberRobotId, taskId, resourceType }` to identify the affected transcription task
|
|
193
|
+
|
|
194
|
+
You should degrade or disable the relevant AI capabilities in time to avoid affecting your online business.
|
|
195
|
+
|
|
196
|
+
| Event Code (extraCode) | Description | Suggested Action |
|
|
197
|
+
|------------|-------------|------------------|
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
trtc.on(TRTC.EVENT.ERROR, (error) => {
|
|
201
|
+
if (error.code === 5400 && error.extraCode === 5001) {
|
|
202
|
+
// e.g. error.message: 'The ASR/Translate concurrent usage has exceeded the limit. ...'
|
|
203
|
+
// error.data: { roomId, transcriberRobotId, taskId, resourceType }
|
|
204
|
+
console.warn(`Transcription service resources are limited, robotId: ${error.data.transcriberRobotId}, ${error.message}`);
|
|
205
|
+
// Degrade or disable the relevant AI capabilities as needed
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
186
210
|
### TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE
|
|
187
211
|
|
|
188
212
|
Transcription message event, triggered when new transcription results are available.
|
|
@@ -204,10 +228,10 @@ Transcription message event, triggered when new transcription results are availa
|
|
|
204
228
|
```javascript
|
|
205
229
|
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
206
230
|
const { speakerUserId, sourceText, translationTexts, isCompleted } = event;
|
|
207
|
-
|
|
231
|
+
|
|
208
232
|
// Display real-time transcription result
|
|
209
233
|
console.log(`[${isCompleted ? 'Completed' : 'In Progress'}] ${speakerUserId}: ${sourceText}`);
|
|
210
|
-
|
|
234
|
+
|
|
211
235
|
// Display translation results
|
|
212
236
|
if (translationTexts) {
|
|
213
237
|
translationTexts.forEach(({ language, text }) => {
|
|
@@ -228,10 +252,6 @@ trtc.off(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, handler);
|
|
|
228
252
|
|----------|------|
|
|
229
253
|
| Chinese | `zh` |
|
|
230
254
|
| English | `en` |
|
|
231
|
-
|
|
232
|
-
<!--
|
|
233
|
-
| Traditional Chinese | `zh-tw` |
|
|
234
|
-
| Chinese Dialects | `zh-dialect` |
|
|
235
255
|
| Cantonese | `zh-yue` |
|
|
236
256
|
| Vietnamese | `vi` |
|
|
237
257
|
| Japanese | `ja` |
|
|
@@ -252,7 +272,7 @@ trtc.off(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, handler);
|
|
|
252
272
|
| Swedish | `sv` |
|
|
253
273
|
| Danish | `da` |
|
|
254
274
|
| Norwegian | `no` |
|
|
255
|
-
|
|
275
|
+
| For more languages
|
|
256
276
|
|
|
257
277
|
### Translation Target Languages
|
|
258
278
|
|
|
@@ -301,7 +321,7 @@ const subtitleMap = new Map();
|
|
|
301
321
|
|
|
302
322
|
trtc.on(TRTC.EVENT.REALTIME_TRANSCRIBER_MESSAGE, (event) => {
|
|
303
323
|
subtitleMap.set(event.segmentId, event);
|
|
304
|
-
|
|
324
|
+
|
|
305
325
|
if (event.isCompleted) {
|
|
306
326
|
// Speech segment completed, can be archived
|
|
307
327
|
archiveSubtitle(subtitleMap.get(event.segmentId));
|
package/server.js
CHANGED