@tencent-rtc/mcp 1.2.8 → 1.2.9

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/package.json +1 -1
  2. package/resource/doc/native_live/android/V2TXLiveCode_api_android.md +312 -0
  3. package/resource/doc/native_live/android/V2TXLiveDef_api_android.md +430 -0
  4. package/resource/doc/native_live/android/V2TXLivePlayerObserver_api_android.md +679 -0
  5. package/resource/doc/native_live/android/V2TXLivePlayer_api_android.md +671 -0
  6. package/resource/doc/native_live/android/V2TXLivePremier_api_android.md +271 -0
  7. package/resource/doc/native_live/android/V2TXLivePusherObserver_api_android.md +849 -0
  8. package/resource/doc/native_live/android/V2TXLivePusher_api_android.md +1046 -0
  9. package/resource/doc/native_live/flutter/V2TXLiveCode_api_flutter.md +460 -0
  10. package/resource/doc/native_live/flutter/V2TXLiveDef_api_flutter.md +558 -0
  11. package/resource/doc/native_live/flutter/V2TXLivePlayerObserver_api_flutter.md +865 -0
  12. package/resource/doc/native_live/flutter/V2TXLivePlayer_api_flutter.md +657 -0
  13. package/resource/doc/native_live/flutter/V2TXLivePremier_api_flutter.md +437 -0
  14. package/resource/doc/native_live/flutter/V2TXLivePusherObserver_api_flutter.md +335 -0
  15. package/resource/doc/native_live/flutter/V2TXLivePusher_api_flutter.md +748 -0
  16. package/resource/doc/native_live/iOS/V2TXLiveCode_api_iOS.md +327 -0
  17. package/resource/doc/native_live/iOS/V2TXLiveDef_api_iOS.md +507 -0
  18. package/resource/doc/native_live/iOS/V2TXLivePlayerObserver_api_iOS.md +507 -0
  19. package/resource/doc/native_live/iOS/V2TXLivePlayer_api_iOS.md +659 -0
  20. package/resource/doc/native_live/iOS/V2TXLivePremier_api_iOS.md +284 -0
  21. package/resource/doc/native_live/iOS/V2TXLivePusherObserver_api_iOS.md +814 -0
  22. package/resource/doc/native_live/iOS/V2TXLivePusher_api_iOS.md +1000 -0
  23. package/tools/definitions/get_native_live_api_def.js +23 -0
  24. package/tools/definitions/get_native_live_api_def.js.map +1 -0
  25. package/tools/index.js +4 -0
  26. package/tools/index.js.map +1 -1
  27. package/tools/native_live/get-native-live-api.js +31 -0
  28. package/tools/native_live/get-native-live-api.js.map +1 -0
  29. package/utils/report-cls-client.js +1 -1
  30. package/utils/report-es-client.js +1 -1
@@ -0,0 +1,659 @@
1
+ # Tencent Cloud Live Streaming SDK V2TXLivePlayer Playback API Documentation
2
+
3
+ ## Feature Overview
4
+
5
+ `V2TXLivePlayer` is the primary interface for the Tencent Cloud Live Streaming (CSS) player. It pulls audio and video from a specified live stream URL, decodes the content, and renders playback on the local device.
6
+
7
+ **Platform Support**: iOS, macOS
8
+
9
+ ## Core Features
10
+
11
+ ### 🎯 Main Capabilities
12
+ - ✅ **Multi-Protocol Support**: HTTP-FLV, WebRTC, TRTC, HLS, RTMP
13
+ - ✅ **Video Control**: Rotation, Fill Mode, Mirroring
14
+ - ✅ **Playback Control**: Play/Stop, Pause/Resume, Volume Adjustment
15
+ - ✅ **Cache Optimization**: Automatic cache strategy adjustment
16
+ - ✅ **Seamless Switching**: Multi-resolution stream switching without interruption
17
+ - ✅ **Custom Processing**: Monitor audio/video data and implement custom rendering
18
+ - ✅ **Advanced Features**: Snapshot, SEI message handling, Picture-in-Picture, Local Recording
19
+
20
+ ### 🔧 Technical Highlights
21
+ - **Low Latency**: Optimized caching and adaptive network handling
22
+ - **High Compatibility**: Supports a wide range of video encoding formats and resolutions
23
+ - **Easy Integration**: Streamlined API design and robust callback system
24
+ - **High Performance**: Hardware Decoding and efficient rendering pipeline
25
+
26
+ ### Player Instance Creation
27
+ ```objc
28
+ V2TXLivePlayer *player = [[V2TXLivePlayer alloc] init];
29
+ ```
30
+
31
+ ## API Details
32
+
33
+ ### Basic Setup APIs
34
+
35
+ #### setObserver – Configure Player Callback
36
+ ```objc
37
+ - (void)setObserver:(id<V2TXLivePlayerObserver>)observer;
38
+ ```
39
+
40
+ **Parameters**:
41
+ - `observer`: Object that receives player callbacks; must implement the `V2TXLivePlayerObserver` protocol
42
+
43
+ **Recommended Usage**: Set immediately after initializing the player.
44
+
45
+ **Description**: Assign a callback to monitor player status, playback volume changes, first audio/video frame events, statistics, warnings, and error notifications.
46
+
47
+ **Example**:
48
+ ```objc
49
+ [player setObserver:self];
50
+ ```
51
+
52
+ #### setRenderView – Assign Video Rendering View
53
+ ```objc
54
+ - (V2TXLiveCode)setRenderView:(TXView *)view;
55
+ ```
56
+
57
+ **Parameters**:
58
+ - `view`: The view for video rendering; use UIView on iOS or NSView on macOS
59
+
60
+ **Return Value**: `V2TXLiveCode`
61
+ - `V2TXLIVE_OK`: Success
62
+
63
+ **Recommended Usage**: Set the rendering view before starting playback.
64
+
65
+ **Example**:
66
+ ```objc
67
+ [player setRenderView:videoView];
68
+ ```
69
+
70
+ #### setRenderRotation – Set Video Rotation
71
+ ```objc
72
+ - (V2TXLiveCode)setRenderRotation:(V2TXLiveRotation)rotation;
73
+ ```
74
+
75
+ **Parameters**:
76
+ - `rotation`: Rotation angle, see `V2TXLiveDef#V2TXLiveRotation`
77
+ - `V2TXLiveRotation0` (Default): 0°, no rotation
78
+ - `V2TXLiveRotation90`: 90° clockwise
79
+ - `V2TXLiveRotation180`: 180° clockwise
80
+ - `V2TXLiveRotation270`: 270° clockwise
81
+
82
+ **Return Value**: `V2TXLiveCode`
83
+ - `V2TXLIVE_OK`: Success
84
+
85
+ **Recommended Usage**: No restrictions.
86
+
87
+ **Example**:
88
+ ```objc
89
+ [player setRenderRotation:V2TXLiveRotation0]; // No rotation
90
+ [player setRenderRotation:V2TXLiveRotation90]; // 90° clockwise
91
+ [player setRenderRotation:V2TXLiveRotation180]; // 180° clockwise
92
+ [player setRenderRotation:V2TXLiveRotation270]; // 270° clockwise
93
+ ```
94
+
95
+ #### setRenderFillMode – Set Video Fill Mode
96
+ ```objc
97
+ - (V2TXLiveCode)setRenderFillMode:(V2TXLiveFillMode)mode;
98
+ ```
99
+
100
+ **Parameters**:
101
+ - `mode`: Fill mode, see `V2TXLiveDef#V2TXLiveFillMode`
102
+ - `V2TXLiveFillModeFill` (Default): Fills the view, cropping content if aspect ratios differ
103
+ - `V2TXLiveFillModeFit`: Fits the entire image, adding black borders if needed
104
+ - `V2TXLiveFillModeScaleFill`: Stretches image to fill the view, may distort aspect ratio
105
+
106
+ **Return Value**: `V2TXLiveCode`
107
+ - `V2TXLIVE_OK`: Success
108
+
109
+ **Recommended Usage**: No restrictions.
110
+
111
+ **Example**:
112
+ ```objc
113
+ [player setRenderFillMode:V2TXLiveFillModeFill]; // Fill view, crop if needed
114
+ [player setRenderFillMode:V2TXLiveFillModeFit]; // Fit image, add black borders
115
+ [player setRenderFillMode:V2TXLiveFillModeScaleFill]; // Stretch to fill
116
+ ```
117
+
118
+ #### setRenderMirrorMode – Toggle Video Mirroring
119
+ ```objc
120
+ - (V2TXLiveCode)setRenderMirrorMode:(BOOL)enable;
121
+ ```
122
+
123
+ **Parameters**:
124
+ - `enable`: Enable horizontal mirroring during playback (Default: NO)
125
+
126
+ **Description**: When enabled, the video is flipped horizontally. You can toggle mirroring at any time.
127
+
128
+ **Return Value**: `V2TXLiveCode`
129
+ - `V2TXLIVE_OK`: Success
130
+
131
+ **Recommended Usage**: No restrictions.
132
+
133
+ **Example**:
134
+ ```objc
135
+ [player setRenderMirrorMode:YES]; // Enable mirroring
136
+ [player setRenderMirrorMode:NO]; // Disable mirroring
137
+ ```
138
+
139
+ ### Playback Control APIs
140
+
141
+ #### startLivePlay – Start Stream Playback
142
+ ```objc
143
+ - (V2TXLiveCode)startLivePlay:(NSString *)url;
144
+ ```
145
+
146
+ **Parameters**:
147
+ - `url`: Stream playback URL; supports HTTP-FLV, WebRTC, TRTC, HLS, RTMP
148
+
149
+ **Return Value**: `V2TXLiveCode`
150
+ - `V2TXLIVE_OK`: Playback started successfully
151
+ - `V2TXLIVE_ERROR_INVALID_PARAMETER`: Invalid URL
152
+ - `V2TXLIVE_ERROR_REFUSED`: RTC does not support pushing and pulling the same StreamId on the same device simultaneously
153
+ - `V2TXLIVE_ERROR_INVALID_LICENSE`: Invalid license, playback failed
154
+
155
+ **Important Note**:
156
+ - From version 10.7 onward, you must set the License using `V2TXLivePremier#setLicence` before playback; otherwise, playback will fail (black screen). Only set once globally.
157
+ - Supports Cloud Live Streaming License, Short Video License, and Video Playback License.
158
+
159
+ **Recommended Usage**: No restrictions.
160
+
161
+ **Example**:
162
+ ```objc
163
+ V2TXLiveCode result = [player startLivePlay:@"http://example.com/live/stream_1080p.flv"];
164
+ if (result == V2TXLIVE_OK) {
165
+ NSLog(@"Playback started successfully");
166
+ } else if (result == V2TXLIVE_ERROR_INVALID_PARAMETER) {
167
+ NSLog(@"Invalid playback address");
168
+ } else if (result == V2TXLIVE_ERROR_REFUSED) {
169
+ NSLog(@"Operation refused");
170
+ } else if (result == V2TXLIVE_ERROR_INVALID_LICENSE) {
171
+ NSLog(@"Invalid License, please check your License");
172
+ }
173
+ ```
174
+
175
+ #### stopPlay – Stop Stream Playback
176
+ ```objc
177
+ - (V2TXLiveCode)stopPlay;
178
+ ```
179
+
180
+ **Return Value**: `V2TXLiveCode`
181
+ - `V2TXLIVE_OK`: Success
182
+
183
+ **Recommended Usage**: Call after playback has started.
184
+
185
+ **Example**:
186
+ ```objc
187
+ [player stopPlay];
188
+ ```
189
+
190
+ #### isPlaying – Query Playback Status
191
+ ```objc
192
+ - (int)isPlaying;
193
+ ```
194
+
195
+ **Return Value**:
196
+ - `1`: Currently playing
197
+ - `0`: Playback stopped
198
+
199
+ **Recommended Usage**: No restrictions.
200
+
201
+ **Example**:
202
+ ```objc
203
+ int isPlaying = [player isPlaying];
204
+ if (isPlaying == 1) {
205
+ NSLog(@"Playing");
206
+ } else {
207
+ NSLog(@"Playback stopped");
208
+ }
209
+ ```
210
+
211
+ ### Audio/Video Control APIs
212
+
213
+ #### pauseAudio – Pause Audio Playback
214
+ ```objc
215
+ - (V2TXLiveCode)pauseAudio;
216
+ ```
217
+
218
+ **Return Value**: `V2TXLiveCode`
219
+ - `V2TXLIVE_OK`: Success
220
+
221
+ **Recommended Usage**: No restrictions. If called before playback starts, only video will play (no audio).
222
+
223
+ **Example**:
224
+ ```objc
225
+ [player pauseAudio];
226
+ ```
227
+
228
+ #### resumeAudio – Resume Audio Playback
229
+ ```objc
230
+ - (V2TXLiveCode)resumeAudio;
231
+ ```
232
+
233
+ **Return Value**: `V2TXLiveCode`
234
+ - `V2TXLIVE_OK`: Success
235
+
236
+ **Recommended Usage**: No restrictions.
237
+
238
+ **Example**:
239
+ ```objc
240
+ [player resumeAudio];
241
+ ```
242
+
243
+ #### pauseVideo – Pause Video Playback
244
+ ```objc
245
+ - (V2TXLiveCode)pauseVideo;
246
+ ```
247
+
248
+ **Return Value**: `V2TXLiveCode`
249
+ - `V2TXLIVE_OK`: Success
250
+
251
+ **Recommended Usage**: No restrictions. If called before playback starts, only audio will play (no video).
252
+
253
+ **Example**:
254
+ ```objc
255
+ [player pauseVideo];
256
+ ```
257
+
258
+ #### resumeVideo – Resume Video Playback
259
+ ```objc
260
+ - (V2TXLiveCode)resumeVideo;
261
+ ```
262
+
263
+ **Return Value**: `V2TXLiveCode`
264
+ - `V2TXLIVE_OK`: Success
265
+
266
+ **Recommended Usage**: No restrictions.
267
+
268
+ **Example**:
269
+ ```objc
270
+ [player resumeVideo];
271
+ ```
272
+
273
+ #### setPlayoutVolume – Adjust Playback Volume
274
+ ```objc
275
+ - (V2TXLiveCode)setPlayoutVolume:(NSUInteger)volume;
276
+ ```
277
+
278
+ **Parameters**:
279
+ - `volume`: Volume level, range 0–100 (Default: 100)
280
+
281
+ **Return Value**: `V2TXLiveCode`
282
+ - `V2TXLIVE_OK`: Success
283
+
284
+ **Recommended Usage**: No restrictions.
285
+
286
+ **Example**:
287
+ ```objc
288
+ [player setPlayoutVolume:50];
289
+ ```
290
+
291
+ ### Advanced Feature APIs
292
+
293
+ #### setCacheParams – Configure Cache Duration
294
+ ```objc
295
+ - (V2TXLiveCode)setCacheParams:(CGFloat)minTime maxTime:(CGFloat)maxTime;
296
+ ```
297
+
298
+ **Parameters**:
299
+ - `minTime`: Minimum cache duration (seconds), must be > 0 (Default: 1)
300
+ - `maxTime`: Maximum cache duration (seconds), must be > 0 (Default: 5)
301
+
302
+ **Return Value**: `V2TXLiveCode`
303
+ - `V2TXLIVE_OK`: Success
304
+ - `V2TXLIVE_ERROR_INVALID_PARAMETER`: minTime and maxTime must be greater than 0
305
+
306
+ **Optimization Tips**:
307
+ - Stable network: Use a smaller cache (1–3 seconds)
308
+ - Unstable network: Use a larger cache (3–5 seconds)
309
+ - No special requirements: Use default values
310
+
311
+ **Recommended Usage**: No restrictions.
312
+
313
+ **Example**:
314
+ ```objc
315
+ [player setCacheParams:1.0 maxTime:5.0];
316
+ ```
317
+
318
+ #### switchStream – Switch Stream Resolution Seamlessly (FLV and LEB Supported)
319
+ ```objc
320
+ - (V2TXLiveCode)switchStream:(NSString *)newUrl;
321
+ ```
322
+
323
+ **Parameters**:
324
+ - `newUrl`: URL of the stream with the desired resolution
325
+
326
+ **Return Value**: `V2TXLiveCode`
327
+ - `V2TXLIVE_OK`: Success
328
+
329
+ **Recommended Usage**: Call after playback has started.
330
+
331
+ **Example**:
332
+ ```objc
333
+ [player setObserver:self];
334
+ [player startLivePlay:@"http://example.com/live/stream_1080p.flv"];
335
+ [player switchStream:@"http://example.com/live/stream_720p.flv"];
336
+
337
+ #pragma mark - V2TXLivePlayerObserver
338
+ - (void)onStreamSwitched:(V2TXLivePlayer *)player url:(NSString *)url code:(V2TXLiveCode)code {
339
+ if (code == V2TXLIVE_OK) {
340
+ NSLog(@"Stream switched successfully, current playback address: %@", url);
341
+ } else if (code == V2TXLIVE_ERROR_STREAM_SWITCH_FAIL) {
342
+ NSLog(@"Stream switch failed, timeout");
343
+ } else if (code == V2TXLIVE_ERROR_STREAM_SWITCH_SERVER_ERROR) {
344
+ NSLog(@"Stream switch failed, server error");
345
+ } else if (code == V2TXLIVE_ERROR_STREAM_SWITCH_CLIENT_ERROR) {
346
+ NSLog(@"Stream switch failed, client error");
347
+ }
348
+ }
349
+ ```
350
+
351
+ #### getStreamList – Retrieve Available Stream Qualities (HLS Supported)
352
+ ```objc
353
+ - (NSArray<V2TXLiveStreamInfo *> *)getStreamList;
354
+ ```
355
+
356
+ **Return Value**: Array of stream info objects, representing available qualities
357
+
358
+ **Recommended Usage**: Call after playback has started.
359
+
360
+ **Example**:
361
+ ```objc
362
+ [player startLivePlay:@"http://example.com/live/stream_1080p.m3u8"];
363
+ NSArray<V2TXLiveStreamInfo *> *streamList = [player getStreamList];
364
+ ```
365
+
366
+ #### enableVolumeEvaluation – Enable Playback Volume Level Callback
367
+ ```objc
368
+ - (V2TXLiveCode)enableVolumeEvaluation:(NSUInteger)intervalMs;
369
+ ```
370
+
371
+ **Parameters**:
372
+ - `intervalMs`: Interval (ms) for `onPlayoutVolumeUpdate` callback. Minimum: 100ms. Set ≤0 to disable. Recommended: 300ms (Default: 0, disabled)
373
+
374
+ **Description**: When enabled, you receive periodic volume level updates via `V2TXLivePlayerObserver`.
375
+
376
+ **Return Value**: `V2TXLiveCode`
377
+ - `V2TXLIVE_OK`: Success
378
+
379
+ **Recommended Usage**: No restrictions.
380
+
381
+ **Example**:
382
+ ```objc
383
+ [player setObserver:self];
384
+ [player enableVolumeEvaluation:300];
385
+
386
+ #pragma mark - V2TXLivePlayerObserver
387
+ - (void)onPlayoutVolumeUpdate:(int)volume {
388
+ // Handle volume update
389
+ }
390
+ ```
391
+
392
+ #### snapshot – Capture Video Frame During Playback
393
+ ```objc
394
+ - (V2TXLiveCode)snapshot;
395
+ ```
396
+
397
+ **Return Value**: `V2TXLiveCode`
398
+ - `V2TXLIVE_OK`: Success
399
+ - `V2TXLIVE_ERROR_REFUSED`: Snapshot not allowed when player is stopped
400
+
401
+ **Recommended Usage**: Call after playback has started.
402
+
403
+ **Example**:
404
+ ```objc
405
+ [player setObserver:self];
406
+ [player snapshot];
407
+
408
+ #pragma mark - V2TXLivePlayerObserver
409
+ - (void)onSnapshotComplete:(UIImage *)image {
410
+ // Handle snapshot result
411
+ }
412
+ ```
413
+
414
+ #### enableObserveVideoFrame – Enable Custom Video Rendering
415
+ ```objc
416
+ - (V2TXLiveCode)enableObserveVideoFrame:(BOOL)enable
417
+ pixelFormat:(V2TXLivePixelFormat)pixelFormat
418
+ bufferType:(V2TXLiveBufferType)bufferType;
419
+ ```
420
+
421
+ **Parameters**:
422
+ - `enable`: Enable custom rendering (Default: NO)
423
+ - `pixelFormat`: Pixel format for callback, see `V2TXLiveDef#V2TXLivePixelFormat`
424
+ - `bufferType`: Data format for callback, see `V2TXLiveDef#V2TXLiveBufferType`
425
+
426
+ **Description**:
427
+ - When enabled, the SDK stops rendering video frames internally. You receive frames via `V2TXLivePlayerObserver` for custom rendering.
428
+ - Supported combinations:
429
+ - V2TXLivePixelFormatTexture2D + V2TXLiveBufferTypeTexture (Recommended)
430
+ - V2TXLivePixelFormatI420 + V2TXLiveBufferTypeByteArray
431
+ - V2TXLivePixelFormatI420 + V2TXLiveBufferTypeByteBuffer
432
+
433
+ **Return Value**: `V2TXLiveCode`
434
+ - `V2TXLIVE_OK`: Success
435
+ - `V2TXLIVE_ERROR_NOT_SUPPORTED`: Unsupported pixel/data format
436
+
437
+ **Recommended Usage**: Set before playback starts.
438
+
439
+ **Example**:
440
+ ```objc
441
+ [player enableObserveVideoFrame:YES
442
+ pixelFormat:V2TXLivePixelFormatTexture2D
443
+ bufferType:V2TXLiveBufferTypeTexture];
444
+ [player setObserver:self];
445
+
446
+ #pragma mark - V2TXLivePlayerObserver
447
+ - (void)onRenderVideoFrame:(V2TXLiveVideoFrame *)videoFrame {
448
+ // Custom rendering
449
+ }
450
+ ```
451
+
452
+ #### enableObserveAudioFrame – Enable Audio Data Callback
453
+ ```objc
454
+ - (V2TXLiveCode)enableObserveAudioFrame:(BOOL)enable;
455
+ ```
456
+
457
+ **Parameters**:
458
+ - `enable`: Enable audio data callback (Default: NO)
459
+
460
+ **Description**: When enabled, you receive audio data via `V2TXLivePlayerObserver` for custom processing.
461
+
462
+ **Return Value**: `V2TXLiveCode`
463
+ - `V2TXLIVE_OK`: Success
464
+
465
+ **Recommended Usage**: Set before playback starts.
466
+
467
+ **Example**:
468
+ ```objc
469
+ [player enableObserveAudioFrame:YES];
470
+ [player setObserver:self];
471
+
472
+ #pragma mark - V2TXLivePlayerObserver
473
+ - (void)onPlayoutAudioFrame:(V2TXLiveAudioFrame *)audioFrame {
474
+ // Handle audio data
475
+ }
476
+ ```
477
+
478
+ #### enableReceiveSeiMessage – Enable SEI Message Reception
479
+ ```objc
480
+ - (V2TXLiveCode)enableReceiveSeiMessage:(BOOL)enable payloadType:(int)payloadType;
481
+ ```
482
+
483
+ **Parameters**:
484
+ - `enable`: YES to enable, NO to disable (Default: NO)
485
+ - `payloadType`: SEI payload type; supported values: 5, 242, 243. Must match sender's payloadType.
486
+
487
+ **Return Value**: `V2TXLiveCode`
488
+ - `V2TXLIVE_OK`: Success
489
+
490
+ **Recommended Usage**: Set before playback starts.
491
+
492
+ **Example**:
493
+ ```objc
494
+ [player enableReceiveSeiMessage:YES payloadType:5];
495
+ [player enableReceiveSeiMessage:YES payloadType:242];
496
+ [player enableReceiveSeiMessage:YES payloadType:243];
497
+ [player setObserver:self];
498
+
499
+ #pragma mark - V2TXLivePlayerObserver
500
+ - (void)onReceiveSeiMessage:(int)payloadType data:(NSData *)data {
501
+ // Handle SEI message
502
+ }
503
+ ```
504
+
505
+ #### enablePictureInPicture – Enable Picture-in-Picture (iOS Only)
506
+ ```objc
507
+ - (V2TXLiveCode)enablePictureInPicture:(BOOL)enable;
508
+ ```
509
+
510
+ **Parameters**:
511
+ - `enable`: YES to enable, NO to disable (Default: NO)
512
+
513
+ **Return Value**: `V2TXLiveCode`
514
+ - `V2TXLIVE_OK`: Success
515
+
516
+ **Recommended Usage**: No restrictions.
517
+
518
+ **Description**: Available only on iOS. Not supported on macOS.
519
+
520
+ **Example**:
521
+ ```objc
522
+ [player enablePictureInPicture:YES];
523
+ ```
524
+
525
+ #### startLocalRecording – Record Audio/Video Stream Locally
526
+ ```objc
527
+ - (V2TXLiveCode)startLocalRecording:(V2TXLiveLocalRecordingParams *)params;
528
+ ```
529
+
530
+ **Parameters**:
531
+ - `params`: See `V2TXLiveDef.h` for details
532
+
533
+ **Important Notes**:
534
+ - Recording can only begin after stream playback has started; starting recording before playback is invalid.
535
+ - Do not switch between software and hardware decoding during recording, or the output file may be corrupted.
536
+
537
+ **Return Value**: `V2TXLiveCode`
538
+ - `V2TXLIVE_OK`: Success
539
+ - `V2TXLIVE_ERROR_INVALID_PARAMETER`: Invalid parameter (e.g., empty filePath)
540
+ - `V2TXLIVE_ERROR_REFUSED`: Stream not playing, operation refused
541
+
542
+ **Recommended Usage**: Call after playback has started.
543
+
544
+ **Example**:
545
+ ```objc
546
+ [player setObserver:self];
547
+
548
+ #pragma mark - V2TXLivePlayerObserver
549
+ - (void)onLocalRecordBegin:(int)code storagePath:(NSString *)storagePath {
550
+ NSLog(@"Recording started");
551
+ }
552
+
553
+ - (void)onLocalRecording:(long)durationMs storagePath:(NSString *)storagePath {
554
+ NSLog(@"Recording..., durationMs: %ld", durationMs);
555
+ }
556
+
557
+ - (void)onLocalRecordComplete:(int)code storagePath:(NSString *)storagePath {
558
+ NSLog(@"Recording completed");
559
+ }
560
+
561
+ V2TXLiveLocalRecordingParams *params = [[V2TXLiveLocalRecordingParams alloc] init];
562
+ params.filePath = @"filepath";
563
+ params.interval = 2000;
564
+ V2TXLiveCode code = [player startLocalRecording:params];
565
+ if (code == V2TXLIVE_OK) {
566
+ NSLog(@"Recording started successfully");
567
+ } else if (code == V2TXLIVE_ERROR_INVALID_PARAMETER) {
568
+ NSLog(@"Invalid recording parameters");
569
+ } else if (code == V2TXLIVE_ERROR_REFUSED) {
570
+ NSLog(@"Recording operation refused");
571
+ }
572
+ ```
573
+
574
+ #### stopLocalRecording – Stop Local Recording
575
+ ```objc
576
+ - (void)stopLocalRecording;
577
+ ```
578
+
579
+ **Description**: If playback stops while recording is active, the SDK will automatically stop recording.
580
+
581
+ **Recommended Usage**: Call after playback and recording have started.
582
+
583
+ **Example**:
584
+ ```objc
585
+ [player stopLocalRecording];
586
+ ```
587
+
588
+ #### showDebugView – Display Player Debug Overlay
589
+ ```objc
590
+ - (void)showDebugView:(BOOL)isShow;
591
+ ```
592
+
593
+ **Parameters**:
594
+ - `isShow`: Show debug overlay (Default: NO)
595
+
596
+ **Recommended Usage**: No restrictions.
597
+
598
+ **Example**:
599
+ ```objc
600
+ [player showDebugView:YES];
601
+ ```
602
+
603
+ #### setProperty – Access Advanced Player Features
604
+ ```objc
605
+ - (V2TXLiveCode)setProperty:(NSString *)key value:(NSObject *)value;
606
+ ```
607
+
608
+ **Parameters**:
609
+ - `key`: Advanced feature key
610
+ - `value`: Value for the advanced feature
611
+
612
+ **Description**: For advanced usage. Contact your business or solution architect for details.
613
+
614
+ **Return Value**: `V2TXLiveCode`
615
+ - `V2TXLIVE_OK`: Success
616
+ - `V2TXLIVE_ERROR_INVALID_PARAMETER`: Key cannot be nil
617
+
618
+ ## Code Example
619
+
620
+ ```objc
621
+ // Create player instance
622
+ V2TXLivePlayer *player = [[V2TXLivePlayer alloc] init];
623
+
624
+ // Set callback
625
+ [player setObserver:self];
626
+
627
+ // Set rendering view
628
+ [player setRenderView:videoView];
629
+
630
+ // Start playback
631
+ V2TXLiveCode result = [player startLivePlay:@"rtmp://example.com/live/stream"];
632
+ if (result == V2TXLIVE_OK) {
633
+ // Playback successful
634
+ }
635
+
636
+ // Pause video
637
+ [player pauseVideo];
638
+
639
+ // Resume video
640
+ [player resumeVideo];
641
+
642
+ // Stop playback
643
+ [player stopPlay];
644
+ ```
645
+
646
+ ## Notes
647
+
648
+ 1. **License Requirement**: From version 10.7, you must set a valid License for playback to work.
649
+ 2. **Permission Requirement**: Network and audio playback permissions are required.
650
+ 3. **Thread Safety**: All API calls must be made on the main thread.
651
+ 4. **Memory Management**: Release player resources promptly to prevent memory leaks.
652
+ 5. **Platform Differences**: Picture-in-Picture is supported only on iOS, not on macOS.
653
+
654
+ ## Related Interfaces
655
+
656
+ - `V2TXLivePlayerObserver`: Player callback interface
657
+ - `V2TXLiveCode`: Error and status code definitions
658
+ - `V2TXLiveDef`: Data structure and enum definitions
659
+ - `V2TXLivePremier`: SDK global management interface