@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.
- package/CHANGELOG.md +23 -0
- package/README.md +22 -23
- 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/preflight-route.js +203 -185
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
This guide walks you through quickly integrating the TUICallKit component into a uni-app project and running on **Android** and **iOS** platforms. You can complete the following key steps in about 10 minutes and get a fully functional audio/video calling interface.
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
### Development Environment Requirements
|
|
6
|
+
- It is recommended to use **HBuilderX 4.31** or later for development.
|
|
7
|
+
- iOS: iOS 13.0 or later.
|
|
8
|
+
- Android: Android 5.0 (SDK API Level 21) or later.
|
|
9
|
+
- The mini program dev tool does not support native components (i.e., `<live-pusher>` and `<live-player>` tags). You need to run and test on a **real device**.
|
|
10
|
+
- For running on a real device, first install the [uni-app native runtime app](https://nativesupport.dcloud.net.cn/AppDocs/usesdk/appkey.html#%E7%AC%AC%E4%B8%80%E6%AD%A5-%E7%94%B3%E8%AF%B7appkey) base, or make a custom base.
|
|
11
|
+
|
|
12
|
+
### Activate the Service
|
|
13
|
+
Before using Tencent Cloud audio/video services, you need to go to the console to activate the service for your application. For detailed steps, see [Activate Service](https://cloud.tencent.com/document/product/1640/81130). After activation, note down the `SDKAppID` and `SDKSecretKey` — you will need them in the subsequent login step.
|
|
14
|
+
|
|
15
|
+
## TUICallKit Source Code Integration
|
|
16
|
+
|
|
17
|
+
### Step 1: Create a uni-app Project
|
|
18
|
+
|
|
19
|
+
Create a uni-app project in HBuilderX.
|
|
20
|
+
1. Open HBuilderX editor.
|
|
21
|
+
2. Create a project via **File** > **New** > **Project**. Set the project name, select the default template, and click Create.
|
|
22
|
+
|
|
23
|
+
### Step 2: Download and Import the TUICallKit Component
|
|
24
|
+
1. Download the `TUICallKit` component to your local project directory.
|
|
25
|
+
|
|
26
|
+
``` bash
|
|
27
|
+
npm i @tencentcloud/call-uikit-uniapp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Note:**
|
|
31
|
+
>
|
|
32
|
+
> Run the npm command in the root directory of your uni-app project.
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
2. Copy the `TUICallKit` folder (from `node_modules/@tencentcloud/call-uikit-uniapp/`) to your project root directory.
|
|
36
|
+
|
|
37
|
+
### Step 3: Import Required Native Plugins
|
|
38
|
+
|
|
39
|
+
To use TUICallKit on Android and iOS platforms, you need to import the required native plugins.
|
|
40
|
+
|
|
41
|
+
1. In [DCloud Plugin Market](https://ext.dcloud.net.cn/), search for and purchase the following native plugins:
|
|
42
|
+
- [Tencent Cloud Native Chat Plugin](https://ext.dcloud.net.cn/plugin?id=7571)
|
|
43
|
+
- [Tencent Cloud Native Audio/Video Call Plugin](https://ext.dcloud.net.cn/plugin?id=7096)
|
|
44
|
+
|
|
45
|
+
2. After purchase, go to the HBuilderX project, click **manifest.json** > **App Native Plugin Configuration** > **Cloud Plugin** > **Select Cloud Plugin**, and select the two plugins purchased above.
|
|
46
|
+
|
|
47
|
+
> **Note:**
|
|
48
|
+
>
|
|
49
|
+
> After purchasing native plugins, you must make a **custom debug base** to use the native plugin capabilities. The standard base does not include special native plugins.
|
|
50
|
+
>
|
|
51
|
+
|
|
52
|
+
### Step 4: Fill in SDKAPPID and SECRETKEY
|
|
53
|
+
|
|
54
|
+
Modify the `SDKAPPID` and `SECRETKEY` in the `TUICallKit/debug/GenerateTestUserSig-es.js` file.
|
|
55
|
+
|
|
56
|
+
### Step 5: Use the TUICallKit Component
|
|
57
|
+
|
|
58
|
+
1. Modify the `pages.json` file to set the page to full-screen mode.
|
|
59
|
+
|
|
60
|
+
``` json
|
|
61
|
+
{
|
|
62
|
+
"pages": [
|
|
63
|
+
{
|
|
64
|
+
"path": "pages/index/index",
|
|
65
|
+
"style": {
|
|
66
|
+
"navigationStyle": "custom",
|
|
67
|
+
"app-plus": {
|
|
68
|
+
"titleNView": false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Open the `pages/index/index.vue` file and add the following code.
|
|
77
|
+
|
|
78
|
+
``` html
|
|
79
|
+
<template>
|
|
80
|
+
<view class="container">
|
|
81
|
+
<TUICallKit ref="TUICallKit" />
|
|
82
|
+
<view class="input-box">
|
|
83
|
+
<input
|
|
84
|
+
type="text"
|
|
85
|
+
maxlength="20"
|
|
86
|
+
:placeholder="isLogin ? 'Enter callee userID' : 'Enter login userID'"
|
|
87
|
+
:value="userID"
|
|
88
|
+
@input="bindInputUserID"
|
|
89
|
+
/>
|
|
90
|
+
</view>
|
|
91
|
+
<view class="btn-box">
|
|
92
|
+
<button @tap="isLogin ? call() : login()">
|
|
93
|
+
{{ isLogin ? 'Call' : 'Login' }}
|
|
94
|
+
</button>
|
|
95
|
+
</view>
|
|
96
|
+
</view>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
import TUICallKit from '../../TUICallKit/TUICallKit.vue';
|
|
101
|
+
import * as GenerateTestUserSig from '../../TUICallKit/debug/GenerateTestUserSig-es.js';
|
|
102
|
+
|
|
103
|
+
export default {
|
|
104
|
+
components: { TUICallKit },
|
|
105
|
+
data() {
|
|
106
|
+
return {
|
|
107
|
+
userID: '',
|
|
108
|
+
isLogin: false,
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
bindInputUserID(e) {
|
|
113
|
+
this.userID = e.detail.value;
|
|
114
|
+
},
|
|
115
|
+
async login() {
|
|
116
|
+
const userID = this.userID;
|
|
117
|
+
if (!userID) return;
|
|
118
|
+
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
|
119
|
+
userID,
|
|
120
|
+
});
|
|
121
|
+
try {
|
|
122
|
+
await this.$refs.TUICallKit.init({
|
|
123
|
+
sdkAppID: SDKAppID,
|
|
124
|
+
userID,
|
|
125
|
+
userSig,
|
|
126
|
+
});
|
|
127
|
+
uni.showToast({ title: 'Login successful' });
|
|
128
|
+
this.isLogin = true;
|
|
129
|
+
this.userID = '';
|
|
130
|
+
} catch (error) {
|
|
131
|
+
uni.showToast({ title: 'Login failed', icon: 'error' });
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
async call() {
|
|
135
|
+
try {
|
|
136
|
+
await this.$refs.TUICallKit.calls({
|
|
137
|
+
userIDList: [this.userID],
|
|
138
|
+
type: 2,
|
|
139
|
+
});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
uni.showToast({ title: 'Call failed', icon: 'error' });
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<style>
|
|
149
|
+
.container {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
height: 100vh;
|
|
155
|
+
}
|
|
156
|
+
.input-box {
|
|
157
|
+
width: 80%;
|
|
158
|
+
margin-bottom: 20px;
|
|
159
|
+
}
|
|
160
|
+
.btn-box {
|
|
161
|
+
width: 80%;
|
|
162
|
+
}
|
|
163
|
+
button {
|
|
164
|
+
background-color: #006eff;
|
|
165
|
+
color: white;
|
|
166
|
+
border-radius: 25px;
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
169
|
+
```
|
|
170
|
+
3. You must use **Vue 2** for compilation. Currently, **Vue 3** is not supported.
|
|
171
|
+
|
|
172
|
+
### Step 6: Build and Run
|
|
173
|
+
1. Make a custom base (for real-device testing):
|
|
174
|
+
- In HBuilderX, click **Run** > **Run to Phone or Simulator** > **Make Custom Debug Base**.
|
|
175
|
+
- Wait for the build to complete and the custom base to be installed on the device.
|
|
176
|
+
|
|
177
|
+
2. Run on a real device:
|
|
178
|
+
- Click **Run** > **Run to Phone or Simulator** and select your connected device.
|
|
179
|
+
- Select **Use Custom Base** for debugging.
|
|
180
|
+
|
|
181
|
+
3. Expected result after quick integration.
|
|
182
|
+
|
|
183
|
+
### Step 7: Make Your First Call
|
|
184
|
+
- Prepare two devices. Device A logs in with user "userA" and Device B logs in with user "userB".
|
|
185
|
+
- Device A enters "userB" as the callee and clicks the Call button. Device B will see an incoming call UI.
|
|
186
|
+
- Device B clicks the accept button to start the audio/video call.
|
|
187
|
+
|
|
188
|
+
> **Note:**
|
|
189
|
+
>
|
|
190
|
+
> The first time you run the app, you need to grant camera and microphone permissions.
|
|
191
|
+
>
|
|
192
|
+
|
|
193
|
+
## More Features
|
|
194
|
+
|
|
195
|
+
### Set Nickname and Avatar
|
|
196
|
+
|
|
197
|
+
Call the `setSelfInfo` API to set the current user's nickname and avatar:
|
|
198
|
+
|
|
199
|
+
``` javascript
|
|
200
|
+
this.$refs.TUICallKit.setSelfInfo({
|
|
201
|
+
nickName: 'Tom',
|
|
202
|
+
avatar: 'https://...'
|
|
203
|
+
})
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Set Custom Ringtone
|
|
207
|
+
|
|
208
|
+
Call the `setCallingBell` API to set a custom incoming call ringtone:
|
|
209
|
+
|
|
210
|
+
``` javascript
|
|
211
|
+
this.$refs.TUICallKit.setCallingBell('/static/bell.mp3')
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
> **Note:**
|
|
215
|
+
> Only local file paths are accepted. The ringtone setting is device-bound and persists across user switches. Pass an empty string to restore the default ringtone.
|
|
216
|
+
|
|
217
|
+
### Enable Mute Mode
|
|
218
|
+
|
|
219
|
+
Call the `enableMuteMode` API to enable mute mode (no ringtone on incoming calls):
|
|
220
|
+
|
|
221
|
+
``` javascript
|
|
222
|
+
this.$refs.TUICallKit.enableMuteMode(true)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Enable Floating Window
|
|
226
|
+
|
|
227
|
+
Call the `enableFloatWindow` API to enable the floating window feature:
|
|
228
|
+
|
|
229
|
+
``` javascript
|
|
230
|
+
this.$refs.TUICallKit.enableFloatWindow(true)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## FAQ
|
|
234
|
+
|
|
235
|
+
### Why does the call UI not appear after running?
|
|
236
|
+
1. Ensure you are running on a **real device** rather than a simulator. Native components like `<live-pusher>` and `<live-player>` are not supported in simulators.
|
|
237
|
+
2. Ensure you have made a **custom debug base** that includes the required native plugins.
|
|
238
|
+
3. Check that camera and microphone permissions have been granted.
|
|
239
|
+
|
|
240
|
+
### What should I do if the native plugin is not found?
|
|
241
|
+
1. Verify that you have purchased the plugins from the DCloud Plugin Market.
|
|
242
|
+
2. Ensure the plugins are selected in **manifest.json** > **App Native Plugin Configuration**.
|
|
243
|
+
3. Rebuild the custom debug base after adding plugins.
|