Feature
/// This player pulls audio and video data from the specified live streaming URL and plays the data after decoding and local rendering.
Overview
/// The player has the following capabilities:
/// - View capturing, which allows you to capture the video images of the current live stream.
/// - Delay adjustment, which allows you to set the minimum time and maximum time for auto adjustment of the player cache.
/// - Custom video data processing, which allows you to perform rendering and play video data after processing video data in the live stream based on the project requirements.
- (void)setObserver:(id<TXLivePlayerObserver>)observer;
Parameter | Type | Description |
---|
- (V2TXLiveCode)setRenderView:(TXView *)view;
Parameter | Type | Description |
---|
V2TXLiveCode:
V2TXLIVE_OK
: successfulThis API is used to stop playing back audio/video streams.
- (TXLiveCode)startPlay:(NSString *)url;
Parameter | Type | Description |
---|
V2TXLiveCode:
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_INVALID_PARAMETER
: failed to publish streams because the URL is invalid.V2TXLIVE_ERROR_REFUSED
: you cannot use the same stream ID for push and pull on the same device.This API is used to stop playing back audio/video streams.
- (TXLiveCode)stopPlay;
V2TXLiveCode:
V2TXLIVE_OK
: successful- (int)isPlaying;
Whether streams are being published
- 1: yes
- 0: no
- (V2TXLiveCode)setRenderRotation:(V2TXLiveRotation)rotation;
Parameter | Type | Description |
---|---|---|
rotation | V2TXLiveRotation | Degrees by which the image is rotated. Default value: V2TXLiveRotation0 |
V2TXLiveCode:
V2TXLIVE_OK
: successfulV2TXLiveRotation
enumerated valuesValue | Description |
---|---|
V2TXLiveRotation0 | No rotation |
V2TXLiveRotation90 | Rotate 90 degrees clockwise |
V2TXLiveRotation180 | Rotate 180 degrees clockwise |
V2TXLiveRotation270 | Rotate 270 degrees clockwise |
- (TXLiveCode)setRenderFillMode:(TXLiveFillMode)mode;
Parameter | Type | Description |
---|
V2TXLiveCode:
V2TXLIVE_OK
: successful| -------------------- | ------------------------------------------------------------ |
| TXLiveFillMode_Fit | Make the view fit the screen without cropping. If the aspect ratio of the view is different from that of the screen, black edges will appear |
| TXLiveFillMode_Fill | Fill the image on the screen without leaving any black edges. If the aspect ratio of the view is different from that of the screen, part of the view content will be cropped |
- (TXLiveCode)pauseVideo;
V2TXLiveCode:
V2TXLIVE_OK
: successful- (TXLiveCode)resumeVideo;
V2TXLiveCode:
V2TXLIVE_OK
: successfulNote:After
V2TXLIVE_OK
is returned, you can get the screenshot taken in theV2TXLivePusherObserver.onSnapshotComplete
callback.
- (V2TXLiveCode)snapshot;
V2TXLiveCode:
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_REFUSED
: failed to take a screenshot because publishing has stoppedThis API is used to set custom rendering for local video.
Using this method, you can obtain every frame of the video view after decoding, perform custom rendering, and add custom display effects.
- (V2TXLiveCode)enableCustomVideoCapture:(BOOL)enable;
| pixelFormat | [V2TXLivePixelFormat](#V2TXLivePixelFormat) | Pixel format of video frames |
bufferType:(TXLiveBufferType)bufferType
Parameter | Type | Description |
---|---|---|
enable | BOOL | Whether to enable small image encoding. Default value: NO. |
V2TXLiveCode:
V2TXLIVE_OK
: successful - TXLIVE_ERROR_NOT_SUPPORTED: the pixel format or data format is not supported.
V2TXLivePixelFormat
enumerated valuesValue | Description |
---|---|
V2TXLivePixelFormatUnknown | Unknown |
V2TXLivePixelFormatI420 | YUV420P/I420 |
| V2TXLivePixelFormatTexture2D | OpenGL 2D texture |
V2TXLiveBufferType
enumerated values| ----------------------------- | ------------------------------------------------------------ |
| TRTCVideoBufferType_PixelBuffer | It is most efficient when used directly. The iOS system provides various APIs to get or process PixelBuffer
.|
/// The performance may be compromised. As the SDK processes PixelBuffer directly, switching between NSData and PixelBuffer will result in memory copying overhead.
- (TXLiveCode)pauseAudio;
V2TXLiveCode:
V2TXLIVE_OK
: successful- (TXLiveCode)resumeAudio;
V2TXLiveCode:
V2TXLIVE_OK
: successfulThis API is used to set volume.
- (TXLiveCode)setPlayoutVolume:(NSUInteger)volume;
Parameter | Type | Description |
---|
V2TXLiveCode:
V2TXLIVE_OK
: successfulThis API is used to enable the volume reminder.
After this feature is enabled, you can obtain the SDK’s volume evaluation through the [onPlayoutVolumeUpdate](@ref TXLivePlayerObserver#onPlayoutVolumeUpdate:volume:) callback.
- (V2TXLiveCode)enableVolumeEvaluation:(NSUInteger)intervalMs;
Parameter | Type | Description |
---|---|---|
intervalMs | int | Interval (ms) for volume callbacks. The minimum interval allowed is 100 ms. If the value is 0 (default) or smaller, the callback is disabled. 300 is recommended. |
V2TXLiveCode:
V2TXLIVE_OK
: successful- (TXLiveCode)setCacheParams:(CGFloat)minTime maxTime:(CGFloat)maxTime;
Parameter | Type | Description |
---|
V2TXLiveCode:
V2TXLIVE_OK
: successful - TXLIVE_ERROR_INVALID_PARAMETER: operation failed. minTime and maxTime must be greater than 0.
- (void)showDebugView:(BOOL)isShow;
Parameter | Type | Description |
---|
Was this page helpful?