@tencent-rtc/mcp 1.7.3 → 1.7.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 (30) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +22 -23
  3. package/knowledge/path-meta.js +23 -1
  4. package/package.json +1 -1
  5. package/resource/index/manifest.json +1 -1
  6. package/resource/knowledge/callkit/best-practice/android/video-chat-dating.md +497 -0
  7. package/resource/knowledge/callkit/best-practice/flutter/android-keep-call-alive-background.md +79 -0
  8. package/resource/knowledge/callkit/best-practice/flutter/background-incoming-call-no-notification.md +99 -0
  9. package/resource/knowledge/callkit/best-practice/flutter/ios-keep-call-alive-background.md +93 -0
  10. package/resource/knowledge/callkit/best-practice/flutter/ios-startup-crash-version-voip.md +68 -0
  11. package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +386 -0
  12. package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +315 -0
  13. package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +204 -0
  14. package/resource/knowledge/callkit/preset/harmonyos/api.md +362 -0
  15. package/resource/knowledge/callkit/preset/harmonyos/integration.md +318 -0
  16. package/resource/knowledge/callkit/preset/miniprogram/api-uniapp.md +430 -0
  17. package/resource/knowledge/callkit/preset/miniprogram/api.md +293 -0
  18. package/resource/knowledge/callkit/preset/miniprogram/integration.md +294 -0
  19. package/resource/knowledge/callkit/preset/miniprogram/uniapp-integration.md +224 -0
  20. package/resource/knowledge/callkit/preset/uni-app/api.md +339 -0
  21. package/resource/knowledge/callkit/preset/uni-app/integration.md +243 -0
  22. package/resource/knowledge/chat/preset/react/h5/integration.md +964 -0
  23. package/resource/knowledge/chat/preset/vue/h5/integration.md +717 -0
  24. package/resource/knowledge/rtcengine/web/plugin/23-advanced-support-detection.md +6 -6
  25. package/resource/knowledge/rtcengine/web/plugin/31-advanced-plugins-overview.md +8 -6
  26. package/resource/knowledge/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +30 -10
  27. package/server.js +1 -1
  28. package/utils/preflight-route.js +203 -185
  29. package/utils/report-cls-client.js +1 -1
  30. package/utils/report-es-client.js +1 -1
@@ -0,0 +1,293 @@
1
+ TUICallKit is the **UI-included interface** for the audio/video calling component. Using the TUICallKit API, you can quickly implement a WeChat-like audio/video calling scenario with simple API calls. For detailed integration steps, see [Quick Integration of TUICallKit](https://cloud.tencent.com/document/product/647/78733).
2
+
3
+ > **Note:**
4
+ > - To provide better audio/video communication capabilities, the original @trtc/call-uikit-wechat package has been officially deprecated. Developers are advised to migrate to the new @trtc/calls-uikit-wx-uniapp and @trtc/calls-uikit-wx packages.
5
+ > - The new packages include optimized API adjustments. Some legacy interfaces are no longer compatible, and cleaner, more stable new interfaces are provided.
6
+
7
+ ## API Overview
8
+
9
+ | API | Description |
10
+ |---------|---------|
11
+ | [\<TUICallKit /\>](#TUICallKit) | TUICallKit call UI component. |
12
+ | [init](#init) | Initialize TUICallKit |
13
+ | [calls](#calls) | Initiate a single or multi-party call. |
14
+ | [join](#join) | Actively join a call. |
15
+ | [setSelfInfo](#setSelfInfo) | Set user avatar and nickname. |
16
+ | [setCallingBell](#setCallingBell) | Set custom incoming call ringtone. |
17
+ | [setLogLevel](#setLogLevel) | Set log level. |
18
+ | [enableMuteMode](#enableMuteMode) | Enable/disable incoming call ringtone. |
19
+ | [enableFloatWindow](#enableFloatWindow) | Enable/disable floating window. |
20
+ | [hideFeatureButton](#hideFeatureButton) | Hide a feature button. |
21
+ | [setLocalViewBackgroundImage](#setLocalViewBackgroundImage) | Set local user call background image. |
22
+ | [setRemoteViewBackgroundImage](#setRemoteViewBackgroundImage) | Set remote user call background image. |
23
+ | [setLayoutMode](#setLayoutMode) | Set call interface layout mode. |
24
+ | [setCameraDefaultState](#setCameraDefaultState) | Set whether camera is on by default. |
25
+ | [destroyed](#destroyed) | Destroy TUICallKit. |
26
+ | [getTUICallEngineInstance](#getTUICallEngineInstance) | Get TUICallEngine instance. |
27
+
28
+ ## API Details
29
+
30
+ [uni-app Mini Program]
31
+ ``` javascript
32
+ import { TUICallKitAPI } from "@trtc/calls-uikit-wx-uniapp";
33
+ ```
34
+
35
+ [WeChat Mini Program]
36
+ ``` javascript
37
+ import { TUICallKitAPI } from "@trtc/calls-uikit-wx";
38
+ ```
39
+
40
+ ### init
41
+
42
+ Initialize TUICallKit.
43
+ ``` javascript
44
+ TUICallKitAPI.init({
45
+ sdkAppID: 0, // Replace with your SDKAppID
46
+ userID: 'jane', // Enter the current userID
47
+ userSig: 'xxxxxxxxxxxx',
48
+ tim: null, // If you don't need a TIM instance, you can omit this
49
+ })
50
+ ```
51
+
52
+ **Parameters:**
53
+
54
+ | Parameter | Type | Description | Required |
55
+ |---------|---------|---------|---------|
56
+ | sdkAppID | Number | You can find the SDKAppID in **TRTC Console** > [Application Management](https://console.cloud.tencent.com/trtc/app) > **Application Info**. | Yes |
57
+ | userID | String | Current user ID. String type, only allows letters (a-z, A-Z), digits (0-9), hyphens (-), and underscores (_). | Yes |
58
+ | userSig | String | Tencent Cloud security signature. See [How to Calculate and Use UserSig](https://cloud.tencent.com/document/product/647/17275) for details. | Yes |
59
+ | tim | ChatSDK | TIM instance. | No |
60
+
61
+ Additional details on init parameters:
62
+ - **userSig**: Encrypt information like sdkAppID and userID using the SecretKey obtained in Step 3 to generate userSig. It is an authentication ticket for Tencent Cloud to verify whether the current user is authorized to use TRTC services. See [How to Calculate and Use UserSig](https://cloud.tencent.com/document/product/647/17275) for more.
63
+
64
+ - **tim**: You can pass an external TIM instance to CallKit via init. The tim parameter is for scenarios where a TIM instance already exists in your business, ensuring TIM instance uniqueness.
65
+
66
+ ### calls
67
+
68
+ Initiate a 1v1 or multi-party call.
69
+ ``` javascript
70
+ TUICallKitAPI.calls({
71
+ userIDList: ["jane", "mike", "tommy"],
72
+ type: 1,
73
+ })
74
+ ```
75
+
76
+ **Parameters:**
77
+ | Parameter | Type | Description | Required |
78
+ | --- | --- | --- | --- |
79
+ | userIDList | Array\<String\> | Target user ID list, e.g., ["jane", "mike", "tommy"]. | Yes |
80
+ | type | CallMediaType | Call media type. See CallMediaType for parameter values. | Yes |
81
+ | chatGroupID | String | IM group ID when used with Chat. | Yes |
82
+ | roomID | Number | Numeric room ID, range [1, 2147483647]. | No |
83
+ | userData | String | Extension field: used to add extra information in the invitation signaling. | No |
84
+ | timeout | Number | Call timeout in seconds. 0 means no timeout. Range: 10s – 600s. If 0 is passed, defaults to 30s.<br>The callee must be logged in within 30s for the timeout value to take effect. See "timeout field not taking effect" for details. | No |
85
+ | [offlinePushInfo](#offlinePushInfo) | Object | Custom offline push information (optional). | No |
86
+
87
+ ### join
88
+
89
+ Actively join a call.
90
+ ``` javascript
91
+ TUICallKitAPI.join({callId: xx});
92
+ ```
93
+
94
+ **Parameters:**
95
+
96
+ | Parameter | Type | Description | Required |
97
+ |---------|---------|---------|---------|
98
+ | callId | String | Unique ID of this call. | Yes |
99
+
100
+ ### setSelfInfo
101
+
102
+ Set user avatar and nickname.
103
+
104
+ > **Note:**
105
+ > **Modifying user info during a call will not immediately update the UI. Changes will take effect in the next call.**
106
+ >
107
+
108
+ ``` javascript
109
+ TUICallKitAPI.setSelfInfo({ nickName: "xxx", avatar: "http://xxx" });
110
+ ```
111
+
112
+ **Parameters:**
113
+
114
+ | Parameter | Type | Description |
115
+ |---------|---------|---------|
116
+ | nickName | String | Set nickname. |
117
+ | avatar | String | Avatar URL. |
118
+
119
+ ### setCallingBell
120
+
121
+ Set custom incoming call ringtone.
122
+
123
+ Only local file paths are accepted. Ensure the file directory is accessible by the application.
124
+ - Pass a local absolute path for the ringtone file.
125
+
126
+ - To restore the default ringtone, pass an empty `filePath`.
127
+
128
+ - Supported ringtone file formats:
129
+
130
+ | Format | iOS | Android |
131
+ |---------|---------|---------|
132
+ | m4a | √ | √ |
133
+ | mp3 | √ | √ |
134
+ | wav | √ | √ |
135
+ | aac | √ | √ |
136
+
137
+ ``` javascript
138
+ TUICallKitAPI.setCallingBell("filePath")
139
+ ```
140
+
141
+ **Parameters:**
142
+
143
+ | Parameter | Type | Description |
144
+ |---------|---------|---------|
145
+ | filePath | String | Ringtone file path. |
146
+
147
+ ### setLogLevel
148
+
149
+ Set the log level. Logs below the specified level will not be output.
150
+ ``` javascript
151
+ TUICallKitAPI.setLogLevel(level)
152
+ ```
153
+
154
+ **Parameters:**
155
+ | Parameter | Value | Description |
156
+ | --- | --- | --- |
157
+ | level | 0 | Normal level, verbose logs. Recommended during integration. |
158
+ | | 1 | Release level, SDK outputs key information only. Recommended for production. |
159
+ | | 2 | Warning level, SDK outputs only warnings and errors. |
160
+ | | 3 | Error level, SDK outputs only errors. |
161
+ | | 4 | No logs, SDK will not print any logs. |
162
+
163
+ ### enableMuteMode
164
+
165
+ Enable/disable incoming call ringtone.
166
+ - Default is `false`: a ringtone plays when receiving a call request.
167
+
168
+ - If set to `true`: no ringtone plays when receiving a call request.
169
+
170
+ ``` javascript
171
+ try {
172
+ await TUICallKitAPI.enableMuteMode(enable: boolean)
173
+ } catch (error: any) {
174
+ console.error(`[TUICallKit] Failed to call the enableMuteMode API. Reason: ${error}`);
175
+ }
176
+ ```
177
+
178
+ ### enableFloatWindow
179
+
180
+ Enable/disable the floating window feature. Default is `false` (the floating window button in the top-left corner of the call interface is hidden). When set to `true`, the button is displayed.
181
+ ``` javascript
182
+ try {
183
+ await TUICallKitAPI.enableFloatWindow(enable: boolean)
184
+ } catch (error: any) {
185
+ console.error(`[TUICallKit] Failed to call the enableFloatWindow API. Reason: ${error}`);
186
+ }
187
+ ```
188
+
189
+ ### hideFeatureButton
190
+
191
+ Hide a feature button. Currently supports hiding the camera, microphone, and front/rear camera switch buttons.
192
+ ``` typescript
193
+ TUICallKitAPI.hideFeatureButton(buttonName: FeatureButton);
194
+ ```
195
+
196
+ **Parameters:**
197
+
198
+ | Parameter | Type | Required | Description |
199
+ |---------|---------|---------|---------|
200
+ | buttonName | [FeatureButton](#FeatureButton) | Yes | Button name. |
201
+
202
+ ### setLocalViewBackgroundImage
203
+
204
+ Set the local user's call background image.
205
+ ``` typescript
206
+ TUICallKitAPI.setLocalViewBackgroundImage(url: string);
207
+ ```
208
+
209
+ **Parameters:**
210
+ | Parameter | Type | Required | Description |
211
+ | --- | --- | --- | --- |
212
+ | url | String | Yes | Image URL (supports local paths and network URLs).<br>**Note:**<br>If using a network URL, it must be added to the request valid domains. |
213
+
214
+ ### setRemoteViewBackgroundImage
215
+
216
+ Set the remote user's call background image.
217
+ ``` typescript
218
+ TUICallKitAPI.setRemoteViewBackgroundImage(userId: string, url: string);
219
+ ```
220
+
221
+ **Parameters:**
222
+ | Parameter | Type | Required | Description |
223
+ | --- | --- | --- | --- |
224
+ | userId | String | Yes | Remote user's userId. Set to '*' to apply to all remote users. |
225
+ | url | String | Yes | Image URL (supports local paths and network URLs).<br>**Note:**<br>If using a network URL, it must be added to the request valid domains. |
226
+
227
+ ### setLayoutMode
228
+
229
+ Set the call interface layout mode.
230
+ ``` javascript
231
+ import { TUICallKitAPI, LayoutMode } from "../../TUICallKit/src/index";
232
+ TUICallKitAPI.setLayoutMode(LayoutMode.LocalInLargeView);
233
+ ```
234
+
235
+ **Parameters:**
236
+
237
+ | Parameter | Type | Required | Description |
238
+ |---------|---------|---------|---------|
239
+ | layoutMode | [LayoutMode](#LayoutMode) | Yes | User stream layout mode. |
240
+
241
+ ### setCameraDefaultState
242
+
243
+ Set whether the camera is on by default.
244
+ ``` javascript
245
+ TUICallKitAPI.setCameraDefaultState(true);
246
+ ```
247
+
248
+ **Parameters:**
249
+
250
+ | Parameter | Type | Required | Description |
251
+ |---------|---------|---------|---------|
252
+ | isOpen | boolean | Yes | Whether to enable the camera. |
253
+
254
+ ### destroyed
255
+
256
+ Destroy TUICallKit.
257
+ ``` javascript
258
+ TUICallKitAPI.destroyed()
259
+ ```
260
+
261
+ ### getTUICallEngineInstance
262
+
263
+ Get the TUICallEngine instance.
264
+ ``` javascript
265
+ TUICallKitAPI.getTUICallEngineInstance();
266
+ ```
267
+
268
+ ## TUICallKit Type Definitions
269
+
270
+ ### offlinePushInfo
271
+
272
+ | Parameter | Type | Required | Description |
273
+ |---------|---------|---------|---------|
274
+ | offlinePushInfo.title | String | No | Offline push title (optional). |
275
+ | offlinePushInfo.description | String | No | Offline push content (optional). |
276
+ | offlinePushInfo.androidOPPOChannelID | String | No | OPPO channel ID for Android 8.0+ offline push (optional). |
277
+ | offlinePushInfo.extension | String | No | Offline push pass-through content (optional) (tsignaling version ≥ 0.9.0). |
278
+
279
+ ### FeatureButton
280
+
281
+ | FeatureButton Type | Description |
282
+ |---------|---------|
283
+ | FeatureButton.Camera | Camera button. |
284
+ | FeatureButton.Microphone | Microphone button. |
285
+ | FeatureButton.SwitchCamera | Switch front/rear camera button. |
286
+ | FeatureButton.InviteUser | Invite user button. |
287
+
288
+ ### LayoutMode
289
+
290
+ | LayoutMode Type | Description |
291
+ |---------|---------|
292
+ | LayoutMode.LocalInLargeView | Local user displayed in the large view. |
293
+ | LayoutMode.RemoteInLargeView | Remote user displayed in the large view. |
@@ -0,0 +1,294 @@
1
+
2
+ ## Mini Program Demo Experience
3
+ - To try the audio/video calling mini program directly, [click Demo Experience](https://cloud.tencent.com/document/product/647/17021) and scan the mini program QR code.
4
+
5
+ - To run a new project from scratch, go directly to [WeChat Mini Program Demo Quick Start](https://github.com/tencentyun/TUICallKit/tree/main/MiniProgram).
6
+
7
+ ## Development Environment Requirements
8
+ - WeChat App iOS minimum version: 7.0.9.
9
+
10
+ - WeChat App Android minimum version: 7.0.8.
11
+
12
+ - Mini Program base library minimum version: 2.10.0.
13
+
14
+ > **Warning:**
15
+ >
16
+ > - Since mini program test accounts do not have access to `<live-pusher>` and `<live-player>`, please use an **enterprise mini program account** to apply for the required permissions for development.
17
+ > - Since WeChat DevTools does not support native components (`<live-pusher>` and `<live-player>` tags), you need to run and test on a **real device**.
18
+ > - **WeChat Work mini programs are not supported**.
19
+
20
+ ## Mini Program Development Setup
21
+
22
+ ### Step 1: Register an Enterprise Mini Program
23
+
24
+ ### Step 2: Enable Real-Time Audio/Video APIs in the Mini Program Console
25
+
26
+ - The live push/pull stream tag usage permission is currently only available for limited categories. [See supported categories here](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html#%E7%94%B3%E8%AF%B7%E5%BC%80%E9%80%9A).
27
+
28
+ - Mini programs that meet the category requirements need to self-enable this component permission in [WeChat Official Accounts Platform](https://mp.weixin.qq.com/) > **Development** > **Development Management** > **API Settings**.
29
+
30
+ - Log in to the mini program console to update the privacy policy, checking **Microphone** and **Camera**.
31
+
32
+ ### Step 3: Configure Domains in the Mini Program Console
33
+
34
+ In [WeChat Official Accounts Platform](https://mp.weixin.qq.com/) > **Development** > **Development Management** > **Development Settings** > **Server Domains**, configure **request valid domains** and **socket valid domains**.
35
+
36
+ - Add the following domains to **socket valid domains**:
37
+
38
+ | Domain | Description | Required |
39
+ | --- | --- | --- |
40
+ | `wss://${SDKAppID}w4c.my-imcloud.com` | Since v3.4.6, the SDK supports dedicated domains for better service stability.<br>For example, if your SDKAppID is 1400xxxxxx, the dedicated domain is: `wss://1400xxxxxxw4c.my-imcloud.com` | Required |
41
+ | `wss://wss.im.qcloud.com` | Web IM service domain | Required |
42
+ | `wss://wss.tim.qq.com` | Web IM service domain | Required |
43
+ | `wss://wssv6.im.qcloud.com` | Web IM service domain | Required |
44
+
45
+ - Add the following domains to **request valid domains**:
46
+
47
+ | Domain | Description | Required |
48
+ |---------|---------|---------|
49
+ |`https://web.sdk.qcloud.com`|Web IM service domain|Required|
50
+ |`https://boce-cdn.my-imcloud.com`|Web IM service domain|Required|
51
+ |`https://api.im.qcloud.com`|Web IM service domain|Required|
52
+ |`https://events.im.qcloud.com`|Web IM service domain|Required|
53
+ |`https://webim.tim.qq.com`|Web IM service domain|Required|
54
+ |`https://wss.im.qcloud.com`|Web IM service domain|Required|
55
+ |`https://wss.tim.qq.com`|Web IM service domain|Required|
56
+
57
+ - Add the following domains to **uploadFile valid domains**:
58
+
59
+ | Domain | Description | Required |
60
+ | --- | --- | --- |
61
+ | `https://${SDKAppID}-cn.rich.my-imcloud.com` | **Since September 10, 2024, new applications are assigned dedicated COS domains by default.**<br>For example, if your SDKAppID is 1400xxxxxx, the COS dedicated domain is: `https://1400xxxxxx-cn.rich.my-imcloud.com` | Required |
62
+ | `https://cn.rich.my-imcloud.com` | File upload domain | Required |
63
+ | `https://cn.imrich.qcloud.com` | File upload domain | Required |
64
+ | `https://cos.ap-shanghai.myqcloud.com` | File upload domain | Required |
65
+ | `https://cos.ap-shanghai.tencentcos.cn` | File upload domain | Required |
66
+ | `https://cos.ap-guangzhou.myqcloud.com` | File upload domain | Required |
67
+
68
+ - Add the following domains to **downloadFile valid domains**:
69
+
70
+ | Domain | Description | Required |
71
+ | --- | --- | --- |
72
+ | `https://${SDKAppID}-cn.rich.my-imcloud.com` | **Since September 10, 2024, new applications are assigned dedicated COS domains by default.**<br>For example, if your SDKAppID is 1400xxxxxx, the COS dedicated domain is: `https://1400xxxxxx-cn.rich.my-imcloud.com` | Required |
73
+ | `https://cn.rich.my-imcloud.com` | File download domain | Required |
74
+ | `https://cn.imrich.qcloud.com` | File download domain | Required |
75
+ | `https://cos.ap-shanghai.myqcloud.com` | File download domain | Required |
76
+ | `https://cos.ap-shanghai.tencentcos.cn` | File download domain | Required |
77
+ | `https://cos.ap-guangzhou.myqcloud.com` | File download domain | Required |
78
+
79
+ ## TUICallKit Source Code Integration
80
+
81
+ ### Step 1: Activate the Service
82
+
83
+ Before using Tencent Cloud audio/video services, you need to go to the console to activate the service for your application.
84
+
85
+ ### Step 2: Create a Mini Program Project
86
+ 1. In WeChat DevTools, create a mini program project and select **Do not use template**.
87
+
88
+ ``` json
89
+ {
90
+ "pages": [
91
+ "pages/index/index"
92
+ ],
93
+ "window": {
94
+ "navigationBarTextStyle": "black",
95
+ "navigationStyle": "custom"
96
+ },
97
+ "style": "v2",
98
+ "renderer": "webview"
99
+ }
100
+ ```
101
+
102
+ 3. Open a new terminal.
103
+
104
+ 4. Run `npm init -y` to generate the `package.json` file.
105
+
106
+ ``` javascript
107
+ npm init -y
108
+ ```
109
+
110
+ ### Step 3: Download and Import the TUICallKit Component
111
+ 1. Download the `TUICallKit` component.
112
+
113
+ ``` bash
114
+ npm i @trtc/calls-uikit-wx
115
+ ```
116
+
117
+ [macOS]
118
+ ``` bash
119
+ mkdir -p ./TUICallKit && cp -r node_modules/@trtc/calls-uikit-wx/ ./TUICallKit
120
+ ```
121
+
122
+ [Windows]
123
+ ``` bash
124
+ xcopy node_modules\@trtc\calls-uikit-wx\ .\TUICallKit /i /e
125
+ ```
126
+
127
+ 2. After running the above commands, a `TUICallKit` folder is generated in your directory containing the TUICallKit component.
128
+
129
+ 3. **Build npm.** Open **WeChat DevTools** and click **Tools > Build npm** to create the miniprogram_npm directory.
130
+
131
+ ### Step 4: Fill in SDKAPPID and SECRETKEY
132
+
133
+ Modify the `SDKAPPID` and `SECRETKEY` in the `TUICallKit/debug/GenerateTestUserSig-es.js` file.
134
+
135
+ ### Step 5: Use the TUICallKit Component
136
+ 1. Modify the `app.json` file. Add the following code to register the global call monitoring page.
137
+
138
+ ``` json
139
+ {
140
+ "pages": [
141
+ "pages/index/index",
142
+ "TUICallKit/pages/globalCall/globalCall"
143
+ ],
144
+ "window": {
145
+ "navigationBarTextStyle": "black",
146
+ "navigationStyle": "custom"
147
+ },
148
+ "style": "v2"
149
+ }
150
+ ```
151
+ 2. Modify the files in the `pages/index` folder.
152
+
153
+ [index.wxml]
154
+ ``` javascript
155
+ <view class="container">
156
+ <view class="box">
157
+ <view class="input-box">
158
+ <input type="text" maxlength="20" placeholder="{{isLogin?'Enter callee userID':'Enter login userID' }}" value="{{userID}}" bindinput='bindInputUserID' placeholder-style="color:#BBBBBB;" />
159
+ </view>
160
+ <view class='login'>
161
+ <button class='loginBtn' bindtap="{{isLogin?'call':'login'}}">{{isLogin?'Call':'Login'}}</button>
162
+ </view>
163
+ </view>
164
+ </view>
165
+ ```
166
+
167
+ [index.js]
168
+ ``` javascript
169
+ // Import TUICallKitAPI module to enable global call capability
170
+ import { TUICallKitAPI } from "../../TUICallKit/TUICallService/index";
171
+ // Import CallManager module to enable global incoming call monitoring
172
+ import { CallManager } from "../../TUICallKit/TUICallService/serve/callManager";
173
+ import * as GenerateTestUserSig from "../../TUICallKit/debug/GenerateTestUserSig-es.js";
174
+ wx.CallManager = new CallManager();
175
+ Page({
176
+ data: {
177
+ userID: "",
178
+ isLogin: false,
179
+ },
180
+
181
+ bindInputUserID(e) {
182
+ this.setData({
183
+ userID: e.detail.value,
184
+ });
185
+ },
186
+
187
+ async login() {
188
+ const userID = this.data.userID;
189
+ if (!userID) return;
190
+ const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
191
+ userID: userID,
192
+ });
193
+ await wx.CallManager.init({
194
+ sdkAppID: SDKAppID,
195
+ userID: userID,
196
+ userSig: userSig,
197
+ globalCallPagePath: "TUICallKit/pages/globalCall/globalCall",
198
+ });
199
+ wx.showToast({
200
+ title: "Login successful",
201
+ icon: "error",
202
+ });
203
+ this.setData({
204
+ isLogin: true,
205
+ userID: "",
206
+ });
207
+ },
208
+
209
+ async call() {
210
+ await TUICallKitAPI.calls({
211
+ userIDList: [this.data.userID],
212
+ type: 2,
213
+ });
214
+ },
215
+ });
216
+ ```
217
+
218
+ [index.wxss]
219
+ ``` css
220
+ .container {
221
+ width: 100vw;
222
+ height: 100vh;
223
+ }
224
+
225
+ .box{
226
+ flex: 1;
227
+ width: 100vw;
228
+ margin-top: -40px;
229
+ background: #ffffff;
230
+ display: flex;
231
+ flex-direction: column;
232
+ align-items: center;
233
+ justify-content: center;
234
+ }
235
+
236
+ input{
237
+ display: flex;
238
+ font-size: 20px;
239
+ width: 60vw;
240
+ }
241
+
242
+ .login {
243
+ display: flex;
244
+ width: 100vw;
245
+ text-align: center;
246
+ bottom: 5vh;
247
+ margin: 70rpx;
248
+ }
249
+ .login button{
250
+ width: 80%;
251
+ background-color: #006eff;
252
+ border-radius: 50px;
253
+ color: white;
254
+ }
255
+ ```
256
+
257
+ ### Step 6: Build and Run
258
+ 1. In local settings, check "Do not verify valid domains, web-view (business domains), TLS version, and HTTPS certificates".
259
+
260
+ > **Warning:**
261
+ >
262
+ > **If this option is not checked, the following error will appear in the console.**
263
+ >
264
+ >
265
+ >
266
+
267
+ 2. Click **Clear Cache > Clear All** to avoid rendering issues caused by DevTools cache.
268
+
269
+ 3. Build the mini program.
270
+
271
+ 4. Expected result after quick integration.
272
+
273
+ ### Step 7: Make Your First Call
274
+ - Click Preview, scan the QR code, and use the mini program on a real device.
275
+
276
+ > **Note:**
277
+ >
278
+ > The first time you use the mini program for calls, you need to grant camera and microphone permissions.
279
+ >
280
+
281
+ ## More Features
282
+
283
+ ### Enable Floating Window
284
+
285
+ > **Note:**
286
+ > Supported since v4.2.10+. Due to [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html#%E5%B0%8F%E7%AA%97%E7%89%B9%E6%80%A7%E8%AF%B4%E6%98%8E) limitations, this feature is only supported in video call scenarios.
287
+ >
288
+
289
+ You can call `enableFloatWindow` to enable/disable the floating window feature. Enable this feature when initializing the `TUICallKit` component. Default state is disabled (`false`). You can click the floating window button in the top-left corner of the call interface to minimize the call UI into a floating window.
290
+
291
+ Call `enableFloatWindow(enable: boolean)` API to enable/disable floating window.
292
+ ``` javascript
293
+ TUICallKitAPI.enableFloatWindow(true)
294
+ ```