LiteAVSDK
Tencent Cloud TRTC SDK, is a high availability components serving tens of thousands of enterprise customers, which is committed to helping you to minimize your research and development costs.
V2TXLivePlayer

Namespaces

 liteav
 

Data Structures

class  V2TXLivePlayer
 

create or destroy V2TXLivePlayer instance

V2_API liteav::V2TXLivePlayercreateV2TXLivePlayer ()
 
V2_API void releaseV2TXLivePlayer (liteav::V2TXLivePlayer *player)
 

Detailed Description

Tencent Cloud live player.
This player pulls audio and video data from the specified livestreaming URL and plays the data after decoding and local rendering.

The player has the following capabilities:


Data Structure Documentation

◆ liteav::V2TXLivePlayer

class liteav::V2TXLivePlayer

Public Member Functions

virtual void setObserver (V2TXLivePlayerObserver *observer)=0
 
virtual int32_t setRenderView (void *view)=0
 
virtual int32_t setRenderRotation (V2TXLiveRotation rotation)=0
 
virtual int32_t setRenderFillMode (V2TXLiveFillMode mode)=0
 
virtual int32_t startPlay (const char *url)=0
 
virtual int32_t stopPlay ()=0
 
virtual int32_t isPlaying ()=0
 
virtual int32_t pauseAudio ()=0
 
virtual int32_t resumeAudio ()=0
 
virtual int32_t pauseVideo ()=0
 
virtual int32_t resumeVideo ()=0
 
virtual int32_t setPlayoutVolume (int32_t volume)=0
 
virtual int32_t setCacheParams (float minTime, float maxTime)=0
 
virtual int32_t enableVolumeEvaluation (int32_t intervalMs)=0
 
virtual int32_t snapshot ()=0
 
virtual int32_t enableObserveVideoFrame (bool enable, V2TXLivePixelFormat pixelFormat, V2TXLiveBufferType bufferType)=0
 
virtual int32_t enableReceiveSeiMessage (bool enable, int payloadType)=0
 
virtual void showDebugView (bool isShow)=0
 

Protected Member Functions

virtual ~V2TXLivePlayer ()
 

Constructor & Destructor Documentation

◆ ~V2TXLivePlayer()

virtual ~V2TXLivePlayer ( )
inlineprotectedvirtual

Calls the advanced API of V2TXLivePlayer.

Attention
This API is used to call some advanced features.
Parameters
keyKey of the advanced API.
valueParameter needed to call the advanced API corresponding to the key.
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful
  • V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed. The key cannot be nullptr.

Member Function Documentation

◆ enableObserveVideoFrame()

virtual int32_t enableObserveVideoFrame ( bool  enable,
V2TXLivePixelFormat  pixelFormat,
V2TXLiveBufferType  bufferType 
)
pure virtual

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.

Parameters
enableWhether to enable custom rendering. [Default]: false
pixelFormatVideo pixel format for custom rendering callback V2TXLivePixelFormat
bufferTypeVideo data format for custom rendering callback V2TXLiveBufferType
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful
  • V2TXLIVE_ERROR_NOT_SUPPORTED: the pixel format or data format is not supported.

◆ enableReceiveSeiMessage()

virtual int32_t enableReceiveSeiMessage ( bool  enable,
int  payloadType 
)
pure virtual

Enables the receiving of SEI messages.

Parameters
enabletrue: enable; false (default): disable
payloadTypeThe payload type of SEI messages. Valid values: 5, 242, please be consistent with the payload type of the sender
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ enableVolumeEvaluation()

virtual int32_t enableVolumeEvaluation ( int32_t  intervalMs)
pure virtual

Enables playback volume update.

After this feature is enabled, you can obtain the SDK’s volume evaluation through the V2TXLivePlayerObserver#onPlayoutVolumeUpdate(V2TXLivePlayer, int) callback.

Parameters
intervalMsInterval 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.
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ isPlaying()

virtual int32_t isPlaying ( )
pure virtual

Indicates whether the player is playing the audio and video streams.

Returns
Indicates whether the player is playing the audio and video streams.
  • 1: yes
  • 0: no

◆ pauseAudio()

virtual int32_t pauseAudio ( )
pure virtual

Pauses the audio stream of the player.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ pauseVideo()

virtual int32_t pauseVideo ( )
pure virtual

Pauses the video stream of the player.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ resumeAudio()

virtual int32_t resumeAudio ( )
pure virtual

Resumes the audio stream of the player.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ resumeVideo()

virtual int32_t resumeVideo ( )
pure virtual

Resumes the video stream of the player.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ setCacheParams()

virtual int32_t setCacheParams ( float  minTime,
float  maxTime 
)
pure virtual

Set the minimum time and maximum time (unit: s) for auto adjustment of the player cache.

Parameters
minTimeMinimum time for auto cache adjustment. The value must be greater than 0. [Default]: 1
maxTimeMaximum time for auto cache adjustment. The value must be greater than 0. [Default]: 5
Returns
Return code V2TXLiveCode
  • 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.

◆ setObserver()

virtual void setObserver ( V2TXLivePlayerObserver observer)
pure virtual

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.

Parameters
observerCallback target of the player. For more information, see V2TXLivePlayerObserver.

◆ setPlayoutVolume()

virtual int32_t setPlayoutVolume ( int32_t  volume)
pure virtual

Sets the volume.

Parameters
volumeVolume. Valid range: 0 - 100. [Default]: 100
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ setRenderFillMode()

virtual int32_t setRenderFillMode ( V2TXLiveFillMode  mode)
pure virtual

Sets the fill mode of the view.

Parameters
modeFill mode of the view V2TXLiveFillMode
  • 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.
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ setRenderRotation()

virtual int32_t setRenderRotation ( V2TXLiveRotation  rotation)
pure virtual

Sets the rotation angle of the player view.

Parameters
rotationRotation angle of the view V2TXLiveRotation
  • 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.
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ setRenderView()

virtual int32_t setRenderView ( void *  view)
pure virtual

Sets the rendering view of the player. This control is responsible for presenting the video content.

Parameters
viewPlayer rendering view.
Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

◆ showDebugView()

virtual void showDebugView ( bool  isShow)
pure virtual

Indicates whether the debug view of the player video status information is displayed.

Parameters
isShowSpecifies whether to display the debug view. [Default]: false.

◆ snapshot()

virtual int32_t snapshot ( )
pure virtual

Captures the video view in the playback process.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful
  • V2TXLIVE_ERROR_REFUSED: playback is stopped, the snapshot operation cannot be called.

◆ startPlay()

virtual int32_t startPlay ( const char *  url)
pure virtual

Starts playing the audio and video streams.

Parameters
urlURL of the audio and video streams to be played. The RTMP, HTTP-FLV and TRTC streaming protocols are supported.
Returns
Return code V2TXLiveCode
  • 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.

◆ stopPlay()

virtual int32_t stopPlay ( )
pure virtual

Stops playing the audio and video streams.

Returns
Return code V2TXLiveCode
  • V2TXLIVE_OK: successful

Function Documentation

◆ createV2TXLivePlayer()

V2_API liteav::V2TXLivePlayer* createV2TXLivePlayer ( )

Gets the V2TXLivePlayer object pointer during dynamic DLL loading.

Returns
The V2TXLivePlayer object pointer is returned. Please call releaseV2TXLivePlayer to destruct the object.
Attention
This API works on Windows, macOS, and iOS.

◆ releaseV2TXLivePlayer()

V2_API void releaseV2TXLivePlayer ( liteav::V2TXLivePlayer player)

Destructs the V2TXLivePlayer object.

Parameters
playerPointer to the V2TXLivePlayer object