V2TXLivePlayer
, including player status, playback volume, first audio/video frame, statistics, warning and error messages, etc.void addListener(V2TXLivePlayerObserver func)
Parameter | Type | Description |
observer | V2TXLivePlayerObserver |
Future<V2TXLiveCode> setRenderViewID(int viewID)
Parameter | Type | Description |
viewID | int | The rendering view ID, which is returned by V2TXLiveVideoWidget.onViewCreated . |
V2TXLIVE_OK
: SuccessfulFuture<V2TXLiveCode> 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 to use the feature.Parameter | Type | Description |
url | String | The playback URL, 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.Future<V2TXLiveCode> stopPlay()
V2TXLIVE_OK
: successfulFuture<int> isPlaying()
1
: yes0
: noFuture<V2TXLiveCode> setRenderRotation(V2TXLiveRotation rotation)
Parameter | Type | Description |
rotation | The degrees by which images are rotated. Default value: 0. |
V2TXLIVE_OK
: SuccessfulV2TXLiveRotation
enumerated valuesValue | Description |
v2TXLiveRotation0 | No rotation |
v2TXLiveRotation90 | Rotate 90 degrees clockwise |
v2TXLiveRotation180 | Rotate 180 degrees clockwise |
v2TXLiveRotation270 | Rotate 270 degrees clockwise |
Future<V2TXLiveCode> 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. |
Future<V2TXLiveCode> pauseVideo()
V2TXLIVE_OK
: SuccessfulFuture<V2TXLiveCode> resumeVideo()
V2TXLIVE_OK
: SuccessfulV2TXLIVE_OK
is returned, you can get the screenshot taken in the V2TXLivePlayerObserver.onSnapshotComplete
callback.Future<V2TXLiveCode> snapshot()
V2TXLIVE_OK
: SuccessfulV2TXLIVE_ERROR_REFUSED
: Failed to take a screenshot because playback has stopped.Future<V2TXLiveCode> pauseAudio()
V2TXLIVE_OK
: SuccessfulFuture<V2TXLiveCode> resumeAudio()
V2TXLIVE_OK
: SuccessfulFuture<V2TXLiveCode> setPlayoutVolume(int volume)
Parameter | Type | Description |
volume | int | The volume. Value range: 0-100. Default value: 100 . |
V2TXLIVE_OK
: SuccessfulV2TXLivePlayerObserver.onPlayoutVolumeUpdate
callback.Future<V2TXLiveCode> enableVolumeEvaluation(int intervalMs)
Parameter | Type | Description |
intervalMs | int | The 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
: SuccessfulFuture<V2TXLiveCode> setCacheParams(double minTime, double maxTime)
Parameter | Type | Description |
minTime | double | The minimum cache time for auto adjustment by the player. The value must be greater than 0 . Default value: 1 . |
maxTime | double | 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.Future<void> showDebugView(bool isShow)
Parameter | Type | Description |
isShow | bool | Whether to show the debug view. Default value: false . |
Was this page helpful?