@tencent-rtc/mcp 1.3.6 → 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.
@@ -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
+ ```
@@ -6,7 +6,7 @@ function reportCLSClient(reportData) {
6
6
  const time = Date.now();
7
7
  const data = {
8
8
  platform: 'mcp',
9
- verison: '1.3.6',
9
+ verison: '1.3.7',
10
10
  sdkappid: `${SDKAppID}`,
11
11
  method: method,
12
12
  userid: userID,
@@ -7,7 +7,7 @@ function reportESClient(reportData) {
7
7
  report: [
8
8
  {
9
9
  platform: 'mcp',
10
- version: '1.3.6',
10
+ version: '1.3.7',
11
11
  sdkappid: `${SDKAppID}`,
12
12
  method: method,
13
13
  userID: `${userID}`,