@tencent-rtc/mcp 1.6.8 → 1.7.1

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 (86) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +58 -39
  3. package/knowledge/build-index.js +30 -6
  4. package/knowledge/chunker.js +82 -14
  5. package/knowledge/chunking-policy.js +100 -0
  6. package/knowledge/content-loader.js +3 -3
  7. package/knowledge/doc-url-resolver.js +43 -16
  8. package/knowledge/frontmatter-meta.js +167 -0
  9. package/knowledge/path-meta.js +28 -6
  10. package/knowledge/search/exact-lookup.js +120 -239
  11. package/knowledge/search/filter-pool.js +12 -29
  12. package/knowledge/search/framework-fallback.js +22 -0
  13. package/knowledge/search/intent-router.js +29 -0
  14. package/knowledge/search/l1-enrich.js +159 -0
  15. package/knowledge/search/query-normalizer.js +63 -3
  16. package/knowledge/search/search-core.js +410 -0
  17. package/knowledge/search/search-knowledge.js +421 -379
  18. package/knowledge/search/search-message.js +88 -0
  19. package/knowledge/search/search-pass.js +428 -0
  20. package/knowledge/search/search-types.js +1 -0
  21. package/knowledge/search/url-row-idf.js +120 -0
  22. package/knowledge/search/url-row-scorer.js +337 -0
  23. package/package.json +3 -1
  24. package/resource/_schema/feature-aliases.yaml +1 -1
  25. package/resource/index/manifest.json +1 -1
  26. package/resource/knowledge/callkit/best-practice/callkit-miniprogram/uniapp-shrink.md +60 -0
  27. package/resource/knowledge/callkit/best-practice/common/call-autoplay-blocked.md +77 -0
  28. package/resource/knowledge/callkit/best-practice/common/call-message-in-chat.md +78 -0
  29. package/resource/knowledge/callkit/best-practice/common/call-vs-calls.md +110 -0
  30. package/resource/knowledge/callkit/best-practice/common/callengine-call-flow.md +123 -0
  31. package/resource/knowledge/callkit/best-practice/common/callengine-log-level.md +67 -0
  32. package/resource/knowledge/callkit/best-practice/common/callkit-get-engine-instance.md +81 -0
  33. package/resource/knowledge/callkit/best-practice/common/callkit-get-roomid.md +78 -0
  34. package/resource/knowledge/callkit/best-practice/common/callkit-limitations.md +37 -0
  35. package/resource/knowledge/callkit/best-practice/common/callkit-user-register-and-kicked.md +98 -0
  36. package/resource/knowledge/chat/best-practice/common/avchatroom-message-loss-diagnosis.md +65 -0
  37. package/resource/knowledge/chat/best-practice/common/group-conversation-cleanup-on-system-notice.md +62 -0
  38. package/resource/knowledge/chat/best-practice/common/image-message-url-lifecycle.md +59 -0
  39. package/resource/knowledge/chat/best-practice/common/login-repeat-2025-diagnosis.md +61 -0
  40. package/resource/knowledge/chat/best-practice/common/message-read-report-and-receipt.md +64 -0
  41. package/resource/knowledge/chat/best-practice/common/message-receive-event.md +65 -0
  42. package/resource/knowledge/chat/best-practice/common/message-risk-error-and-render.md +65 -0
  43. package/resource/knowledge/chat/best-practice/common/message-unread-count.md +71 -0
  44. package/resource/knowledge/chat/best-practice/miniprogram/audio-message-send.md +113 -0
  45. package/resource/knowledge/chat/best-practice/miniprogram/login-timeout-2801-diagnosis.md +63 -0
  46. package/resource/knowledge/chat/best-practice/miniprogram/media-upload-fail-diagnosis.md +64 -0
  47. package/resource/knowledge/chat/best-practice/web/audio-message-send.md +118 -0
  48. package/resource/knowledge/chat/urls/product.md +17 -16
  49. package/resource/knowledge/chat/urls/restapi.md +3 -2
  50. package/resource/knowledge/chat/urls/sdk/android.md +6 -5
  51. package/resource/knowledge/chat/urls/sdk/flutter.md +6 -5
  52. package/resource/knowledge/chat/urls/sdk/ios.md +4 -3
  53. package/resource/knowledge/chat/urls/sdk/web.md +7 -6
  54. package/resource/knowledge/chat/urls/webhook.md +0 -5
  55. package/resource/knowledge/livekit/best-practice/android/voice-room-anchor-start.md +120 -0
  56. package/resource/knowledge/livekit/best-practice/common/admin-take-seat.md +73 -0
  57. package/resource/knowledge/livekit/best-practice/common/audience-leave-live.md +81 -0
  58. package/resource/knowledge/livekit/best-practice/common/voice-room-no-audio-troubleshoot.md +100 -0
  59. package/resource/knowledge/livekit/best-practice/common/voice-room-seat-list-change.md +65 -0
  60. package/resource/knowledge/livekit/best-practice/flutter/voice-room-anchor-start.md +122 -0
  61. package/resource/knowledge/livekit/best-practice/ios/voice-room-anchor-start.md +126 -0
  62. package/resource/knowledge/roomkit/best-practice/common/room-ghost-member.md +70 -0
  63. package/resource/knowledge/roomkit/best-practice/common/room-limit-and-multi.md +83 -0
  64. package/resource/knowledge/roomkit/best-practice/common/room-screen-share-preview.md +83 -0
  65. package/resource/knowledge/roomkit/best-practice/common/room-status-after-all-leave.md +69 -0
  66. package/resource/knowledge/roomkit/best-practice/vue/room-uikit-vs-atomicx.md +111 -0
  67. package/resource/knowledge/rtcengine/web/plugin/30-advanced-cross-room-link.md +2 -0
  68. package/resource/knowledge/rtcengine/web/plugin/39-advanced-video-decoder.md +2 -0
  69. package/server.js +28 -23
  70. package/streamable-http.js +19 -54
  71. package/tools/common/search_trtc_knowledge.js +24 -12
  72. package/tools/definitions/finalize_answer_def.js +2 -2
  73. package/tools/definitions/integration-boundary.js +2 -1
  74. package/tools/definitions/search_trtc_knowledge_def.js +5 -3
  75. package/utils/fetch-doc-content.js +198 -0
  76. package/utils/preflight-route.js +197 -0
  77. package/utils/report-cls-client.js +1 -1
  78. package/utils/report-es-client.js +1 -1
  79. package/cursor-setting.png +0 -0
  80. package/mcp-server-prompt.png +0 -0
  81. package/resource/knowledge/callkit/best-practice/web/callengine-invitation.md +0 -80
  82. package/resource/knowledge/callkit/best-practice/web/callengine-log-control.md +0 -24
  83. package/resource/knowledge/callkit/best-practice/web/callkit-call-vs-calls.md +0 -116
  84. package/resource/knowledge/callkit/preset/react/uikit-api-reference.md +0 -444
  85. package/resource/knowledge/callkit/preset/vue/uikit-api-reference.md +0 -464
  86. package/resource/knowledge/chat/best-practice/web/image-message-url-handling.md +0 -16
@@ -0,0 +1,60 @@
1
+ ---
2
+ title: "TUICallKit Size Optimization for UniApp WeChat Mini Program Builds(uniapp 小程序 TUICallKit / 体积裁剪 / 瘦身)"
3
+ product: call
4
+ frameworks: [miniprogram]
5
+ scope: platform_specific
6
+ tags: [TUICallKit, uniapp, mini program, size optimization, plugin trimming, slimming, remove plugin, GroupCallView]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # TUICallKit Size Optimization for UniApp WeChat Mini Program Builds
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - TUICallKit includes all plugins by default. The core call engine (375 KB) and 1v1 call module (111 KB) are required and cannot be removed.
15
+ - The ringtone plugin (23 KB) and group call plugin (27 KB) can be removed on demand without affecting one-on-one call functionality.
16
+ - Trimming is achieved by removing plugin registration code and the corresponding pages configuration.
17
+
18
+ ## 2. Field / API Reference
19
+
20
+ | Module | Size | Required | Removal Method |
21
+ |---|---|---|---|
22
+ | Core call engine | 375 KB | Yes | — |
23
+ | 1v1 call | 111 KB | Yes | — |
24
+ | Ringtone plugin | 23 KB | Optional | Remove `this.registerPlugin(useRingPlugin())` |
25
+ | Group call plugin | 27 KB | Optional | Remove `this.registerPlugin(useGroupCallPlugin())` + the `GroupCallView` page entry in pages.json |
26
+
27
+ ## 3. Mechanism & Sequence
28
+
29
+ TUICallKit registers feature plugins via `registerPlugin` during initialization -> registered plugins are bundled into the mini program code -> removing the corresponding registration code prevents that plugin from being bundled -> the mini program package size decreases accordingly.
30
+
31
+ ## 4. Standard Usage
32
+
33
+ 1. Locate the plugin registration section in the TUICallKit initialization code.
34
+ 2. Remove `this.registerPlugin(useRingPlugin())` to remove the ringtone plugin.
35
+ 3. Remove `this.registerPlugin(useGroupCallPlugin())` to remove the group call plugin, and also remove the `GroupCallView` page entry from `pages.json`.
36
+
37
+ ## 5. Expected Results
38
+
39
+ - After removing the ringtone plugin, no ringtone plays during calls, but call functionality is unaffected.
40
+ - After removing the group call plugin, group calls cannot be initiated or joined, but one-on-one calls work normally.
41
+ - The mini program package size decreases by approximately 50 KB.
42
+ - Functionality verified: one-on-one calls (initiate, answer, hang up) remain fully operational.
43
+
44
+ ## 6. Common Pitfalls
45
+
46
+ - Pitfall 1: Attempting to remove the core call engine or 1v1 module (these are required; removing them breaks all call functionality).
47
+ - Pitfall 2: Removing only the plugin registration code but forgetting to also remove the `GroupCallView` page entry from `pages.json`, causing compilation errors.
48
+ - Pitfall 3: Expecting group call functionality to still work after removing the group call plugin (only one-on-one calls are available after removal).
49
+
50
+ ## 7. Problem Definition (retrieval hint)
51
+
52
+ When building a WeChat mini program with UniApp, TUICallKit includes too many plugins by default, resulting in a large package size. The goal is to remove unnecessary feature modules on demand.
53
+
54
+ ## 8. Alternative Queries (retrieval recall)
55
+
56
+ - How to reduce TUICallKit mini program package size?
57
+ - How to remove the ringtone plugin from UniApp TUICallKit?
58
+ - How to trim the group call feature from TUICallKit?
59
+ - How to optimize TUICallKit when the WeChat mini program package is too large?
60
+ - Can group calls still work after removing `GroupCallView`?
@@ -0,0 +1,77 @@
1
+ ---
2
+ title: "Why Web TUICallKit Shows a `Resume Playback` Dialog and How to Handle It( web TUICallKit 恢复播放弹窗)"
3
+ product: call
4
+ frameworks: [react, vue, web]
5
+ scope: platform_common
6
+ tags: [TUICallKit, resume playback, autoplay, webview, autoplay, enableAutoPlayDialog, callExperimentalAPI, no sound, vue2.6, vue2.7, vue3]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # Why Web TUICallKit Shows a "Resume Playback" Dialog and How to Handle It
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - Browser autoplay restriction: browsers block media with sound from playing before the user interacts with the page. When Web TUICallKit detects a playback failure, it shows a "Resume Playback" dialog requiring the user to click "Resume."
15
+ - This issue occurs most often in webview environments (e.g., H5 pages embedded in native apps).
16
+ - Disabling this dialog is not recommended because it may cause no-sound issues. If you must disable it, use `callExperimentalAPI` to set `enableAutoPlayDialog: 0`.
17
+
18
+ ## 2. Field / API Reference
19
+
20
+ | Field / API | Purpose | Notes |
21
+ |---|---|---|
22
+ | `enableAutoPlayDialog` | Autoplay dialog toggle | `1` enabled (default), `0` disabled |
23
+ | `callExperimentalAPI` | Invoke experimental API | Called via the TRTC instance to set `enableAutoPlayDialog` |
24
+ | `getTUICallEngineInstance()` | Get the TUICallEngine instance | Obtained from `TUICallKitAPI` to access the underlying engine |
25
+ | `getTRTCCloudInstance()` | Get the TRTC instance | Obtained from TUICallEngine to access the TRTC cloud instance |
26
+
27
+ ## 3. Mechanism & Sequence
28
+
29
+ User enters the call page -> TUICallKit attempts to auto-play audio -> browser blocks autoplay -> playback fails -> TUICallKit shows the "Resume Playback" dialog -> user clicks "Resume" -> audio plays normally.
30
+
31
+ In webview scenarios, the host app imposes stricter autoplay restrictions, making this issue more likely.
32
+
33
+ ## 4. Standard Usage
34
+
35
+ Disabling the dialog is not recommended. If your use case requires it:
36
+
37
+ 1. Get the TUICallEngine instance from `TUICallKitAPI`.
38
+ 2. Get the TRTC cloud instance from TUICallEngine.
39
+ 3. Call `callExperimentalAPI` on the TRTC instance to set `enableAutoPlayDialog: 0`.
40
+
41
+ ```javascript
42
+ // React: @trtc/calls-uikit-react
43
+ // Vue 3: @trtc/calls-uikit-vue
44
+ // Vue 2.7: @trtc/calls-uikit-vue2
45
+ // Vue 2.6: @trtc/calls-uikit-vue2.6 (API 一致,仅包名不同)
46
+ import { TUICallKitAPI } from "@trtc/calls-uikit-react";
47
+
48
+ const trtcCloudInstance = TUICallKitAPI?.getTUICallEngineInstance()?.getTRTCCloudInstance();
49
+ const params = {
50
+ api: 'enableAutoPlayDialog',
51
+ params: { enable: 0 },
52
+ };
53
+ trtcCloudInstance?.callExperimentalAPI(JSON.stringify(params));
54
+ ```
55
+
56
+ ## 5. Expected Results
57
+
58
+ - Dialog enabled: a "Resume Playback" prompt appears during calls; audio plays normally after the user clicks it.
59
+ - Dialog disabled: no prompt appears during calls; audio auto-plays once the browser allows it (if still blocked, there is no sound).
60
+
61
+ ## 6. Common Pitfalls
62
+
63
+ - Pitfall 1: Assuming the dialog is a TUICallKit bug (it is actually the browser's autoplay restriction policy).
64
+ - Pitfall 2: Disabling the dialog and expecting audio to play correctly in all scenarios (disabling the dialog does not bypass the autoplay restriction; no-sound issues may still occur).
65
+ - Pitfall 3: Calling `enableAutoPlayDialog` before TUICallKit initialization (it must be called after obtaining the TRTC instance).
66
+
67
+ ## 7. Problem Definition (retrieval hint)
68
+
69
+ Web TUICallKit shows a "Resume Playback" dialog during calls, requiring a user click before audio is heard. How to resolve this and whether the dialog can be disabled.
70
+
71
+ ## 8. Alternative Queries (retrieval recall)
72
+
73
+ - Why is there no sound in TUICallKit calls?
74
+ - Why does TUICallKit show a "Resume Playback" prompt?
75
+ - How to disable the TUICallKit autoplay dialog?
76
+ - How to fix no sound in TUICallKit inside a webview?
77
+ - How to configure `enableAutoPlayDialog`?
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: "How to Display Call Messages When Integrating TUICallKit with a UI-less Chat SDK Project(TUICallKit 通话消息上屏 / 通话信令字段含义)"
3
+ product: call
4
+ frameworks: [react, vue, miniprogram, android, ios, flutter, uni-app, web]
5
+ scope: platform_common
6
+ tags: [TUICallKit, call-message, custom message, actionType, cmd, call_end, call message rendering]
7
+ version_range: ">=2.0.0"
8
+ ---
9
+
10
+ # How to Display Audio/Video Call Messages When Integrating TUICallKit with a UI-less Chat SDK Project
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - Call messages are custom messages sent by the backend via the Chat REST API during TUICallKit calls. Each platform can retrieve them through the Chat SDK's message-received event or by pulling message history.
15
+ - Real-time call states (ringing, answering, hanging up) are handled by TUICallKit event listeners and do not rely on Chat messages.
16
+ - Use `actionType` to determine the call result type (hang up / cancel / reject / timeout) and `cmd` to distinguish voice / video / busy.
17
+ - Call duration is obtained from the `call_end` field, in seconds.
18
+
19
+ ## 2. Field / API Reference
20
+
21
+ | Field / API | Purpose | Notes |
22
+ |---|---|---|
23
+ | `actionType` | Call event type | 1=initiate/hang up, 2=cancel, 3=answer, 4=reject, 5=timeout |
24
+ | `cmd` | Call command subtype | `videoCall` video call, `audioCall` voice call, `hangup` hang up, `line_busy` busy |
25
+ | `call_end` | Call duration | Present when `actionType=1` and `cmd=hangup`, in seconds |
26
+ | `MESSAGE_RECEIVED` | Message received event | Unified Chat SDK event that includes call custom messages |
27
+ | `getMessageList` | Pull message history | Called when entering a conversation; call messages are included in the returned list |
28
+
29
+ ### actionType and cmd Mapping
30
+
31
+ | Scenario | actionType | cmd | Notes |
32
+ |---|---|---|---|
33
+ | Initiate call | 1 | `videoCall` or `audioCall` | Sent by caller |
34
+ | Answered | 3 | — | Triggered after callee answers |
35
+ | Call ended | 1 | `hangup` | One party hung up; `call_end` contains duration |
36
+ | Call cancelled | 2 | — | Caller cancelled before answer |
37
+ | Call rejected | 4 | — | Callee actively rejected |
38
+ | Remote busy | 4 | `line_busy` | Callee is already in a call |
39
+ | Timeout (no answer) | 5 | — | Callee did not answer within the time limit |
40
+
41
+ ## 3. Mechanism & Sequence
42
+
43
+ Caller initiates a call -> TUICallKit establishes the call connection via a signaling channel (not Chat messages) -> during the call, each state change (cancel / answer / reject / timeout / hang up) triggers the TUICallKit backend to send a custom message to the Chat SDK via REST API -> both parties receive the message through `MESSAGE_RECEIVED` -> parse `actionType` and `cmd` to identify the event type and update the UI.
44
+
45
+ The call process itself (initiate, answer, cancel, reject, timeout) does not rely on Chat custom messages for notification; Chat messages are solely used to display call records in the conversation after the call ends.
46
+
47
+ ## 4. Standard Usage
48
+
49
+ 1. Retrieve the call custom messages sent by the backend via the Chat SDK (listen to the message-received event or pull message history; the API name varies by platform but the semantics are the same).
50
+ 2. Read `message.actionType` and `message.cmd` to determine the call event type.
51
+ 3. For hang-up messages (`actionType=1, cmd=hangup`), read `message.call_end` to display the call duration.
52
+ 4. Other `actionType` values indicate why the call was not connected (cancel / reject / busy / timeout); update the UI display accordingly.
53
+
54
+ ## 5. Expected Results
55
+
56
+ - After each call state change, a call custom message can be received via the Chat SDK.
57
+ - `actionType` and `cmd` correctly reflect the call state change.
58
+ - The `call_end` value accurately reflects the actual call duration.
59
+
60
+ ## 6. Common Pitfalls
61
+
62
+ - Pitfall 1: Treating call messages as generic custom messages without reading `actionType` to distinguish states.
63
+ - Pitfall 2: Only handling `MESSAGE_RECEIVED` without processing offline call messages pulled via `getMessageList`.
64
+ - Pitfall 3: Calculating call duration from the `timestamp` difference between messages (should read directly from the `call_end` field).
65
+ - Pitfall 4: Not handling the `line_busy` scenario, causing busy to be treated as a normal rejection.
66
+
67
+ ## 7. Problem Definition (retrieval hint)
68
+
69
+ When integrating TUICallKit with a UI-less Chat SDK project, how to retrieve and render audio/video call messages (initiate / answer / hang up / cancel / reject / timeout / busy) via the Chat SDK.
70
+
71
+ ## 8. Alternative Queries (retrieval recall)
72
+
73
+ - How to parse TUICallKit call messages?
74
+ - What do the various `actionType` values mean?
75
+ - How to get the call duration after a call ends?
76
+ - How to distinguish between initiate and hang up in `MESSAGE_RECEIVED` call messages?
77
+ - How to determine if the callee is busy?
78
+ - Is call message parsing the same on mini programs and Web?
@@ -0,0 +1,110 @@
1
+ ---
2
+ title: "TUICallKit Difference Between calls and call/groupCall(call、groupCall 和 calls 的区别 / 参数1和2分别代表什么)"
3
+ product: call
4
+ frameworks: [react, vue, web]
5
+ scope: platform_common
6
+ tags: [call, calls, groupCall, userIDList, TUICallKit, init, v4.x, calls-uikit, vue2, vue2.6, vue2.7, vue3, call vs calls difference, callMediaType, parameters 1 and 2, numeric literal, call type, enum constant]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # TUICallKit React/Vue: Difference Between calls and call/groupCall for Initiating Audio/Video Calls
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - TUICallKit React / Vue **v4.x must use `calls`** to initiate one-on-one or group calls.
15
+ - `call` and `groupCall` are deprecated since v4.0.0.
16
+ - `init` must be completed before initiating a call; otherwise the call may fail or enter an abnormal state.
17
+ - Use the `CallMediaType` enum constant for `type`; using numeric literals (1/2) as the primary approach is not recommended.
18
+ - `userIDList` must be an array (even for one-on-one calls); pass `chatGroupID` only when linking with a Chat group.
19
+
20
+ ## 2. Field / API Reference
21
+
22
+ | Field / API | Purpose | Notes |
23
+ |---|---|---|
24
+ | `TUICallKitAPI` | v4.x entry object | Imported from `@trtc/calls-uikit-{react\|vue}`, replaces the legacy `TUICallKitServer` |
25
+ | `calls` | Initiate a call (v4.x) | Unified entry for one-on-one and group calls |
26
+ | `call` / `groupCall` | Initiate a call (legacy) | Used before v4.0.0, deprecated in v4.x |
27
+ | `CallMediaType` | Call media type enum | `AUDIO` for voice, `VIDEO` for video |
28
+ | `roomID` / `strRoomID` | Room ID | Mutually exclusive; choose one, do not mix |
29
+
30
+ ## 3. Mechanism & Sequence
31
+
32
+ Initialize -> log in -> call `calls` to initiate a call -> wait for callee to answer -> call established -> call ends.
33
+
34
+ For new v4.x projects, start directly with `calls`. When migrating legacy projects, replace `call`/`groupCall` with `calls` and replace `TUICallKitServer` with `TUICallKitAPI`.
35
+
36
+ ## 4. Standard Usage
37
+
38
+ 1. Import `TUICallKitAPI` from the corresponding platform package.
39
+ 2. Call `TUICallKitAPI.init({ SDKAppID, userID, userSig })` to complete initialization.
40
+ 3. Call `TUICallKitAPI.calls({ userIDList, type })` to initiate a call.
41
+ 4. Handle call initiation failures in the `catch` branch.
42
+
43
+ ```javascript
44
+ // React: @trtc/calls-uikit-react
45
+ // Vue 3: @trtc/calls-uikit-vue
46
+ // Vue 2.7: @trtc/calls-uikit-vue2
47
+ // Vue 2.6: @trtc/calls-uikit-vue2.6 (API 一致,仅包名不同)
48
+ import { TUICallKitAPI } from "@trtc/calls-uikit-react";
49
+
50
+ // 1. 初始化
51
+ TUICallKitAPI.init({ SDKAppID, userID, userSig });
52
+
53
+ // 2. 发起通话(单聊或多人)
54
+ try {
55
+ await TUICallKitAPI.calls({
56
+ userIDList: ['jack', 'tom'],
57
+ type: CallMediaType.VIDEO_CALL
58
+ });
59
+ } catch (error: any) {
60
+ console.error(`[TUICallKit] Failed to call. Reason:${error}`);
61
+ }
62
+ ```
63
+
64
+ `calls` parameter reference:
65
+
66
+ | Parameter | Type | Required | Description |
67
+ |---|---|---|---|
68
+ | userIDList | Array\<String\> | Yes | List of users to call |
69
+ | type | CallMediaType | Yes | Call media type (`AUDIO`/`VIDEO`) |
70
+ | chatGroupID | String | No | Chat group ID |
71
+ | roomID | Number | No | Numeric room ID, range [1, 2147483647] |
72
+ | strRoomID | String | No | String room ID. Mutually exclusive with roomID; if both are provided, roomID takes priority |
73
+ | timeout | Number | No | Call timeout in seconds, default 30s, range 10s–600s |
74
+ | userData | String | No | Custom extension field; the callee can read it from `ON_CALL_RECEIVED` |
75
+ | offlinePushInfo | Object | No | Custom offline push parameters |
76
+
77
+ CallMediaType values:
78
+
79
+ | CallMediaType | Description |
80
+ |---|---|
81
+ | `CallMediaType.AUDIO` | Voice call |
82
+ | `CallMediaType.VIDEO` | Video call |
83
+
84
+ ## 5. Expected Results
85
+
86
+ - After `TUICallKitAPI.calls` succeeds, the callee receives a call invitation.
87
+ - Once the callee answers, the call is established and both parties can communicate via audio/video.
88
+ - When the call times out or the callee rejects, the `catch` branch receives a clear error message.
89
+
90
+ ## 6. Common Pitfalls
91
+
92
+ - Pitfall 1: Continuing to use `call` / `groupCall` in v4.x (deprecated; no error is thrown but functionality is incomplete).
93
+ - Pitfall 2: Passing a single string via a `userID` field instead of `userIDList` (v4.x no longer supports single-string parameters).
94
+ - Pitfall 3: Mixing `roomID` and `strRoomID` (they are mutually exclusive and not interchangeable).
95
+ - Pitfall 4: Persistently using numeric literals (1/2) for `type` instead of `CallMediaType` enum constants.
96
+
97
+ ## 7. Problem Definition (retrieval hint)
98
+
99
+ TUICallKit React/Vue v4.x users ask how to initiate audio/video calls and the difference between `calls` and the legacy `call`/`groupCall`, including migration steps.
100
+
101
+ ## 8. Alternative Queries (retrieval recall)
102
+
103
+ - How to initiate a call with TUICallKit React/Vue?
104
+ - What is the difference between `calls` and `call`?
105
+ - How to pass the `userIDList` parameter in v4.x?
106
+ - Can `CallMediaType` and numeric values 1/2 be mixed?
107
+ - What should I watch out for when migrating from `TUICallKitServer.call` to `TUICallKitAPI.calls`?
108
+ - What do `type` parameter values 1 and 2 represent in `call`?
109
+ - What do `callMediaType` values 1 and 2 mean — voice or video?
110
+ - What do TUICallKit call type numbers 1 and 2 mean?
@@ -0,0 +1,123 @@
1
+ ---
2
+ title: "TUICallEngine Call Invitation Receiving and Initiating Flow(TUICallEngine 发起通话的流程)"
3
+ product: call
4
+ frameworks: [web, miniprogram]
5
+ scope: platform_common
6
+ tags: [TUICallEngine, ON_CALL_RECEIVED, calls, accept, reject, call invitation, call-engine-lite, userData, callMediaType]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # TUICallEngine Call Invitation Receiving and Initiating Flow
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - To receive call invitations, listen only to `TUICallEvent.ON_CALL_RECEIVED`. **Do not listen to the Chat SDK's `MESSAGE_RECEIVED` and parse call invitations manually.**
15
+ - To initiate a call, use `TUICallEngine.calls()` with `userIDList` (array) and `type` (media type) in the parameters.
16
+ - After receiving an invitation, call `accept()` to answer or `reject()` to decline. Extension data is passed via the `userData` string.
17
+ - The Web and mini program APIs are identical; only the package name differs (Web: `@trtc/call-engine-lite-js`, Mini Program: `@trtc/call-engine-lite-wx`).
18
+
19
+ ## 2. Field / API Reference
20
+
21
+ | Field / API | Purpose | Notes |
22
+ |---|---|---|
23
+ | `TUICallEvent.ON_CALL_RECEIVED` | Receive call invitation event | Triggered when the callee receives an incoming call; do not parse from Chat custom messages |
24
+ | `calls({userIDList, type, ...})` | Initiate a call | Called by the caller; unified entry for one-on-one and group calls |
25
+ | `accept()` | Answer the call | Called by the callee after receiving an invitation |
26
+ | `reject()` | Reject the call | Called by the callee after receiving an invitation |
27
+ | `userData` | Custom extension data | A string passed by the caller; the callee reads it from the `ON_CALL_RECEIVED` event |
28
+ | `callMediaType` | Call media type | Carried in the `ON_CALL_RECEIVED` event: 1=voice, 2=video |
29
+ | `inviteID` | Invitation ID | Identifies a single call invitation, used to correlate subsequent events |
30
+ | `callId` | Call ID | Unique identifier for this call |
31
+ | `callRole` | Role | Caller (`call`) / Callee (`called`) |
32
+
33
+ ### ON_CALL_RECEIVED Event Fields
34
+
35
+ | Parameter | Type | Description |
36
+ |---|---|---|
37
+ | callerId | String | The inviter |
38
+ | calleeIdList | Array\<String\> | Other users also invited |
39
+ | isFromGroup | Boolean | Whether it is a group call |
40
+ | inviteData | Object | Call data |
41
+ | inviteID | String | Invitation ID |
42
+ | userData | String | Extension field — custom data passed by the caller |
43
+ | callId | String | Unique ID for this call |
44
+ | roomID | Number | Audio/video room ID |
45
+ | callMediaType | Number | Call media type (1=voice, 2=video) |
46
+ | callRole | String | Role: caller / callee |
47
+
48
+ ### calls Parameter Reference
49
+
50
+ | Parameter | Type | Required | Description |
51
+ |---|---|---|---|
52
+ | userIDList | Array\<String\> | Yes | List of users to call |
53
+ | type | Number | Yes | 1=voice, 2=video (`CallMediaType`) |
54
+ | userData | String | No | Custom extension data; the callee reads it from `ON_CALL_RECEIVED` |
55
+ | timeout | Number | No | Timeout in seconds, default 30 |
56
+ | roomID | Number | No | Numeric room ID, range [1, 2147483647] |
57
+ | strRoomID | String | No | String room ID; mutually exclusive with roomID |
58
+ | chatGroupID | String | No | Chat group ID; used for multi-party calls in a group chat |
59
+ | offlinePushInfo | Object | No | Custom offline push parameters |
60
+
61
+ ## 3. Mechanism & Sequence
62
+
63
+ Caller invokes `calls()` to send an invitation -> the SDK sends the invitation via the signaling channel -> callee triggers `ON_CALL_RECEIVED` -> callee calls `accept()` to answer or `reject()` to decline -> call is established / ended.
64
+
65
+ Real-time state changes during the call are handled through TUICallEngine event listeners and do not rely on Chat messages.
66
+
67
+ ## 4. Standard Usage
68
+
69
+ 1. Create a `TUICallEngine` instance and log in.
70
+ 2. The caller calls `calls()` to initiate a call invitation.
71
+ 3. The callee listens for the `ON_CALL_RECEIVED` event and calls `accept()` or `reject()` upon receiving it.
72
+ 4. Extension data is passed as a `userData` string; the callee reads it from the event.
73
+
74
+ ```javascript
75
+ // Web: @trtc/call-engine-lite-js
76
+ // 小程序: @trtc/call-engine-lite-wx (API 一致,仅包名不同)
77
+ import { TUICallEngine, TUICallEvent } from '@trtc/call-engine-lite-js';
78
+
79
+ // 创建实例并登录
80
+ const tuiCallEngine = TUICallEngine.createInstance({ SDKAppID: xxx, tim: timInstance });
81
+ await tuiCallEngine.login({ userID, userSig });
82
+
83
+ // 主叫:发起通话邀请
84
+ await tuiCallEngine.calls({
85
+ userIDList: ['user_bob'],
86
+ type: 2, // 1=语音 2=视频
87
+ userData: '{"ext":"info"}',
88
+ timeout: 30,
89
+ });
90
+
91
+ // 被叫:监听通话邀请
92
+ tuiCallEngine.on(TUICallEvent.ON_CALL_RECEIVED, (event) => {
93
+ console.log('来电', event);
94
+ // 展示接听 UI,随后调用 accept() 或 reject()
95
+ tuiCallEngine.accept({ inviteID: event.inviteID, roomID: event.roomID });
96
+ });
97
+ ```
98
+
99
+ ## 5. Expected Results
100
+
101
+ - After the caller invokes `calls()`, the callee receives the `ON_CALL_RECEIVED` event.
102
+ - After the callee calls `accept()`, the call is established; after `reject()`, the call is declined.
103
+ - `userData` passed by the caller can be correctly read by the callee from the event.
104
+ - Other events during the call (answer, hang up, timeout, etc.) are triggered normally through TUICallEngine's event mechanism.
105
+
106
+ ## 6. Common Pitfalls
107
+
108
+ - Pitfall 1: Listening to `MESSAGE_RECEIVED` to manually parse call invitations (use `ON_CALL_RECEIVED` instead).
109
+ - Pitfall 2: Using `businessID` / low-level payload formats or other SDK internal fields (no official public documentation exists; do not fabricate them).
110
+ - Pitfall 3: Assuming a `customData` field exists (v4.x uses the `userData` string to pass custom data).
111
+
112
+ ## 7. Problem Definition (retrieval hint)
113
+
114
+ TUICallEngine Web / mini program users need to understand how to receive call invitations, initiate calls, and pass custom extension data.
115
+
116
+ ## 8. Alternative Queries (retrieval recall)
117
+
118
+ - How does TUICallEngine receive call invitations?
119
+ - How does TUICallEngine initiate a call?
120
+ - What do the `ON_CALL_RECEIVED` fields mean?
121
+ - How to fill in the `calls` API parameters?
122
+ - How does TUICallEngine pass custom extension data?
123
+ - Is the call invitation flow in mini program TUICallEngine the same as Web?
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: "Set log Level for TUICallEngine(TUICallEngine / setLogLevel / 日志级别 / 控制台日志 / 关闭日志)"
3
+ product: call
4
+ frameworks: [web, miniprogram]
5
+ scope: platform_common
6
+ tags: [TUICallEngine, setLogLevel, log level, console log, disable log]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # Setting the Log Output Level for TUICallEngine
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - TUICallEngine provides the `setLogLevel` API to control the log output level. It can be called immediately after creating an instance.
15
+ - During integration and debugging, set the level to 0 (verbose). After going live, set it to level 1 (default, key info) or higher.
16
+ - To disable all logs, set the level to 4.
17
+
18
+ ## 2. Field / API Reference
19
+
20
+ | Level | Value | Description |
21
+ |---|---|---|
22
+ | Verbose | 0 | High log volume; recommended during integration and debugging |
23
+ | Key info | 1 | SDK outputs key information; **default log level** |
24
+ | Warning | 2 | SDK outputs only warning and error level logs |
25
+ | Error | 3 | SDK outputs only error level logs |
26
+ | Silent | 4 | SDK prints no logs at all |
27
+
28
+ ## 3. Mechanism & Sequence
29
+
30
+ Create a `TUICallEngine` instance -> call `setLogLevel` to set the log level -> the SDK outputs logs at the specified level going forward. A single call takes effect globally; no repeated calls are needed.
31
+
32
+ ## 4. Standard Usage
33
+
34
+ 1. Create an engine instance via `TUICallEngine.createInstance(options)`.
35
+ 2. Call `tuiCallEngine.setLogLevel(level)` to set the log level.
36
+ 3. Use level 0 during integration and debugging; adjust to level 1–4 as needed after going live.
37
+
38
+ ```javascript
39
+ import TUICallEngine from '@trtc/call-engine-lite-js'; // Web
40
+ // import TUICallEngine from '@trtc/call-engine-lite-wx'; // 小程序
41
+
42
+ const tuiCallEngine = TUICallEngine.createInstance({ SDKAppID: 0 });
43
+ tuiCallEngine.setLogLevel(0); // 接入调试:全量日志
44
+ ```
45
+
46
+ ## 5. Expected Results
47
+
48
+ - After calling `setLogLevel`, console log volume matches the target level.
49
+ - At level 4, the SDK produces no log output.
50
+ - Takes effect immediately without restarting or reinitializing.
51
+
52
+ ## 6. Common Pitfalls
53
+
54
+ - Pitfall 1: Assuming `setLogLevel` can only be called after `init` (it can actually be called as soon as the instance is created).
55
+ - Pitfall 2: Setting level 4 and still expecting to receive critical warnings (level 4 disables all logs).
56
+
57
+ ## 7. Problem Definition (retrieval hint)
58
+
59
+ TUICallEngine users want to control SDK log output volume: view full logs during integration, reduce logs after going live, or disable log output entirely.
60
+
61
+ ## 8. Alternative Queries (retrieval recall)
62
+
63
+ - How to disable TUICallEngine logs?
64
+ - How to set the TUICallEngine log level?
65
+ - What do the `setLogLevel` values mean?
66
+ - How to view full TUICallEngine logs during integration?
67
+ - Is the TUICallEngine log level the same on mini programs and Web?
@@ -0,0 +1,81 @@
1
+ ---
2
+ title: "How to Get the TUICallEngine Instance from Web TUICallKit(TUICallKit 如何获取 TUICallengine 实例)"
3
+ product: call
4
+ frameworks: [react, vue, miniprogram, web]
5
+ scope: platform_common
6
+ tags: [TUICallKit, getTUICallEngineInstance, engine instance, underlying engine, WeChat native mini program, uniapp mini program]
7
+ version_range: ">=4.0.0"
8
+ ---
9
+
10
+ # How to Get the TUICallEngine Instance from Web TUICallKit
11
+
12
+ ## 1. Key Takeaways
13
+
14
+ - Use `TUICallKitAPI.getTUICallEngineInstance()` to get the underlying TUICallEngine instance.
15
+ - Once you have the engine instance, you can listen to call events (e.g., `ON_CALL_BEGIN`, `ON_CALL_RECEIVED`) via `.on()`.
16
+
17
+ ## 2. Field / API Reference
18
+
19
+ | Field / API | Purpose | Notes |
20
+ |---|---|---|
21
+ | `TUICallKitAPI` | TUICallKit API entry | Imported from the corresponding platform package; provides `getTUICallEngineInstance()` |
22
+ | `getTUICallEngineInstance()` | Get the TUICallEngine instance | Returns the engine instance for event listening and underlying API calls |
23
+ | `TUICallEngine` | Engine instance | Obtained via this method; used to register event callbacks |
24
+
25
+ ## 3. Mechanism & Sequence
26
+
27
+ TUICallKit initialization completes -> call `TUICallKitAPI.getTUICallEngineInstance()` to get the engine instance -> use the engine instance to register event listeners or call underlying APIs.
28
+
29
+ Ensure TUICallKit initialization is complete before calling; otherwise it may return `undefined`.
30
+
31
+ ## 4. Standard Usage
32
+
33
+ 1. Import `TUICallKitAPI` from the corresponding platform package.
34
+ 2. Call `TUICallKitAPI.getTUICallEngineInstance()` to get the engine instance.
35
+ 3. Use the engine instance to register event listeners or call other underlying methods.
36
+
37
+ ```javascript
38
+ // React: @trtc/calls-uikit-react
39
+ // Vue 3: @trtc/calls-uikit-vue
40
+ // Vue 2.7: @trtc/calls-uikit-vue2
41
+ // Vue 2.6: @trtc/calls-uikit-vue2.6
42
+ // uniapp 小程序: @trtc/calls-uikit-wx-uniapp
43
+ // 微信原生小程序: @trtc/calls-uikit-wx (API 一致,仅包名不同)
44
+ import { TUICallKitAPI } from "@trtc/calls-uikit-react";
45
+
46
+ const tuiCallEngine = TUICallKitAPI.getTUICallEngineInstance();
47
+
48
+ if (tuiCallEngine) {
49
+ // 获取成功,可监听事件或调用底层 API
50
+ tuiCallEngine.on(TUICallEvent.ON_CALL_BEGIN, (event) => {
51
+ console.log('通话建立', event);
52
+ });
53
+ } else {
54
+ console.warn('TUICallEngine 实例未就绪,请确认 TUICallKit 已完成初始化');
55
+ }
56
+ ```
57
+
58
+ ## 5. Expected Results
59
+
60
+ - `getTUICallEngineInstance()` returns a non-`undefined` engine instance that can be used normally.
61
+ - Event callbacks registered via the engine instance trigger correctly.
62
+ - Multiple calls return the same engine instance (singleton).
63
+
64
+ ## 6. Common Pitfalls
65
+
66
+ - Pitfall 1: Calling `getTUICallEngineInstance()` before TUICallKit initialization completes (returns `undefined`).
67
+ - Pitfall 2: Assuming each call to `getTUICallEngineInstance()` creates a new engine instance (it is a singleton; multiple calls return the same instance).
68
+ - Pitfall 3: Directly creating an instance from the mini program engine package (use `TUICallKitAPI.getTUICallEngineInstance()` instead of creating one manually).
69
+
70
+ ## 7. Problem Definition (retrieval hint)
71
+
72
+ TUICallKit users need to obtain the underlying TUICallEngine instance to listen to call events or invoke underlying APIs.
73
+
74
+ ## 8. Alternative Queries (retrieval recall)
75
+
76
+ - How to get the TUICallEngine instance from TUICallKit?
77
+ - How to use `getTUICallEngineInstance`?
78
+ - How to get the TUICallEngine instance in TUICallKit Vue?
79
+ - How to listen to underlying TUICallEngine events in TUICallKit React?
80
+ - Can TUICallKit mini program get the TUICallEngine instance?
81
+ - What can you do after getting the engine instance from TUICallKit?