V2TXLivePlayer
, including player status, playback volume, first audio/video frame, statistics, and warning and error messages.public abstract void setObserver(V2TXLivePlayerObserver observer);
Parameter | Type | Description |
observer | V2TXLivePlayerObserver |
public abstract int setRenderView(TXCloudVideoView view);
Parameter | Type | Description |
view | TXCloudVideoView | The player’s rendering view |
V2TXLIVE_OK
: successfulpublic abstract int setRenderView(SurfaceView view);
Parameter | Type | Description |
view | SurfaceView | The player’s rendering view |
V2TXLIVE_OK
: successfulpublic abstract int setRenderView(TextureView view);
Parameter | Type | Description |
view | TextureView | The player’s rendering view |
V2TXLIVE_OK
: successfulpublic abstract int startLivePlay(String url);
startPlay
has been replaced by startLivePlay
, and you need to call V2TXLivePremier#setLicence
or TXLiveBase#setLicence
to set the license to use the live playback feature (you only need to set the license once). Otherwise, playback will fail (black screen). You can use a live stream publishing license, UGSV license, or video playback license to activate the live playback feature. If you don’t have any of the licenses, you can buy one or apply for a trial license for free.Parameter | Type | Description |
url | String | Playback URL of audio/video streams, which supports RTMP, HTTP-FLV, TRTC, and WebRTC |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_INVALID_PARAMETER
: operation failed because the URL is invalid.V2TXLIVE_ERROR_REFUSED
: RTC does not support using the same stream ID for publishing and playback on the same device.public abstract int stopPlay();
V2TXLIVE_OK
: successfulpublic abstract int isPlaying();
1
: yes0
: nopublic abstract int setRenderRotation(V2TXLiveRotation rotation);
Parameter | Type | Description |
rotation | The degrees by which the image is rotated. Default value: V2TXLiveRotation0 . |
V2TXLIVE_OK
: successfulV2TXLiveRotation
enumerated valuesValue | Description |
V2TXLiveRotation0 | No rotation |
V2TXLiveRotation90 | Rotate 90 degrees clockwise |
V2TXLiveRotation180 | Rotate 180 degrees clockwise |
V2TXLiveRotation270 | Rotate 270 degrees clockwise |
public abstract int setRenderFillMode(V2TXLiveFillMode mode);
Parameter | Type | Description |
mode | The image fill mode. Default value: V2TXLiveFillModeFit . |
V2TXLIVE_OK
: successfulV2TXLiveFillMode
enumerated valuesValue | Description |
V2TXLiveFillModeFit | The image fits the screen without cropping. If the aspect ratio of the image and the screen do not match, there will be black bars. |
V2TXLiveFillModeFill | The image fills the entire screen, without black bars. If the aspect ratio of the image and screen do not match, the parts of the image that don’t fit will be cropped. |
public abstract int pauseVideo();
V2TXLIVE_OK
: successfulpublic abstract int resumeVideo();
V2TXLIVE_OK
: successfulV2TXLIVE_OK
is returned, you can get the screenshot taken in the V2TXLivePlayerObserver.onSnapshotComplete
callback.public abstract int snapshot();
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_REFUSED
: failed to take a screenshot because playback has stopped.V2TXLivePlayerObserver.onRenderVideoFrame
callback.public abstract int enableObserveVideoFrame(boolean enable,V2TXLivePixelFormat pixelFormat,V2TXLiveBufferType bufferType);
Parameter | Type | Description |
enable | Boolean | Whether to enable custom rendering. Default value: false . |
pixelFormat | Pixel format of the video called back for custom rendering | |
bufferType | Buffer type of the video called back for custom rendering |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_NOT_SUPPORTED
: unsupported pixel format or data format.V2TXLivePixelFormat
enumerated valuesValue | Description |
V2TXLivePixelFormatUnknown | Unknown |
V2TXLivePixelFormatI420 | YUV420P (I420) |
V2TXLivePixelFormatTexture2D | OpenGL 2D texture |
V2TXLiveBufferType
enumerated valuesValue | Description |
V2TXLiveBufferTypeUnknown | Unknown |
V2TXLiveBufferTypeByteBuffer | Direct buffers. This type is for I420 and other buffers and is used at the native layer. |
V2TXLiveBufferTypeByteArray | Byte arrays. This type is for I420 and other buffers and is used at the Java layer. |
V2TXLiveBufferTypeTexture | Texture ID, which allows direct operation. It delivers the best performance and has the smallest impact on video quality. |
public abstract int pauseAudio();
V2TXLIVE_OK
: successfulpublic abstract int resumeAudio();
V2TXLIVE_OK
: successfulpublic abstract int setPlayoutVolume(int volume);
Parameter | Type | Description |
volume | int | Volume. Value range: 0-100. Default value: 100 . |
V2TXLIVE_OK
: successfulV2TXLivePlayerObserver.onPlayoutVolumeUpdate
callback.public abstract int enableVolumeEvaluation(int intervalMs);
Parameter | Type | Description |
intervalMs | int | Interval (ms) for triggering the onPlayoutVolumeUpdate callback. The minimum interval allowed is 100 ms. If the value is 0 (default) or smaller, the callback is disabled. 300 is recommended. |
V2TXLIVE_OK
: successfulpublic abstract int setCacheParams(float minTime, float maxTime);
Parameter | Type | Description |
minTime | float | The minimum cache time for auto adjustment by the player. The value must be greater than 0 . Default value: 1 |
maxTime | float | The maximum cache time for auto adjustment by the player. The value must be greater than 0 . Default value: 5 |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_INVALID_PARAMETER
: operation failed. minTime
and maxTime
must be greater than 0
.V2TXLIVE_ERROR_REFUSED
: you cannot change the cache policy while streams are being played.public abstract void showDebugView(boolean isShow);
Parameter | Type | Description |
isShow | boolean | Whether to show the debug view. Default value: NO . |
Was this page helpful?