tencent cloud

Feedback

V2TXLivePlayer

Last updated: 2024-10-25 16:52:53
    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

    V2TXLivePlayer

    FuncList
    DESC
    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

    setObserver
    void setObserver
    (V2TXLivePlayerObserver observer)

    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.
    Param
    DESC
    observer
    Callback target of the player. For more information, see V2TXLivePlayerObserver.

    setRenderView

    setRenderView
    int setRenderView
    (TXCloudVideoView view)

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

    Param
    DESC
    view
    Player rendering view.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setRenderView

    setRenderView
    int setRenderView
    (TextureView view)

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

    Param
    DESC
    view
    Player rendering view.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setRenderView

    setRenderView
    int setRenderView
    (SurfaceView view)

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

    Param
    DESC
    view
    Player rendering view.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setRenderRotation

    setRenderRotation
    int setRenderRotation
    (V2TXLiveRotation rotation)

    Sets the rotation angle of the player view

    Param
    DESC
    rotation
    Rotation 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.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setRenderFillMode

    setRenderFillMode
    int setRenderFillMode
    (V2TXLiveFillMode mode)

    Sets the fill mode of the view

    Param
    DESC
    mode
    Fill 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.
    V2TXLiveFillModeScaleFill fill the screen with the stretched image, thus the length and width may not change proportionally.

    Return Desc:

    Return code V2TXLiveCode
    V2TXLIVE_OK: successful

    startLivePlay

    startLivePlay
    int startLivePlay
    (String url)

    Starts playing the audio and video streams

    Param
    DESC
    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:

    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.
    V2TXLIVE_ERROR_INVALID_LICENSE: The licence is invalid and the playback fails.

    stopPlay

    stopPlay

    Stops playing the audio and video streams

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    isPlaying

    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

    pauseAudio

    Pauses the audio stream of the player

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    resumeAudio

    resumeAudio

    Resumes the audio stream of the player

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    pauseVideo

    pauseVideo

    Pauses the video stream of the player

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    resumeVideo

    resumeVideo

    Resumes the video stream of the player

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setPlayoutVolume

    setPlayoutVolume
    int setPlayoutVolume
    (int volume)

    Sets the volume

    Param
    DESC
    volume
    Volume. Valid range: 0 - 100. Default: 100.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    setCacheParams

    setCacheParams
    int setCacheParams
    (float minTime
    
    float maxTime)

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

    Param
    DESC
    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:

    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.

    switchStream

    switchStream
    int switchStream
    (String newUrl)

    Seamlessly switch live stream urls, supporting FLV and LEB protocols

    Param
    DESC
    newUrl
    New pull address.

    getStreamList

    getStreamList

    Get Stream lnfo List

    enableVolumeEvaluation

    enableVolumeEvaluation
    int enableVolumeEvaluation
    (int intervalMs)

    Enables playback volume update

    After this feature is enabled, you can obtain the SDK’s volume evaluation through the onPlayoutVolumeUpdate callback.
    Param
    DESC
    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:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    snapshot

    snapshot

    Captures the video view in the playback process

    Return Desc:

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

    enableObserveVideoFrame

    enableObserveVideoFrame
    int enableObserveVideoFrame
    (boolean enable
    
    V2TXLivePixelFormat pixelFormat
    
    V2TXLiveBufferType bufferType)

    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.
    Param
    DESC
    bufferType
    Video data format for custom rendering callback V2TXLiveBufferType
    enable
    Whether to enable custom rendering. Default: false.
    pixelFormat
    Video pixel format for custom rendering callback V2TXLivePixelFormat

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.
    V2TXLIVE_ERROR_NOT_SUPPORTED: the pixel format or data format is not supported.

    enableObserveAudioFrame

    enableObserveAudioFrame
    int enableObserveAudioFrame
    (boolean enable)

    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.
    Param
    DESC
    enable
    Whether to enable the callback of the audio frame. Default: false.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    enableReceiveSeiMessage

    enableReceiveSeiMessage
    int enableReceiveSeiMessage
    (boolean enable
    
    int payloadType)

    Enables the receiving of SEI messages

    Param
    DESC
    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:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.

    showDebugView

    showDebugView
    void showDebugView
    (boolean isShow)

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

    Param
    DESC
    isShow
    Specifies whether to display the debug view. Default: false.

    setProperty

    setProperty
    int setProperty
    (String key
    
    Object value)

    Calls the advanced API of V2TXLivePlayer

    Param
    DESC
    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:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.
    V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed. The key cannot be null.

    startLocalRecording

    startLocalRecording
    int 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:

    Return code for V2TXLiveCode.
    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

    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.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support