Copyright (c) 2021 Tencent. All rights reserved.
Module: V2TXLivePlayer @ TXLiteAVSDK
Function: Tencent Cloud live player
Function
Tencent Cloud Live Player.
It is mainly responsible for pulling audio and video data from the specified live stream address, decoding and rendering locally.
Introduce
The player includes the following capabilities:
Support RTMP, HTTP-FLV, HLS, TRTC, WebRTC protocols.
Screen capture, you can capture the video screen of the current live stream.
Delay adjustment, you can set the minimum and maximum time for automatic adjustment of the player cache.
Customized video data processing, you can process the video data in the live stream according to the needs of the project, and then render and play it.
V2TXLivePlayer
|
| Sets the player callback |
| Sets the rendering view of the player. This control is responsible for presenting the video content |
| Sets the rendering view of the player. This control is responsible for presenting the video content |
| Sets the rendering view of the player. This control is responsible for presenting the video content |
| Sets the rotation angle of the player view |
| Sets the fill mode of the view |
| Starts playing the audio and video streams |
| Stops playing the audio and video streams |
| Indicates whether the player is playing the audio and video streams |
| Pauses the audio stream of the player |
| Resumes the audio stream of the player |
| Pauses the video stream of the player |
| Resumes the video stream of the player |
| Sets the volume |
| Set the minimum time and maximum time (unit: s) for auto adjustment of the player cache |
| Seamlessly switch live stream urls, supporting FLV and LEB protocols |
| Get Stream lnfo List |
| Enables playback volume update |
| Captures the video view in the playback process |
| Turn on/off the monitoring callback of the video frame |
| Turn on/off the monitoring callback of the audio frame |
| Enables the receiving of SEI messages |
| Indicates whether the debug view of the player video status information is displayed |
| Calls the advanced API of V2TXLivePlayer |
| Start recording audio and video stream |
| Stop recording audio and video stream |
setObserver
Sets the player callback
By setting the callback, you can listen to some callback events of V2TXLivePlayer,
including the player status, playback volume callback, first frame audio/video callback, statistics, warnings, and error messages.
setRenderView
Sets the rendering view of the player. This control is responsible for presenting the video content
|
view | Player rendering view. |
Return Desc:
V2TXLIVE_OK: successful.
setRenderView
Sets the rendering view of the player. This control is responsible for presenting the video content
|
view | Player rendering view. |
Return Desc:
V2TXLIVE_OK: successful.
setRenderView
Sets the rendering view of the player. This control is responsible for presenting the video content
|
view | Player rendering view. |
Return Desc:
V2TXLIVE_OK: successful.
setRenderRotation
Sets the rotation angle of the player view
|
rotation | V2TXLiveRotation0 Default: 0 degrees, which means the view is not rotated. V2TXLiveRotation90: rotate 90 degrees clockwise. V2TXLiveRotation180: rotate 180 degrees clockwise. V2TXLiveRotation270: rotate 270 degrees clockwise. |
Return Desc:
V2TXLIVE_OK: successful.
setRenderFillMode
Sets the fill mode of the view
|
mode | V2TXLiveFillModeFill: Default: fill the screen with the image without leaving any black edges. If the aspect ratio of the view is different from that of the screen, part of the view will be cropped. V2TXLiveFillModeFit 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. V2TXLiveFillModeScaleFill fill the screen with the stretched image, thus the length and width may not change proportionally. |
Return Desc:
V2TXLIVE_OK: successful
startLivePlay
Starts playing the audio and video streams
|
url | URL of the audio and video streams to be played. The RTMP, HTTP-FLV and TRTC streaming protocols are supported. |
Note
Starting from version 10.7, the Licence needs to be set through setLicence or setLicence before it can be played successfully, otherwise the playback will fail (black screen), and it can only be set once globally. Live Licence, UGC Licence, and Player Licence can all be used. If you have not obtained the above Licence, you can quickly apply for a beta Licence for free
To play, the official licence needs to be purchased
. Return Desc:
V2TXLIVE_OK: operation succeeded. The player starts connecting to the URL and playing the audio and video streams.
V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed. The URL is invalid.
V2TXLIVE_ERROR_REFUSED: operation failed. Duplicate streamId, please ensure that no other player or pusher is using this streamId now.
V2TXLIVE_ERROR_INVALID_LICENSE: The licence is invalid and the playback fails.
stopPlay
Stops playing the audio and video streams
Return Desc:
V2TXLIVE_OK: successful.
isPlaying
Indicates whether the player is playing the audio and video streams
Return Desc:
Indicates whether the player is playing the audio and video streams.
1: yes.
0: no.
pauseAudio
Pauses the audio stream of the player
Return Desc:
V2TXLIVE_OK: successful.
resumeAudio
Resumes the audio stream of the player
Return Desc:
V2TXLIVE_OK: successful.
pauseVideo
Pauses the video stream of the player
Return Desc:
V2TXLIVE_OK: successful.
resumeVideo
Resumes the video stream of the player
Return Desc:
V2TXLIVE_OK: successful.
setPlayoutVolume
Sets the volume
|
volume | Volume. Valid range: 0 - 100. Default: 100. |
Return Desc:
V2TXLIVE_OK: successful.
setCacheParams
Set the minimum time and maximum time (unit: s) for auto adjustment of the player cache
|
maxTime | Maximum time for auto cache adjustment. The value must be greater than 0. Default: 5. |
minTime | Minimum time for auto cache adjustment. The value must be greater than 0. Default: 1. |
Return Desc:
V2TXLIVE_OK: successful.
V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed. MinTime and maxTime must be greater than 0.
V2TXLIVE_ERROR_REFUSED: operation failed. Change of cache is not suppoted when playing.
switchStream
Seamlessly switch live stream urls, supporting FLV and LEB protocols
getStreamList
enableVolumeEvaluation
int enableVolumeEvaluation | |
Enables playback volume update
After this feature is enabled, you can obtain the SDK’s volume evaluation through the onPlayoutVolumeUpdate callback. |
intervalMs | Interval for triggering the volume callback. The unit is ms. The minimum interval is 100 ms. If the value is equal to or smaller than 0, the callback is disabled. We recommend that you set this parameter to 300 ms. Default: 0. |
Return Desc:
V2TXLIVE_OK: successful.
snapshot
Captures the video view in the playback process
Return Desc:
V2TXLIVE_OK: successful.
V2TXLIVE_ERROR_REFUSED: playback is stopped, the snapshot operation cannot be called.
enableObserveVideoFrame
int enableObserveVideoFrame | |
| |
| |
Turn on/off the monitoring callback of the video frame
The SDK will no longer render the video after you turn on this switch. You can get the video frame through V2TXLivePlayerObserver and execute custom rendering logic.
|
bufferType | |
enable | Whether to enable custom rendering. Default: false. |
pixelFormat | |
Return Desc:
V2TXLIVE_OK: successful.
V2TXLIVE_ERROR_NOT_SUPPORTED: the pixel format or data format is not supported.
enableObserveAudioFrame
int enableObserveAudioFrame | |
Turn on/off the monitoring callback of the audio frame
if you turn on this switch, You can get the audio frame through V2TXLivePlayerObserver and execute custom logic.
|
enable | Whether to enable the callback of the audio frame. Default: false. |
Return Desc:
V2TXLIVE_OK: successful.
enableReceiveSeiMessage
int enableReceiveSeiMessage | |
| |
Enables the receiving of SEI messages
|
enable | true : enable; false (default): disable.
|
payloadType | The payload type of SEI messages. Valid values: 5 , 242 , 243 , please be consistent with the payload type of the sender. |
Return Desc:
V2TXLIVE_OK: successful.
showDebugView
Indicates whether the debug view of the player video status information is displayed
|
isShow | Specifies whether to display the debug view. Default: false. |
setProperty
Calls the advanced API of V2TXLivePlayer
|
key | Key of the advanced API. |
value | Parameter needed to call the advanced API corresponding to the key. |
Note
This API is used to call some advanced features.
Return Desc:
V2TXLIVE_OK: successful.
V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed. The key cannot be null.
startLocalRecording
Start recording audio and video stream
Note
The recording can only be started after the play stream is started, and it is invalid to start the recording in the non-play state.
Do not dynamically switch soft/hard decoding during the recording process, as there is a high probability that the generated video will be abnormal.
Return Desc:
V2TXLIVE_OK
: successful.
V2TXLIVE_ERROR_INVALID_PARAMETER
: The parameter is invalid, such as filePath is empty.
V2TXLIVE_ERROR_REFUSED
: API refuse, you must first call startLivePlay to start playing streaming.
stopLocalRecording
Stop recording audio and video stream
Note
When the play stream is stopped, if the video is still being recorded, the SDK will automatically end the recording.
Was this page helpful?