@tencent-rtc/mcp 1.3.5 → 1.3.7
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/index.js +4 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/resource/doc/livekit/live/flutter/live-audience-list.md +339 -0
- package/resource/doc/livekit/live/flutter/live-audio-effect.md +742 -0
- package/resource/doc/livekit/live/flutter/live-barrage.md +581 -0
- package/resource/doc/livekit/live/flutter/live-base-beauty.md +486 -0
- package/resource/doc/livekit/live/flutter/live-co-guest-interaction.md +608 -0
- package/resource/doc/livekit/live/flutter/live-gift.md +800 -0
- package/resource/doc/livekit/live/flutter/live-host-interaction.md +1113 -0
- package/resource/doc/livekit/live/flutter/live-integration.md +1041 -0
- package/resource/doc/livekit/live/flutter/live-live-list.md +865 -0
- package/resource/doc/livekit/live/flutter/workflow.md +353 -0
- package/resource/doc/tuicallkit/flutter/workflow.md +331 -0
- package/tools/call/get-native-call-integration.js +27 -11
- package/tools/call/get-native-call-integration.js.map +1 -1
- package/tools/definitions/get_native_call_uikit_integration_def.js +17 -7
- package/tools/definitions/get_native_call_uikit_integration_def.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/tuicallkit/flutter/how_to_run_flutter_callkit_demo.md +0 -101
- package/resource/doc/tuicallkit/iOS/how_to_run_iOS_callkit_demo.md +0 -98
- /package/resource/doc/tuicallkit/android/{how_to_integrated_android_callkit.md → integration.md} +0 -0
- /package/resource/doc/tuicallkit/android/{.gitkeep → workflow.md} +0 -0
- /package/resource/doc/tuicallkit/{android/api_TUICallObserver.md → faq/android_sdk/call-observer-api.md} +0 -0
- /package/resource/doc/tuicallkit/{android/api_TUICallKit.md → faq/android_sdk/callkit-api.md} +0 -0
- /package/resource/doc/tuicallkit/{flutter/api_TUICallDefine.md → faq/flutter_sdk/call-define-api.md} +0 -0
- /package/resource/doc/tuicallkit/{flutter/api_TUICallObserver.md → faq/flutter_sdk/call-observer-api.md} +0 -0
- /package/resource/doc/tuicallkit/{flutter/api_TUICallKit.md → faq/flutter_sdk/callkit-api.md} +0 -0
- /package/resource/doc/tuicallkit/{iOS/api_TUICallObserver.md → faq/ios_sdk/call-observer-api.md} +0 -0
- /package/resource/doc/tuicallkit/{iOS/api_TUICallKit.md → faq/ios_sdk/callkit-api.md} +0 -0
- /package/resource/doc/tuicallkit/flutter/{how_to_integrated_flutter_callkit.md → integration.md} +0 -0
- /package/resource/doc/tuicallkit/iOS/{how_to_integrated_iOS_callkit.md → integration.md} +0 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
|
|
2
|
+
# Native Live AtomicXCore Code Generation Workflow Instructions (Flutter)
|
|
3
|
+
|
|
4
|
+
## 🚨 Core Principles (Highest Priority)
|
|
5
|
+
|
|
6
|
+
**Agent MUST ensure the generated code compiles and runs successfully. Delivering non-buildable code to users is STRICTLY PROHIBITED!**
|
|
7
|
+
|
|
8
|
+
### ⚠️ Mandatory Build Verification
|
|
9
|
+
|
|
10
|
+
**After every code generation/modification, a full build verification MUST be executed**:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
flutter build apk --debug
|
|
14
|
+
# Or on iOS environment
|
|
15
|
+
flutter build ios --debug --no-codesign
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Prohibited Actions**:
|
|
20
|
+
|
|
21
|
+
* ❌ Do NOT assume code is correct by only running `flutter analyze` (cannot detect native dependency issues)
|
|
22
|
+
* ❌ Do NOT ignore `pubspec.yaml` version conflicts
|
|
23
|
+
|
|
24
|
+
**Build Error Classification and Handling**:
|
|
25
|
+
| Error Type | Example | Resolution |
|
|
26
|
+
|---------|------|---------|
|
|
27
|
+
| Dependency Resolution Failed | `Because xxx depends on yyy...` | Check `pubspec.yaml` version compatibility, run `flutter pub get` |
|
|
28
|
+
| Missing Dependency | `Target of URI doesn't exist` | Add missing library to `dependencies` |
|
|
29
|
+
| Missing Import | `Undefined class 'xxx'` | Add import statement |
|
|
30
|
+
| Missing Asset | `Unable to load asset` | Register asset in `pubspec.yaml` under `assets` node |
|
|
31
|
+
| Missing Permission | Crash on access Camera/Mic | Check `AndroidManifest.xml` and `Info.plist` |
|
|
32
|
+
|
|
33
|
+
**Verification Flow**:
|
|
34
|
+
|
|
35
|
+
1. Execute `flutter build apk --debug`.
|
|
36
|
+
2. If failed → Analyze complete error stack → Fix → Rebuild.
|
|
37
|
+
3. Loop until `BUILD SUCCESSFUL`.
|
|
38
|
+
|
|
39
|
+
**Handling Flow**:
|
|
40
|
+
|
|
41
|
+
1. **Build Successful** → Deliver code.
|
|
42
|
+
2. **Build Failed** → Analyze error → **Auto-fix** → Rebuild.
|
|
43
|
+
* ✅ **Auto-fixable**: Missing dependencies, Missing imports, Missing permission configurations.
|
|
44
|
+
* ❌ **Not fixable**: SDK internal errors, Flutter environment configuration issues (notify user).
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 📋 Instruction Purpose and Architecture
|
|
48
|
+
|
|
49
|
+
Provides Agent with a **code generation blueprint** for implementing Native (Flutter) Live AtomicXCore core features.
|
|
50
|
+
|
|
51
|
+
**Core Architecture**:
|
|
52
|
+
|
|
53
|
+
* **Container**: `LiveCoreWidget` (View layer)
|
|
54
|
+
* **State**: `Store` (Data-driven)
|
|
55
|
+
* **Events**: `Listener` (Callback handling)
|
|
56
|
+
|
|
57
|
+
**Feature Dependency Logic (Important)**:
|
|
58
|
+
|
|
59
|
+
1. **Foundation First**: Must first use this tool (`get_flutter_live_uikit_integration`) to complete basic live streaming (host streaming/viewing/list).
|
|
60
|
+
2. **Interaction Overlay**: If user requirements include "co-guest", "PK", "audience list", must call the interaction tool (`get_flutter_live_uikit_interaction`) **after basic features are completed**.
|
|
61
|
+
3. **Empty Project Handling**: If user requests interaction features in an empty project, Agent **MUST implement basic features first**, then add interaction capabilities.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ⚙️ Automated Workflow Steps
|
|
66
|
+
|
|
67
|
+
### Step 0: Prerequisites (Automated)
|
|
68
|
+
|
|
69
|
+
1. **Generate Credentials**: Call `get_usersig` tool to generate test credentials.
|
|
70
|
+
* Anchors: `anchor001`, `anchor002`, `anchor003`
|
|
71
|
+
* Audience: `user001`, `user002`, `user003`
|
|
72
|
+
|
|
73
|
+
2. **Environment Check**: Check `pubspec.yaml`, auto-add if missing the following dependencies:
|
|
74
|
+
```yaml
|
|
75
|
+
dependencies:
|
|
76
|
+
flutter:
|
|
77
|
+
sdk: flutter
|
|
78
|
+
atomic_x_core: ^3.6.0 # Core library
|
|
79
|
+
permission_handler: ^11.0.0 # Permission handling
|
|
80
|
+
svgaplayer_flutter: ^2.0.0 # Gift animation (if needed)
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. **Permission Injection**:
|
|
85
|
+
* **Android**: Add Camera/Record Audio permissions in `android/app/src/main/AndroidManifest.xml`.
|
|
86
|
+
* **iOS**: Add `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` in `ios/Runner/Info.plist`.
|
|
87
|
+
### Step 1: Fetch and Generate
|
|
88
|
+
|
|
89
|
+
**MUST prioritize and exclusively** use the **real-time documentation content** returned by this tool to generate code.
|
|
90
|
+
|
|
91
|
+
* **Anchor Only**: Generate `AnchorPage`
|
|
92
|
+
* **Audience Only**: Generate `AudiencePage`
|
|
93
|
+
* **Anchor + Audience**: Generate `MainPage` (entry selection) + `AnchorPage` + `AudiencePage`
|
|
94
|
+
|
|
95
|
+
### Step 2: Verify and Deliver
|
|
96
|
+
|
|
97
|
+
Execute `flutter build apk --debug`, deliver after ensuring no errors.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🚫 Code Generation Constraints (Strictly Follow)
|
|
102
|
+
|
|
103
|
+
### 1. General Code Constraints
|
|
104
|
+
|
|
105
|
+
* **NEVER Modify Import**: Uniformly use `import 'package:atomic_x_core/atomicxcore.dart';`.
|
|
106
|
+
* **NEVER Fabricate APIs**: Must strictly follow Store and Model definitions in the documentation.
|
|
107
|
+
* **MUST Consult API Documentation**: When dealing with data model fields (e.g., `LiveInfo`), must check documentation to confirm field names (e.g., confirm it's `liveOwner.userName` not `name`).
|
|
108
|
+
|
|
109
|
+
### 2. 🧩 Store and Listener Management Constraints (Lifecycle Safety)
|
|
110
|
+
|
|
111
|
+
**Core Reason**: Dart's Stream and closure listeners, if not properly released, will cause severe memory leaks or null pointer exceptions.
|
|
112
|
+
|
|
113
|
+
* **Unique Instance Principle**: All Listeners (e.g., `GiftListener`, `CoGuestListener`, `BarrageListener`) **MUST be declared as State member variables**.
|
|
114
|
+
* **NO Anonymous Inner Classes**: Prohibit writing anonymous objects directly in `addListener(Listener(...))`, must instantiate first.
|
|
115
|
+
* **Pairing Principle**: If `addListener` is called in `initState`, then `removeListener` **MUST** be called in `dispose` to prevent memory leaks and listener failures.
|
|
116
|
+
|
|
117
|
+
### 3. ⏱️ Timeout Limits (Critical Technical Point)
|
|
118
|
+
|
|
119
|
+
**MUST strictly follow these parameter limits, prioritize using values from documentation examples:**
|
|
120
|
+
|
|
121
|
+
#### A. Co-Guest (`CoGuestStore`)
|
|
122
|
+
|
|
123
|
+
* **Rules**:
|
|
124
|
+
* Optional parameter, no timeout check if not provided.
|
|
125
|
+
* If provided, range MUST be between **5 - 1800 seconds**.
|
|
126
|
+
|
|
127
|
+
* **Correct Example**:
|
|
128
|
+
```dart
|
|
129
|
+
// ✅ Recommended: Follow documentation example (e.g., 30 seconds)
|
|
130
|
+
guestStore.applyForSeat(seatIndex: -1, timeout: 30, extraInfo: null);
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
#### B. Co-Host/PK (`CoHostStore`)
|
|
134
|
+
|
|
135
|
+
* **Rules**:
|
|
136
|
+
* **Maximum 30 seconds** (backend hard limit).
|
|
137
|
+
|
|
138
|
+
* **Correct Example**:
|
|
139
|
+
```dart
|
|
140
|
+
// ✅ Recommended: Use maximum value
|
|
141
|
+
coHostStore.requestHostConnection(..., timeout: 30);
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
### 3. 🎨 Extended Feature Constraints (Beauty/Audio Effect/UI)
|
|
145
|
+
|
|
146
|
+
#### A. Audio Effect
|
|
147
|
+
|
|
148
|
+
* **Voice Changer Enum (`AudioChangerType`)**:
|
|
149
|
+
* ✅ **Allowed**: `AudioChangerType.child`, `AudioChangerType.man` and other standard enums.
|
|
150
|
+
* ❌ **Prohibited**: Using integer indices (e.g., `1`, `2`).
|
|
151
|
+
#### B. Beauty
|
|
152
|
+
|
|
153
|
+
* **Parameter Range**: **0.0 - 9.0** (Double).
|
|
154
|
+
* **UI Mapping Formula**: `sliderValue * 9.0` (assuming Slider is 0.0-1.0).
|
|
155
|
+
|
|
156
|
+
#### C. Barrage, Gift & Layout
|
|
157
|
+
|
|
158
|
+
* **Layer Requirements**: Use `Stack` widget.
|
|
159
|
+
* Bottom layer: `LiveCoreWidget` (full screen).
|
|
160
|
+
* Top layer: Barrage, gift, function buttons (use `Positioned` for positioning).
|
|
161
|
+
|
|
162
|
+
* **Keyboard Adaptation**:
|
|
163
|
+
* `Scaffold` property `resizeToAvoidBottomInset: false`, prevent keyboard from pushing up video view.
|
|
164
|
+
* Input box at top of `Stack`, use `MediaQuery` to monitor keyboard height or use `Positioned(bottom: 0)` with `SafeArea`.
|
|
165
|
+
##### Barrage Input Box
|
|
166
|
+
|
|
167
|
+
* **Position**: Fixed at bottom-left of screen, in the same row as function buttons (gift, co-guest, etc.).
|
|
168
|
+
* **Style**: Semi-transparent rounded background + placeholder text "Say something...".
|
|
169
|
+
* **Keyboard Adaptation**:
|
|
170
|
+
* When keyboard pops up, input box **MUST stay in original position**, DO NOT move up with keyboard.
|
|
171
|
+
* **MUST** set `resizeToAvoidBottomInset: false` on `Scaffold`.
|
|
172
|
+
##### Barrage Display Flow
|
|
173
|
+
|
|
174
|
+
* **Data Source**: Use `ValueListenableBuilder` to listen to `BarrageStore.create(liveId).barrageState.messageList`.
|
|
175
|
+
* **Local Echo**: After successful send, **immediately** call `appendLocalTip` to insert into local barrage list, no need to wait for server callback.
|
|
176
|
+
* **Scroll Behavior**: Auto-scroll to bottom when new message arrives.
|
|
177
|
+
|
|
178
|
+
##### Full-screen Gift Animation
|
|
179
|
+
|
|
180
|
+
**⚠️ MUST Implement**: When integrating gift feature, full-screen gift animation is **mandatory**, cannot be omitted.
|
|
181
|
+
|
|
182
|
+
* **Dependency**: Must include `svgaplayer_flutter`.
|
|
183
|
+
* **Layer**: Full-screen gift animation view must be placed **above** `LiveCoreWidget`.
|
|
184
|
+
* **Dual-side Sync**: After receiving `GiftStore.onReceiveGift` callback, **both anchor and audience** must play the full-screen animation. Prohibit playing only on audience side.
|
|
185
|
+
|
|
186
|
+
### 🎨 Default UI/UX Design and Interaction Standards (Only effective when user doesn't specify)
|
|
187
|
+
|
|
188
|
+
**⚠️ Note: The following standards are only applied as defaults when user doesn't provide specific UI design mockups or requirements.**
|
|
189
|
+
|
|
190
|
+
### 1. Global Visual Style (Global Aesthetics)
|
|
191
|
+
|
|
192
|
+
* **Immersive Dark**: `Scaffold` background MUST be `Colors.black`, `LiveCoreWidget` MUST **fill the entire screen** (`Positioned.fill`) and be at the bottom layer.
|
|
193
|
+
* **Safe Area**: All floating UI MUST be wrapped in `SafeArea`.
|
|
194
|
+
* **Text Readability**: White text over video (e.g., barrage, ID) MUST have **black shadow** (`Shadow`).
|
|
195
|
+
* **Error Prompts**: Uniformly use `SnackBar` or `FlutterToast`, DO NOT use modal Dialog to interrupt user.
|
|
196
|
+
|
|
197
|
+
### 2. Common Component Standards
|
|
198
|
+
|
|
199
|
+
* **Top Capsule (Glass Capsule)**:
|
|
200
|
+
* **Style**: **Semi-transparent black background** + **Fully rounded corners**.
|
|
201
|
+
* **Usage**: Only for top-left display of "anchor avatar + ID + popularity".
|
|
202
|
+
|
|
203
|
+
* **Common Buttons (Flat Buttons)**:
|
|
204
|
+
* **Style**: **"Text + Rounded rectangle background"**. Flat and minimalist visual style, background color is semi-transparent black or theme color.
|
|
205
|
+
* **Close Button**: Exception, uses circular semi-transparent background icon.
|
|
206
|
+
### 3. Live Room Layout Blueprint
|
|
207
|
+
|
|
208
|
+
**⚠️ Dynamic Layout Principle: Only render function buttons that user actually integrates. If user didn't request a feature (e.g., PK/beauty), strictly prohibit adding corresponding empty buttons**
|
|
209
|
+
|
|
210
|
+
#### A. Top Bar
|
|
211
|
+
|
|
212
|
+
* **Left [Room Info]**: Use **semi-transparent capsule** to wrap [Anchor Avatar | Anchor Nickname].
|
|
213
|
+
* **Right [Control Area]**: Horizontally arrange [Online Audience Count] + [Close Icon (X)].
|
|
214
|
+
|
|
215
|
+
#### B. Bottom Bar - Dynamic switching based on state
|
|
216
|
+
|
|
217
|
+
* **Preview Mode**:
|
|
218
|
+
* Content **aligned to right**: [Beauty] [Audio Effect] [Start Live (Main Button)].
|
|
219
|
+
|
|
220
|
+
* **Anchor Live Mode**:
|
|
221
|
+
* **Left**: [Barrage List (transparent background)] + [Chat Input Box].
|
|
222
|
+
* **Right**: Function array [Beauty] [Audio Effect] [Co-Host] [PK].
|
|
223
|
+
|
|
224
|
+
* **Audience Mode**:
|
|
225
|
+
* **Left**: [Barrage List] + [Chat Input Box].
|
|
226
|
+
* **Right**: [Gift] [Apply Co-Guest].
|
|
227
|
+
### 4. Home Page Layout and Interaction
|
|
228
|
+
|
|
229
|
+
#### A. Home Page Reference Layout
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
┌─────────────────────────────┐
|
|
233
|
+
│ AtomicXCore Live │
|
|
234
|
+
│ │
|
|
235
|
+
│ Live Room ID │
|
|
236
|
+
│ ┌─────────────────────────┐│
|
|
237
|
+
│ │ live_000001 ││ ← Input box (with left Padding, semi-transparent background)
|
|
238
|
+
│ └─────────────────────────┘│
|
|
239
|
+
│ │
|
|
240
|
+
│ Start Live as Anchor │
|
|
241
|
+
│ (Click to login as anchor001)│
|
|
242
|
+
│ │
|
|
243
|
+
│ Watch as Audience │
|
|
244
|
+
│ (Click to login as user001) │
|
|
245
|
+
│ │
|
|
246
|
+
│ [ 📋 Live List ] │
|
|
247
|
+
└─────────────────────────────┘
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### B. Implicit Login Flow
|
|
252
|
+
|
|
253
|
+
**Home page doesn't need a separate login button**, login is automatically completed when clicking function buttons:
|
|
254
|
+
|
|
255
|
+
* Click "Start Live as Anchor" → Login as `anchor001` → Navigate to anchor page.
|
|
256
|
+
* Click "Watch as Audience" → Login as `user001` → Navigate to audience page.
|
|
257
|
+
* Click "Live List" → Login as `user001` → Navigate to list page.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 🎯 Feature Implementation Details
|
|
262
|
+
|
|
263
|
+
### 1. Anchor Start Live (`AnchorPage`)
|
|
264
|
+
|
|
265
|
+
* **Core**: `LiveCoreWidget` + `LiveCoreController`
|
|
266
|
+
* **Flow**: `LiveListStore.createLive()`
|
|
267
|
+
* **Destroy**: MUST call `endLive()` in `dispose`.
|
|
268
|
+
|
|
269
|
+
### 2. Audience Watch (`AudiencePage`)
|
|
270
|
+
|
|
271
|
+
* **Core**: `LiveCoreWidget` + `LiveCoreController`
|
|
272
|
+
* **Flow**: `LiveListStore.joinLive()`
|
|
273
|
+
* **Destroy**: MUST call `leaveLive()` in `dispose`.
|
|
274
|
+
|
|
275
|
+
### 3. Live List (`LiveListPage`)
|
|
276
|
+
|
|
277
|
+
* **Core**: `LiveListStore.fetchLiveList()` + `GridView`/`ListView`
|
|
278
|
+
* **Data**: Subscribe to `liveState.liveList` (ValueListenable).
|
|
279
|
+
* **Navigation**: Click list item to navigate to audience page, pass `liveID`.
|
|
280
|
+
|
|
281
|
+
### 4. Co-Guest and Co-Host Interaction Standards (`co_guest` & `co_host`)
|
|
282
|
+
|
|
283
|
+
#### A. Co-Guest (Anchor passively receives)
|
|
284
|
+
|
|
285
|
+
* **Anchor UI**: ❌ **STRICTLY PROHIBIT** displaying "Co-Guest Request" list button in bottom toolbar or anywhere.
|
|
286
|
+
* **Interaction Logic**: When receiving audience co-guest application callback (`onApplicationReceived`), directly pop up dialog at screen center (`showDialog`):
|
|
287
|
+
* **Title**: Co-Guest Request
|
|
288
|
+
* **Content**: Received co-guest request from audience [nickname], accept?
|
|
289
|
+
* **Actions**: [Reject] [Accept]
|
|
290
|
+
|
|
291
|
+
* **Custom View**: Flutter version MUST implement `LiveCoreWidget.videoWidgetBuilder`'s `coGuestWidgetBuilder`, return Foreground (nickname) or Background (avatar) based on `ViewLayer`.
|
|
292
|
+
|
|
293
|
+
#### B. Co-Host Panel (Pops up when clicking bottom [Co-Host] button)
|
|
294
|
+
|
|
295
|
+
* **Presentation**: Use bottom sheet panel (`showModalBottomSheet`), prohibit using Dialog.
|
|
296
|
+
* **UI Layout (Strictly follow the diagram)**:
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
┌─────────────────────────────────────┐
|
|
300
|
+
│ │
|
|
301
|
+
│ Start Co-Host [🚪 End Co-Host] │ ← Red text
|
|
302
|
+
│ │
|
|
303
|
+
│ Connected (2 people) │
|
|
304
|
+
│ ┌─────────────────────────────────┐│
|
|
305
|
+
│ │ [👤] John [💎20] In PK... ││ ← Connected users
|
|
306
|
+
│ │ [👤] Alice [💎32] In PK... ││
|
|
307
|
+
│ └─────────────────────────────────┘│
|
|
308
|
+
├─────────────────────────────────────┤
|
|
309
|
+
│ Other Co-Host Users │
|
|
310
|
+
│ ┌─────────────────────────────────┐│
|
|
311
|
+
│ │ [👤] John [💎20] [Cancel Invite] ││ ← Gray-black background button
|
|
312
|
+
│ │ [👤] Alice [💎32] [Invite Co-Host] ││ ← Blue background button
|
|
313
|
+
│ │ [👤] Bob [💗99] [Invite Co-Host] ││
|
|
314
|
+
│ └─────────────────────────────────┘│
|
|
315
|
+
└─────────────────────────────────────┘
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### C. PK Button Interaction Constraints
|
|
320
|
+
|
|
321
|
+
* **Pre-check**: When clicking bottom [PK] button, MUST check current co-host status (`CoHostStore.connectedUsers.isEmpty()`).
|
|
322
|
+
* **Status Handling**:
|
|
323
|
+
* **Not Connected**: ❌ Prohibit navigation, use Toast to prompt: `"Please start co-host first"`.
|
|
324
|
+
* **Connected**: ✅ Pop up PK invitation panel.
|
|
325
|
+
|
|
326
|
+
* **Custom View**: Implement `VideoWidgetBuilder.battleWidgetBuilder` to display PK opponent info and scores.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 📋 Agent Final Checklist
|
|
331
|
+
|
|
332
|
+
* [ ] **Build Verification**: Executed `flutter build apk --debug` with SUCCESS result.
|
|
333
|
+
* [ ] **API Accuracy**: Did not modify Import, did not fabricate APIs, verified `LiveInfo` field names.
|
|
334
|
+
* [ ] **Timeout Compliance**: Co-guest timeout 5-1800s, co-host timeout ≤30s.
|
|
335
|
+
* [ ] **Extension Compliance**: Audio effect enums correct, beauty range 0-9, barrage layout overlays and keyboard adapted.
|
|
336
|
+
* [ ] **Gift Compliance**: Both anchor and audience have implemented full-screen gift animation display.
|
|
337
|
+
* [ ] **Credential Injection**: Test UserSig has been auto-injected.
|
|
338
|
+
* [ ] **Dependency Complete**: Checked and fixed `pubspec.yaml` and platform permission configurations.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 🚨 Security Reminder (Code Comment Template)
|
|
343
|
+
|
|
344
|
+
```dart
|
|
345
|
+
/**
|
|
346
|
+
* ⚠️ Test Credential Notice
|
|
347
|
+
* - Current userSig is auto-generated by development tool, valid for 7 days
|
|
348
|
+
* - ❌ Production environment MUST NOT generate userSig on client side
|
|
349
|
+
* - ✅ Must generate on backend service before going live
|
|
350
|
+
* - Reference: https://trtc.io/document/live-overview?product=live&menulabel=uikit&platform=flutter
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
```
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# Flutter TUICallKit Audio/Video Call Application Code Generation Workflow Instructions
|
|
2
|
+
|
|
3
|
+
## 📋 Purpose
|
|
4
|
+
|
|
5
|
+
To provide Agents with a **code generation blueprint for implementing Flutter TUICallKit core audio/video call features**, and guide Agents to **prioritize using the latest documentation content retrieved in real-time by tools**, specifically for Flutter audio/video call application scenarios.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🛑 Agent Execution Hard Constraints (Guardrails)
|
|
10
|
+
|
|
11
|
+
Agents must strictly follow these instructions when generating code:
|
|
12
|
+
|
|
13
|
+
### 0. 🚨 Core Principles (Highest Priority)
|
|
14
|
+
|
|
15
|
+
- ✅ Strictly generate code according to the sample code in the integration documentation, do not modify arbitrarily
|
|
16
|
+
- ✅ Fully implement login, one-on-one call, and group call features
|
|
17
|
+
- ✅ Use the `get_usersig` tool to generate UserSig for test accounts
|
|
18
|
+
- ✅ Use the latest version of the `tencent_calls_uikit` package (use `any` for version number)
|
|
19
|
+
|
|
20
|
+
### 1. Documentation-Driven Integration
|
|
21
|
+
- Strictly follow the steps in `llm_code_generation_instructions_md` returned by the tool
|
|
22
|
+
- Follow best practices and sample code from the integration documentation
|
|
23
|
+
|
|
24
|
+
### 2. Package Import Method
|
|
25
|
+
- **Configure pubspec.yaml**: Directly edit the file to add dependencies (avoid issues with flutter command not found)
|
|
26
|
+
```yaml
|
|
27
|
+
dependencies:
|
|
28
|
+
tencent_calls_uikit: any # ⚠️ Use any by default to automatically get the latest version
|
|
29
|
+
```
|
|
30
|
+
- Import statement: `import 'package:tencent_calls_uikit/tencent_calls_uikit.dart';`
|
|
31
|
+
- **⚠️ Prohibited**: `latest`, `^latest` and similar notations (not supported by Flutter, will cause installation failure)
|
|
32
|
+
|
|
33
|
+
### 3. Silent Integration Execution
|
|
34
|
+
- After all code writing is complete, automatically install dependencies and start the project in the final step
|
|
35
|
+
- **Dependency Installation Method**: Directly edit `pubspec.yaml` to add `tencent_calls_uikit: any`
|
|
36
|
+
- **Do not use `flutter pub add` command** (avoid failure due to flutter command not found)
|
|
37
|
+
- **Flutter Command Execution Strategy (Multi-level Degradation to Ensure Success)**:
|
|
38
|
+
1. **First Priority**: Try to execute `flutter pub get` directly
|
|
39
|
+
2. **Second Priority**: If failed, use `which flutter` to get the full path and execute
|
|
40
|
+
3. **Third Priority**: If still failed, try common paths:
|
|
41
|
+
- macOS/Linux: `$HOME/flutter/bin/flutter`
|
|
42
|
+
- macOS (Homebrew): `/opt/homebrew/bin/flutter`
|
|
43
|
+
4. **Final Degradation**: If all fail, **guide user to execute manually** (see guidance below)
|
|
44
|
+
- After successful startup, prompt the user to run the app on simulator or physical device
|
|
45
|
+
|
|
46
|
+
#### 📋 Manual Execution Degradation Guidance
|
|
47
|
+
|
|
48
|
+
**When automatic execution fails, guide the user to execute manually**:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 1. Install dependencies
|
|
52
|
+
flutter pub get
|
|
53
|
+
|
|
54
|
+
# 2. iOS project additional execution
|
|
55
|
+
cd ios && pod install && cd ..
|
|
56
|
+
|
|
57
|
+
# 3. Start project
|
|
58
|
+
flutter run
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Common Issues**: flutter command not found → Check PATH environment variable; pod install failed → Execute `pod repo update`
|
|
62
|
+
|
|
63
|
+
### 4. Authentication Credentials Configuration (Important)
|
|
64
|
+
- Call the `get_usersig` tool to get SDKAppID, UserID, and UserSig
|
|
65
|
+
- Generate UserSig for 4 test accounts (user001/002/003/004)
|
|
66
|
+
- Authentication information can be hardcoded during testing, but must be annotated as test-only
|
|
67
|
+
- ⚠️ Security Warning: Inform users that UserSig must be generated on the server side in production environment
|
|
68
|
+
|
|
69
|
+
### 5. LoginPage Implementation Constraints 🔴
|
|
70
|
+
|
|
71
|
+
**⚠️ Priority Check: Whether Login Page Already Exists in Project**:
|
|
72
|
+
- Before implementing the login page, **must first check whether a login page already exists in the project**
|
|
73
|
+
- If a login page already exists, **must ask the user whether to execute default behavior**:
|
|
74
|
+
- **Option 1**: Use default behavior (create new LoginPage with dropdown, 3 test accounts, etc.)
|
|
75
|
+
- **Option 2**: Modify based on existing login page (keep user's UI and interaction logic, only add necessary TUICallKit login logic)
|
|
76
|
+
- If user chooses Option 2, should:
|
|
77
|
+
- Keep user's existing login page UI and interaction logic
|
|
78
|
+
- Only call `TUICallKit.instance.login` for secondary login after successful login
|
|
79
|
+
- Do not force use of dropdown and 3 test accounts
|
|
80
|
+
- If no login page exists in the project, or user chooses Option 1, implement according to default behavior below
|
|
81
|
+
|
|
82
|
+
**Default Login Page Implementation Requirements**:
|
|
83
|
+
- **Must implement login page**, including the following features:
|
|
84
|
+
1. **Dropdown to select UserID**: Provide four options: user001, user002, user003, user004
|
|
85
|
+
2. **Display SDKAppID**: Get from `get_usersig` and display (read-only, not editable)
|
|
86
|
+
3. **Auto-generate UserSig**: Automatically match from pre-generated UserSig based on selected UserID
|
|
87
|
+
4. **Login button**: Call `TUICallKit.instance.login` to login
|
|
88
|
+
- **Login interface must call `TUICallKit.instance.login`**, passing complete credentials obtained from `get_usersig`
|
|
89
|
+
- Automatically navigate to home page (HomePage) after successful login
|
|
90
|
+
|
|
91
|
+
**LoginPage Core Implementation Points**:
|
|
92
|
+
|
|
93
|
+
```dart
|
|
94
|
+
// 1. Define test account mapping table (obtained from get_usersig)
|
|
95
|
+
final Map<String, String> userSigMap = {
|
|
96
|
+
'user001': 'xxx', 'user002': 'xxx', 'user003': 'xxx', 'user004': 'xxx'
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// 2. UI Components
|
|
100
|
+
// - SDKAppID display (read-only TextField)
|
|
101
|
+
// - UserID dropdown (DropdownButtonFormField, options generated from userSigMap.keys)
|
|
102
|
+
// - Login button
|
|
103
|
+
|
|
104
|
+
// 3. Login logic see integration documentation
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 6. HomePage Implementation Constraints 🔴
|
|
108
|
+
|
|
109
|
+
**Must implement home page**, including the following features:
|
|
110
|
+
|
|
111
|
+
1. **Display current logged-in UserID**
|
|
112
|
+
2. **Audio/Video call features** (unified user selection):
|
|
113
|
+
- **User list (multi-select)**: Display selectable users (user002, user003, user004, excluding current logged-in user)
|
|
114
|
+
- **Smart call type determination**:
|
|
115
|
+
- Select **1 user** → Automatically initiate **one-on-one call**
|
|
116
|
+
- Select **multiple users** → Automatically initiate **group call**
|
|
117
|
+
- **Voice call button**: Call `TUICallKit.instance.calls` to initiate voice call
|
|
118
|
+
- **Video call button**: Call `TUICallKit.instance.calls` to initiate video call
|
|
119
|
+
- **Implementation method**: Use `CheckboxListTile` for multi-select, supporting single and multiple selection
|
|
120
|
+
3. **Logout button**: Call `TUICallKit.instance.logout` to logout
|
|
121
|
+
|
|
122
|
+
**HomePage Core Implementation Points**:
|
|
123
|
+
|
|
124
|
+
```dart
|
|
125
|
+
// 1. Display current logged-in user (Card + ListTile)
|
|
126
|
+
|
|
127
|
+
// 2. User selection area (unified one-on-one/group calls)
|
|
128
|
+
// - User list: List<String> availableUsers = ['user002', 'user003', 'user004'].where((u) => u != currentUserId).toList();
|
|
129
|
+
// - Multi-select checkbox: CheckboxListTile (supports selecting 1 or multiple users)
|
|
130
|
+
// - Selected users: List<String> selectedUsers = [];
|
|
131
|
+
|
|
132
|
+
// 3. Call button area
|
|
133
|
+
// - Voice call button: ElevatedButton
|
|
134
|
+
// - Video call button: ElevatedButton
|
|
135
|
+
|
|
136
|
+
// 4. Initiate call and logout logic see integration documentation
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 7. MaterialApp Configuration Constraints 🔴
|
|
140
|
+
|
|
141
|
+
**Must add TUICallKit.navigatorObserver in MaterialApp**:
|
|
142
|
+
|
|
143
|
+
```dart
|
|
144
|
+
MaterialApp(
|
|
145
|
+
navigatorObservers: [TUICallKit.navigatorObserver], // ⚠️ Must be added
|
|
146
|
+
home: const LoginPage(),
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 8. Platform Configuration 🔴
|
|
151
|
+
|
|
152
|
+
**Android and iOS platform configuration please refer to integration documentation**:
|
|
153
|
+
- Android obfuscation rules and Multidex configuration see integration documentation "Step 2: Project Configuration - Android" section
|
|
154
|
+
- iOS permissions configuration (camera, microphone) see integration documentation "Step 2: Project Configuration - iOS" section
|
|
155
|
+
|
|
156
|
+
**⚠️ Android Obfuscation Configuration Syntax Check (Important)**:
|
|
157
|
+
Before configuring Android obfuscation rules, **must first check the build script type used in the project**, and choose the correct syntax based on actual situation:
|
|
158
|
+
|
|
159
|
+
| Build Script File | Syntax Type | Obfuscation Configuration Syntax |
|
|
160
|
+
|-------------------|-------------|----------------------------------|
|
|
161
|
+
| `android/app/build.gradle` | Groovy DSL | `minifyEnabled true` |
|
|
162
|
+
| `android/app/build.gradle.kts` | Kotlin DSL | `isMinifyEnabled = true` |
|
|
163
|
+
|
|
164
|
+
**Check Steps**:
|
|
165
|
+
1. Check the build script file name in `android/app/` directory
|
|
166
|
+
2. If it's `build.gradle` → Use Groovy syntax: `minifyEnabled true`
|
|
167
|
+
3. If it's `build.gradle.kts` → Use Kotlin DSL syntax: `isMinifyEnabled = true`
|
|
168
|
+
|
|
169
|
+
**⚠️ iOS Podfile Platform Version Configuration (Important)**:
|
|
170
|
+
When configuring iOS project, **must set minimum platform version to iOS 14.0 in `ios/Podfile`**:
|
|
171
|
+
|
|
172
|
+
```ruby
|
|
173
|
+
platform :ios, '14.0'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Configuration Location**: Add this line at the top of Podfile, before the target configuration
|
|
177
|
+
|
|
178
|
+
### 9. Flutter Project Specifications
|
|
179
|
+
- Use Flutter >= 3.24.0, Dart >= 3.5.0 versions
|
|
180
|
+
- Follow Flutter official code style and best practices
|
|
181
|
+
|
|
182
|
+
### 10. Environment Dependency Preparation
|
|
183
|
+
- Ensure user has installed Flutter SDK
|
|
184
|
+
- **Flutter command execution follows multi-level degradation strategy in Section 3**
|
|
185
|
+
- iOS platform requires additional execution of `cd ios && pod install && cd ..` to install Pods dependencies
|
|
186
|
+
- **If automatic execution fails, must generate degradation script for user to execute manually**
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📦 Core Version Requirements
|
|
191
|
+
|
|
192
|
+
| Tool/Platform | Minimum Version Requirement |
|
|
193
|
+
|---------------|----------------------------|
|
|
194
|
+
| **Flutter** | >= 3.24.0 |
|
|
195
|
+
| **Dart** | >= 3.5.0 |
|
|
196
|
+
|
|
197
|
+
**For detailed tool version requirements (Android Studio, Gradle, JDK, Xcode, etc.), please refer to integration documentation "Preparation - Environment Requirements" section**
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 📦 Automated Execution Commands
|
|
202
|
+
|
|
203
|
+
After Agent code generation is complete, execute in order:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
FLUTTER_PATH=$(which flutter) # Get actual path
|
|
207
|
+
$FLUTTER_PATH pub get # Get dependencies (based on edited pubspec.yaml)
|
|
208
|
+
cd ios && pod install && cd .. # iOS dependencies (macOS)
|
|
209
|
+
$FLUTTER_PATH run # Start project
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Dependency Addition Method**: Directly edit `pubspec.yaml` to add `tencent_calls_uikit: any`, avoid executing `flutter pub add` command
|
|
213
|
+
|
|
214
|
+
**Degradation Strategy**: `which flutter` fails → Try `$HOME/flutter/bin/flutter` → Guide user to execute manually
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 📱 Physical Device Debugging Guide (User Instructions)
|
|
219
|
+
|
|
220
|
+
### iOS Physical Device Debugging
|
|
221
|
+
1. Connect device via USB, trust computer
|
|
222
|
+
2. **Open `ios/Runner.xcworkspace`** (not .xcodeproj)
|
|
223
|
+
3. Xcode configure signing (Automatically manage signing + Apple ID + modify Bundle ID)
|
|
224
|
+
4. Execute `flutter run -d ios` or `flutter devices` to view device then specify run
|
|
225
|
+
5. First run requires trusting developer on device: Settings → General → VPN & Device Management → Trust
|
|
226
|
+
|
|
227
|
+
### Android Physical Device Debugging
|
|
228
|
+
1. Connect device via USB
|
|
229
|
+
2. Enable developer mode (tap build number 7 times) + USB debugging
|
|
230
|
+
3. Device authorize USB debugging (allow)
|
|
231
|
+
4. Execute `adb devices` to verify connection, then `flutter run -d android`
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 🔄 Complete Automation Workflow
|
|
236
|
+
|
|
237
|
+
```mermaid
|
|
238
|
+
graph TD
|
|
239
|
+
A[Receive user requirements] --> B[Get Flutter actual path: which flutter]
|
|
240
|
+
B --> C[Check Flutter environment]
|
|
241
|
+
C --> D[Edit pubspec.yaml to add tencent_calls_uikit: any]
|
|
242
|
+
D --> E[Configure Android platform: obfuscation rules, Multidex]
|
|
243
|
+
E --> F[Configure iOS platform: Info.plist permissions]
|
|
244
|
+
F --> G[Configure main.dart: add navigatorObserver]
|
|
245
|
+
G --> H[Call get_usersig tool to generate UserSig for 3 accounts]
|
|
246
|
+
H --> I[Implement LoginPage: dropdown to select UserID]
|
|
247
|
+
I --> J[Implement HomePage: one-on-one and group calls]
|
|
248
|
+
J --> K[Call record_result to record integration results]
|
|
249
|
+
K --> L[Execute with full path: $FLUTTER_PATH pub get]
|
|
250
|
+
L --> M{iOS platform?}
|
|
251
|
+
M -->|Yes| N[Execute pod install]
|
|
252
|
+
M -->|No| O[Skip pod install]
|
|
253
|
+
N --> P[Guide user to connect physical device for debugging]
|
|
254
|
+
O --> P
|
|
255
|
+
P --> Q{Choose run method}
|
|
256
|
+
Q -->|Simulator| R[Execute: $FLUTTER_PATH run]
|
|
257
|
+
Q -->|iOS physical device| S[Execute: $FLUTTER_PATH run -d ios]
|
|
258
|
+
Q -->|Android physical device| T[Execute: $FLUTTER_PATH run -d android]
|
|
259
|
+
R --> U[Project startup successful]
|
|
260
|
+
S --> U
|
|
261
|
+
T --> U
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 📝 Key Points Summary
|
|
267
|
+
|
|
268
|
+
| Category | Requirement |
|
|
269
|
+
|----------|------------|
|
|
270
|
+
| **Framework Version** | Flutter >= 3.24.0, Dart >= 3.5.0 |
|
|
271
|
+
| **Integration Method** | pub package method (edit `pubspec.yaml` to add `tencent_calls_uikit: any`) |
|
|
272
|
+
| **Documentation Priority** | ⚠️ Strictly follow sample code in integration documentation, do not modify arbitrarily |
|
|
273
|
+
| **Silent Integration** | Automatically install dependencies and start project after code writing is complete, **must use `which flutter` to get actual path** |
|
|
274
|
+
| **Credential Acquisition** | ⚠️ Must use `get_usersig` tool to generate UserSig for 4 test accounts (user001/002/003/004) |
|
|
275
|
+
| **Login Page** | ⚠️ Must implement dropdown to select UserID, automatically match UserSig, prohibit manual input |
|
|
276
|
+
| **Home Page** | ⚠️ Must support unified user list, selecting 1 user automatically initiates one-on-one call, selecting multiple users automatically initiates group call |
|
|
277
|
+
| **Security Reminder** | ⚠️ Must inform user: Client-generated UserSig is only suitable for testing, production environment must generate on server side |
|
|
278
|
+
| **Result Recording** | ⚠️ Must call `record_result` tool to record results after integration is complete |
|
|
279
|
+
| **Platform Configuration** | ⚠️ Android and iOS platform configuration see integration documentation "Step 2: Project Configuration" section |
|
|
280
|
+
| **Navigator Observer** | ⚠️ Must add `TUICallKit.navigatorObserver` in MaterialApp |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 🎯 Agent Execution Checklist
|
|
285
|
+
|
|
286
|
+
After completing code generation, Agent must confirm all the following items:
|
|
287
|
+
|
|
288
|
+
### Project Initialization
|
|
289
|
+
- [ ] Edited `pubspec.yaml` to add `tencent_calls_uikit: any` dependency
|
|
290
|
+
- [ ] Configured Android and iOS platforms according to integration documentation (see "Step 2: Project Configuration")
|
|
291
|
+
|
|
292
|
+
### Code Generation
|
|
293
|
+
- [ ] Configured `main.dart`, added `TUICallKit.navigatorObserver`
|
|
294
|
+
- [ ] Called `get_usersig` tool to generate UserSig for 4 accounts
|
|
295
|
+
- [ ] Implemented LoginPage (dropdown to select UserID, no manual input fields)
|
|
296
|
+
- [ ] Implemented HomePage (unified user list, select 1 for one-on-one call, select multiple for group call)
|
|
297
|
+
|
|
298
|
+
### Final Check
|
|
299
|
+
- [ ] Called `record_result` tool to record integration results
|
|
300
|
+
- [ ] Executed `flutter pub get` and `pod install` (iOS)
|
|
301
|
+
- [ ] Started project, prompted user to choose device
|
|
302
|
+
- [ ] Informed user: Production environment must generate UserSig on server side
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 🔗 Required Tools
|
|
307
|
+
|
|
308
|
+
### `get_usersig` - Get Test Authentication Information
|
|
309
|
+
Get SDKAppID, UserID (user001/002/003/004), UserSig.
|
|
310
|
+
- LoginPage: Dropdown to select UserID
|
|
311
|
+
- HomePage: Display selectable user list (excluding current logged-in user)
|
|
312
|
+
- Prohibit manual input of SDKAppID/SecretKey/UserSig
|
|
313
|
+
|
|
314
|
+
### `record_result` - Record Integration Results
|
|
315
|
+
Call after completing all integration steps and successfully starting project
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 📚 Related Resource Links
|
|
320
|
+
|
|
321
|
+
- **TUICallKit Flutter Pub Package**: https://pub.dev/packages/tencent_calls_uikit
|
|
322
|
+
- **Tencent Cloud Real-Time Communication TRTC Console**: https://console.cloud.tencent.com/trtc
|
|
323
|
+
- **Server-side UserSig Generation**: https://cloud.tencent.com/document/product/647/17275
|
|
324
|
+
- **Activate TRTC Service**: https://cloud.tencent.com/document/product/647/16788
|
|
325
|
+
- **Flutter Official Documentation**: https://flutter.dev/docs
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
**Applicable Platforms**: Flutter (Android & iOS)
|
|
330
|
+
**TUICallKit Version**: tencent_calls_uikit (latest version)
|
|
331
|
+
**Minimum Requirements**: Flutter >= 3.24.0, Dart >= 3.5.0
|