tencent cloud

フィードバック

最終更新日:2024-04-11 16:11:38

    TXVodPlayer

    VOD player

    See TXVodPlayer. The player pulls audio/video data from the specified VOD stream URL and plays the data after decoding and local rendering. The player has the following capabilities:
    Play FLV, MP4, and HLS files by URL (general playback) or by file ID (VOD playback).
    Take screenshots of the video stream.
    Adjust the brightness, volume level, and playback progress using gestures.
    Change the resolution manually or select a resolution automatically according to current network bandwidth.
    Change the playback speed, flip the video, and use hardware decoding for acceleration.
    For more information on the capabilities of the player, see Video Playback Overview.

    Player configuration APIs

    API
    Description
    Sets the player configuration information. For more information on the configuration, see TXVodPlayConfig.
    Sets the player’s rendering view TXCloudVideoView.
    Sets the player’s rendering view TextureView.
    Sets the player’s rendering view SurfaceView.
    Sets the player business parameters in the format of <String,Object>.
    Sets the subtitle style information and can update the subtitle style after playback (only supported in the advanced version of the player).
    Sets the subtitle software decoding target object (only supported in the advanced version of the player).
    setAudioNormalization
    Setting volume normalization, loudness range: -70 to 0 (LUFS). Supported from player version 11.7 of the premium version. You can set the volume normalization to preset values or custom values. The preset values are defined in the related classes or files, such asTXVodConstants for Android and TXVodPlayConfig.hfor iOS: Off: AUDIO_NORMALIZATION_OFF
    On: AUDIO_NORMALIZATION_STANDARD (standard) AUDIO_NORMALIZATION_LOW (low) AUDIO_NORMALIZATION_HIGH (high) Custom values can be set in the range of -70 to 0 LUFS, from low to high.

    Basic playback APIs

    API
    Description
    Plays a video from an HTTP URL. Since v10.7, startPlay has been replaced by startVodPlay, and you need to call V2TXLivePremier#setLicence or TXLiveBase#setLicence to set the license in order to use the 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 playback feature.
    Plays a video by VOD file ID. Since v10.7, startPlay has been replaced by startVodPlay, and you need to call V2TXLivePremier#setLicence or TXLiveBase#setLicence to set the license in order to use the 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 playback feature.
    Stops playback.
    Gets whether playback is ongoing.
    Pauses playback. The player will stop pulling data and freeze on the last frame.
    Resumes playback. The player will resume pulling data.
    Seeks to a specified time point of the video stream (in seconds).
    Seeks to a specified time point of the video stream (in ms).
    Gets the current playback time point in seconds.
    Gets the total buffer duration in seconds.
    Gets the total video duration in seconds.
    Gets the playable video duration in seconds.
    Gets the video width.
    Gets the video height.
    Sets whether to start playback automatically after startVodPlay is called. Auto-play is on by default.
    Sets the playback start time.
    Sets the token for HLS encryption.
    Sets whether to loop the video.
    Gets whether playback is looped.
    Adds external subtitles (only supported in the advanced version of the player).
    Returns a list of subtitle track information (only supported in the advanced version of the player).
    Returns a list of audio track information (only supported in the advanced version of the player).
    Selects a track (only supported in the advanced version of the player).
    Deselects a track (only supported in the advanced version of the player).
    seekToPdtTime
    Seek to the specified Program Date Time (PDT) point in the video stream, which enables functions such as fast-forward, rewind, and progress bar jumping. Currently, only HLS video format is supported. This function is supported starting from version 11.6 of the player's advanced edition. The parameter unit is milliseconds (ms).

    Video APIs

    API
    Description
    Enables/Disables video hardware decoding.
    Gets the current video frame image.
    Note: Because this operation is time-consuming, the screenshot will be called back asynchronously.
    Sets whether to flip the video image horizontally.
    Sets the VOD playback speed. Default value: 1.0.
    Returns the current playback bitrate index.
    Sets the current playback bitrate index for seamless definition switch. You may need to wait momentarily to switch the definition.
    Sets the image fill mode.
    Sets the rotation.

    Audio APIs

    API
    Description
    Sets whether to mute the player.
    Sets the volume level. Value range: 0–100.
    Sets whether to get the audio focus automatically. The audio focus is gotten automatically by default.

    Event notification APIs

    API
    Description
    Sets player callbacks. This API has been deprecated. Please use setVodListener instead.
    Sets player callbacks.

    TRTC APIs

    You can use the following APIs to push the audio/video streams of the VOD player through TRTC. For more information on TRTC services, see the TRTC Overview page.
    API
    Description
    Binds VOD to TRTC.
    Unbinds VOD from TRTC.
    Starts pushing the video stream.
    Cancels pushing the video stream.
    Starts pushing the audio stream.
    Cancels pushing the audio stream.

    ITXVodPlayListener

    VOD callback notifications.

    Basic SDK callback APIs

    API
    Description
    VOD playback event notification. For more information, see the playback event list and event parameters.
    Network status notification of the VOD player.

    TXVodPlayConfig

    VOD player configuration class.

    Basic configuration APIs

    API
    Description
    Sets the maximum number of player reconnection attempts.
    Sets the player reconnection interval in seconds.
    Sets the player connection timeout period in seconds.
    Sets the VOD cache directory, which takes effect for MP4 and HLS files.
    Sets the maximum number of cached files. This API has been deprecated. Use TXPlayerGlobalSetting#setMaxCacheSize for global configuration.
    Sets the player type.
    TXVodConstants#PLAYER_SYSTEM_MEDIA_PLAYER: Use the system's built-in player.
    TXVodConstants#PLAYER_THUMB_PLAYER: Use Tencent Cloud's self-developed player.
    Sets custom HTTP headers.
    Sets whether to enable accurate seek. Default value: true.
    Sets whether to enable auto rotation. If the parameter is set to YES (default), MP4 files will be automatically rotated. You can get the rotation angle from the PLAY_EVT_CHANGE_ROTATION callback.
    Sets whether to enable smooth switching for multi-bitrate HLS streams. Default value: false.
    Sets the extension for cached MP4 files.
    Sets the progress callback interval in ms.
    Sets the maximum buffer size in MB.
    Set the maximum buffer size for preloading, in MB.
    Set extended information.
    When playing HLS with multiple streams, select the optimal stream for playback based on the set preferredResolution, which is the product of the width and height (width * height). This setting takes effect before playback.
    Set the encryption and decryption key for HLS security reinforcement.
    Set the encryption and decryption IV for HLS security reinforcement.
    Enable or disable loading and rendering post-processing services.
    Set the media type, with AUTO as the default value. Optional values are:
    TXVodConstants#MEDIA_TYPE_AUTO, AUTO type (default value, adaptive bit rate playback is not supported for now); TXVodConstants#MEDIA_TYPE_HLS_VOD, HLS VOD media;
    TXVodConstants#MEDIA_TYPE_HLS_LIVE, HLS live media;
    TXVodConstants#MEDIA_TYPE_HLS_VOD, MP4 and other common file VOD media (supported starting from version 11.2); TXVodConstants#MEDIA_TYPE_DASH_VOD, DASH VOD media (supported starting from version 11.2);

    TXPlayerGlobalSetting

    Global configuration of the VOD player.
    API
    Description
    Sets the cache directory of the playback engine. After setting, this directory will be first read and written during downloading, predownloading, and player use.
    Sets the playback engine’s maximum cache size in MB. The cache directory will be cleared automatically if its size exceeds the specified value.
    setDrmProvisionEnv
    Set the Drm certificate provider environment (supported starting from version 11.2). Optional values are: TXPlayerGlobalSetting.DrmProvisionEnv#DRM_PROVISION_ENV_COM, which represents the use of the Google COM domain name certificate provider;
    TXPlayerGlobalSetting.DrmProvisionEnv#DRM_PROVISION_ENV_CN, which represents the use of the Google CN domain name certificate provider;

    TXVodPreloadManager

    Predownloading API class of the VOD player.
    API
    Description
    Gets a singleton object ofTXVodPreloadManager.
    Starts predownloading. Before you call this API, make sure you have called TXPlayerGlobalSetting#setCacheFolderPath and TXPlayerGlobalSetting#setMaxCacheSize to set the cache directory and maximum cache size.
    Stops predownloading.

    ITXVodPreloadListener

    Video pre-download callback interface.
    API
    Description
    Video pre-download is complete.
    onError
    Video pre-download encountered an error.

    TXVodDownloadManager

    Video download API class of the VOD player. Currently, only non-nested M3U8 videos can be downloaded. SimpleAES-encrypted videos will be encrypted again with Tencent Cloud's private encryption algorithm to improve the security.
    API
    Description
    Gets a singleton object of TXVodDownloadManager.
    Sets download HTTP headers.
    Sets the download callback. This API must be called before the download.
    Starts downloading the video at the specified URL.
    Starts downloading the video of the specified fileid.
    Stops the download. If ITXVodDownloadListener.onDownloadStop is called back, the download stops successfully.
    Deletes the download information.
    Gets the download lists of all users.
    Gets the download information.

    ITXVodDownloadListener

    VOD download callbacks.
    API
    Description
    Download started.
    The download progress was updated.
    Download stopped.
    Download ended.
    An error occurred during download.
    When downloading HLS, if an encrypted file is encountered, the decryption key is passed to the external party for verification.

    TXVodDownloadDataSource

    Tencent Cloud download source (fileid) APIs. You need to pass in the source information when starting download.
    API
    Description
    Builds a function to pass in parameters such as appid, fileid, quality, psign, and username.
    getAppId
    Gets the appid that is passed in.
    getFileId
    Gets the fileid that is passed in.
    getPSign
    Gets the psign that is passed in.
    Gets the quality that is passed in.
    Gets the userName that is passed in, which is default by default.

    Video quality constants

    Description
    TXVodQuality240P ~ TXVodQuality1080p constants were added in version 11.0.
    code
    Constant Definition
    Description
    0
    Original quality
    1
    Smooth quality
    2
    Standard definition
    3
    High definition
    4
    Full high definition
    5
    2K
    6
    4K
    1000
    Undefined quality
    240
    TXVodQuality240P
    Smooth 240P
    360
    TXVodQuality360P
    Smooth 360P
    480
    TXVodQuality480P
    Standard definition 480P
    540
    TXVodQuality540P
    Standard definition 540P
    720
    TXVodQuality720P
    High definition 720P
    1080
    TXVodQuality1080p
    Full high definition 1080P

    TXVodDownloadMediaInfo

    Tencent Cloud download information APIs, which can be used to get the download progress, playback URL, and more.
    API
    Description
    Gets the source specified by the fileid passed in for download.
    Gets the total duration of the video.
    Gets the downloaded (playable) duration of the video.
    getSize
    Gets the total size of the file being downloaded. This API takes effect only for download by fileid.
    Gets the size of the data already downloaded. This API takes effect only for download by fileid.
    Gets the current download progress.
    Gets the current playback path, which can be passed in to TXVodPlayer for playback.
    Gets the download status.
    Gets whether the download is completed.
    getSpeed
    Get download speed, in KBytes/second. (Supported starting from version 10.9)
    isResourceBroken
    Determine whether the downloaded video resource is damaged. If the downloaded file is deleted, etc., true will be returned. (Supported starting from version 11.0)

    Static Properties

    Code
    Property Definition
    Description
    0
    STATE_INIT
    Initial state of download
    1
    STATE_START
    Download started
    2
    STATE_STOP
    Download stopped
    3
    STATE_ERROR
    Download error
    4
    STATE_FINISH
    Download completed

    TXPlayerAuthBuilder

    Configuration for playing encrypted videos using fileId.
    API
    Description
    setAppId
    Application appId.
    setFileId
    File id.
    Timeout for encrypted links.
    setExper
    Trial duration.
    setUs
    Unique identifier for the request.
    setSign
    Anti-leech signature.
    setHttps
    Whether to use HTTPS for the request.

    TXBitrateItem

    Video bitrate information.
    API
    Description
    index
    Sequence number in the m3u8 file.
    width
    Video width of this stream.
    height
    Video height of this stream.
    bitrate
    Video bitrate of this stream.
    compareTo
    Compare whether the bitrates of two streams are equal.

    TXImageSprite

    Sprite image parsing class.
    API
    Description
    Constructor.
    Set the sprite image address.
    Get the thumbnail.
    release
    Call this method when finished to avoid memory leaks.

    TXPlayerDrmBuilder

    DRM playback information.
    API
    Description
    Construct the DRM playback information object.
    Set the certificate provider URL.
    Set the decryption key URL.
    Set the URL for playing media.

    TXPlayInfoParams

    Video playback parameter information using fileId.
    API
    Description
    Constructor.
    getAppId
    Get the application ID.
    getFileId
    Get the file ID.
    getPSign
    Get the Tencent Cloud video encryption signature.

    Error Codes

    Normal events

    Code
    Event Definition
    Description
    2004
    PLAY_EVT_PLAY_BEGIN
    Video playback started, and the loading icon animation (if any) ended.
    2005
    PLAY_EVT_PLAY_PROGRESS
    The video playback progress (including the current playback progress, the loaded duration, and the total video duration).
    2007
    PLAY_EVT_PLAY_LOADING
    The video is being loaded. The LOADING_END event will be reported if video playback resumes.
    2014
    PLAY_EVT_VOD_LOADING_END
    Video loading ended, and video playback resumed.
    2006
    PLAY_EVT_PLAY_END
    Video playback ended.
    2013
    PLAY_EVT_VOD_PLAY_PREPARED
    The player is ready.
    2003
    PLAY_EVT_RCV_FIRST_I_FRAME
    The first renderable video data packet (IDR) was received.
    2009
    PLAY_EVT_CHANGE_RESOLUTION
    The video resolution changed.
    2011
    PLAY_EVT_CHANGE_ROTATION
    The MP4 video was rotated.

    Warnings

    Code
    Event Definition
    Description
    -2301
    PLAY_ERR_NET_DISCONNECT
    The network was disconnected and could not be reconnected after multiple retries. You can restart the player to perform more connection retries.
    -2305
    PLAY_ERR_HLS_KEY
    Failed to get the HLS decryption key.
    2101
    PLAY_WARNING_VIDEO_DECODE_FAIL
    Failed to decode the current video frame.
    2102
    PLAY_WARNING_AUDIO_DECODE_FAIL
    Failed to decode the current audio frame.
    2103
    PLAY_WARNING_RECONNECT
    The player was disconnected and is trying to reconnect. The PLAY_ERR_NET_DISCONNECT event will be thrown after three failed attempts.
    2106
    PLAY_WARNING_HW_ACCELERATION_FAIL
    Failed to start the hardware decoder, and the software decoder was used instead.
    -2304
    PLAY_ERR_HEVC_DECODE_FAIL
    H.265 decoding failed.
    -2303
    PLAY_ERR_FILE_NOT_FOUND
    The file to be played back does not exist.

    Constants in the player SDK

    The following constants have been available since version 10.0 via TXVodConstants:

    Image tiling modes

    code
    Event definitions
    Description
    0
    Full screen display of video.
    1
    Adaptive display of video on screen.

    Image rendering angles

    code
    Event Definition
    Description
    0
    Normal portrait.
    270
    Rotated 90 degrees to the right.

    List of playback events

    code
    Event Definition
    Description
    2003
    The network has received the first video data packet (IDR).
    2004
    Video playback has started.
    2005
    Video playback progress.
    2006
    Video playback has ended.
    2007
    Video playback is loading.
    2008
    The decoder has started.
    2009
    Video resolution has changed.
    2010
    Successfully obtained information about the VOD file.
    2011
    Video rotation information.
    2013
    Video has finished loading.
    2014
    Loading has ended.
    2026
    The first audio frame has been played.
    2103
    Network disconnected, automatic reconnection has been started.
    -2301
    Network disconnected, and multiple reconnection attempts have failed.
    -2303
    File not found.
    -2304
    H.265 decoding failed.
    -2305
    Failed to obtain the HLS decryption key.
    -2306
    Failed to obtain information about the VOD file.
    2106
    Hardware acceleration failed and software decoding is being used.
    -5
    Invalid license, playback failed. Note: Before calling startVodPlay, you need to set the license using TXLiveBase#setLicence to play successfully. Otherwise, playback will fail (black screen). Set the license only once globally. Live streaming licenses, short video licenses, and video playback licenses can be used. If you have not obtained the above licenses, you can apply for a free trial license to play normally. The official license needs to be purchased.

    Playback event parameters

    Event Definition
    Description
    UTC time.
    EVT_TIME
    Time when the event occurred.
    Event description.
    Event parameter 1.
    Event parameter 2.
    Video cover URL.
    Video URL.
    Video name.
    Video description.
    Playback progress (in milliseconds).
    Total playback time (in milliseconds).
    Playback progress.
    Total playback time.
    Playable duration of VOD (in milliseconds).
    Playback rate.
    Playable duration of VOD.
    URL for downloading the webVTT description file of the sprite image.
    URL list for downloading the sprite image.
    Encryption type.
    Video encoding type.
    Video keyframe description information.
    Keyframe time.

    Playback network status notification parameters

    Event Definition
    Description
    CPU usage.
    Video width.
    Video height.
    Current video frame rate.
    Current video GOP.
    Video bitrate.
    Audio bitrate.
    Network speed.
    Number of audio frames.
    Number of video frames.
    Audio information of the current stream.
    Network jitter.
    Server IP address connected to.
    Current decoder output frame rate.
    Network quality level.

    Player media types

    Code
    Event Definition
    Description
    0
    Auto type.
    1
    Adaptive bitrate playback of HLS VOD media.
    2
    Adaptive bitrate playback of HLS live media.

    Uncategorized variables

    Code
    Event Definition
    Description
    -1
    Adaptive bitrate index identifier.
    
    お問い合わせ

    カスタマーサービスをご提供できるため、ぜひお気軽にお問い合わせくださいませ。

    テクニカルサポート

    さらにサポートが必要な場合は、サポートチケットを送信して弊社サポートチームにお問い合わせください。24時間365日のサポートをご提供します。

    電話サポート(24 時間365日対応)