Data Structures | |
interface | TXVodPlayer.ITXSnapshotListener |
class | TXVodPlayer |
The VOD player API class
The player has the following capabilities:
FileID
in VODinterface com::tencent::rtmp::TXVodPlayer::ITXSnapshotListener |
The screenshot callback, which is used to receive the current video image.
Public Member Functions | |
void | onSnapshot (Bitmap bmp) |
void onSnapshot | ( | Bitmap | bmp | ) |
Callback for a screenshot taken
bmp | The current video image |
class com::tencent::rtmp::TXVodPlayer |
Public Member Functions | |
TXVodPlayer (Context context) | |
void | setConfig (TXVodPlayConfig config) |
void | setPlayerView (TXCloudVideoView glRootView) |
void | setPlayerView (TextureRenderView glRootView) |
void | setSubtitleView (TXSubtitleView subtitleView) |
void | addSubtitleSource (@NonNull String url, @NonNull String name, String mimeType) |
void | selectTrack (int trackIndex) |
void | deselectTrack (int trackIndex) |
List< TXTrackInfo > | getSubtitleTrackInfo () |
List< TXTrackInfo > | getAudioTrackInfo () |
void | setSubtitleStyle (TXSubtitleRenderModel renderModel) |
void | setSurface (Surface surface) |
int | startVodPlay (String playUrl) |
int | startVodPlay (TXPlayerAuthBuilder authBuilder) |
void | startVodPlay (TXPlayInfoParams playInfoParams) |
int | startPlayDrm (TXPlayerDrmBuilder playerDrmBuilder) |
int | stopPlay (boolean isNeedClearLastImg) |
boolean | isPlaying () |
void | pause () |
void | resume () |
void | seek (int time) |
void | seek (float time) |
float | getCurrentPlaybackTime () |
float | getBufferDuration () |
float | getDuration () |
float | getPlayableDuration () |
int | getWidth () |
int | getHeight () |
void | setPlayListener (ITXLivePlayListener listener) |
void | setVodListener (ITXVodPlayListener listener) |
void | setRenderMode (int mode) |
void | setRenderRotation (int rotation) |
boolean | enableHardwareDecode (boolean enable) |
void | setMute (boolean mute) |
void | setAudioPlayoutVolume (int volume) |
boolean | setRequestAudioFocus (boolean requestFocus) |
void | setAutoPlay (boolean autoPlay) |
void | setRate (float rate) |
int | getBitrateIndex () |
void | setBitrateIndex (int index) |
ArrayList< TXBitrateItem > | getSupportedBitrates () |
void | snapshot (TXLivePlayer.ITXSnapshotListener listener) |
void | setMirror (boolean mirror) |
void | setStartTime (float pos) |
void | setToken (String token) |
void | setLoop (boolean loop) |
boolean | isLoop () |
void | attachTRTC (Object trtcCloud) |
void | detachTRTC () |
void | publishVideo () |
void | unpublishVideo () |
void | publishAudio () |
void | unpublishAudio () |
void | setStringOption (String key, Object value) |
Static Public Member Functions | |
static String | getEncryptedPlayKey (final String key) |
|
inline |
Construct a TXVodPlayer object
context | The application context |
|
inline |
Add external subtitles
url | Subtitle address |
name | The name of the subtitle. If you add multiple subtitles, please set the subtitle name to a different name to distinguish it from other added subtitles, otherwise it may cause wrong subtitle selection. |
mimeType | Subtitle type, only supports VVT and SRT formats TXVodConstants#VOD_PLAY_MIMETYPE_TEXT_SRT, TXVodConstants#VOD_PLAY_MIMETYPE_TEXT_VTT. Later, you can get the corresponding name through TXTrackInfo#getName() in getSubtitleTrackInfo(). |
|
inline |
This API is used to push the substream. After attachment, audio playback will be performed by TRTC.
trtcCloud | The TRTC instance pointer |
|
inline |
Deselect track
trackIndex | track index, obtained through TXTrackInfo#getTrackIndex() |
|
inline |
This API is used to detach the current vodPlayer
from TRTC.
|
inline |
This API is used to set whether to enable hardware acceleration.
enable |
|
inline |
Return the list of audio track information
|
inline |
This API is used to get the bitrate index of the video being played back.
|
inline |
This API is used to get the buffered duration.
|
inline |
This API is used to get the current playback time.
|
inline |
This API is used to get the total video duration.
|
inlinestatic |
This API is used to get the encrypted playback key.
key | encrypted playback key. |
|
inline |
The video height.
|
inline |
The playable duration.
|
inline |
Return subtitle track information list
|
inline |
This API is used to return the supported bitrates (definitions) if the playback address is a master playlist.
|
inline |
The video width.
|
inline |
Checks whether the player is looping or non-looping.
|
inline |
This API is used to check whether the playback is ongoing.
|
inline |
Pauses playback
|
inline |
This API is used to start pushing the audio substream to TRTC.
|
inline |
This API is used to start pushing the video substream to TRTC.
|
inline |
This API is used to resume playback.
|
inline |
This API is used to seek the video stream to the specified time point.
This API can be used to implement features such as fast forward, fast rewind, and progress bar seek.
time | The video stream time point in seconds, accurate down to three decimal places. |
|
inline |
This API is used to seek the audio/video stream to the specified time point. This API can be used to implement features such as fast forward, fast rewind, and progress bar seek.
time | The video stream time point in seconds |
|
inline |
Select track
trackIndex | Track index, obtained through TXTrackInfo#getTrackIndex() |
|
inline |
This API is used to set the volume level.
volume | Volume. Value range: 0-150; default: 100 |
|
inline |
This API is used to set whether to start VOD automatically after call of startPlay
. VOD starts automatically by default.
autoPlay |
|
inline |
This API is used to set the bitrate index of the video being played back for seamless definition switch. You may need to wait momentarily to switch the definition. Tencent Cloud supports multi-bitrate segment alignment to guarantee an optimal viewing experience.
index | The bitrate index. index == -1 indicates to enable adaptive bitrate streaming for HLS files. index > 0 TXVodPlayer#getSupportedBitrates()` indicates to manually switch to the target bitrate (definition). |
|
inline |
This API is used to set the player configuration information. We recommend you set the configuration information before starting the playback.
config | The player configuration information. For more information, see TXVodPlayConfig. |
|
inline |
This API is used to set whether to loop the playback.
loop |
|
inline |
This API is used to set whether the video image is mirrored.
mirror |
|
inline |
This API is used to set muting.
mute | Whether to mute the player. Valid values: true: yes; false: no. |
|
inline |
This API is used to set TextureRenderView
for video rendering in the player. We recommend you use TXCloudVideoView
instead.
glRootView | The TextureRenderView for video rendering |
|
inline |
This API is used to set TXCloudVideoView for video rendering in the player This feature can take effect only if it is set before playback starts
glRootView | The TXCloudVideoView for video rendering |
|
inline |
This API is used to set the player callback. We recommend you use the setVodListener
API. For more information, see class ITXVodPlayListener.
listener | The player callback. For more information, see class ITXLivePlayListener. |
|
inline |
This API is used to set the playback speed.
rate | The playback speed. Value range: 0.5–2.0. |
|
inline |
Used for the window rendering mode
mode | The image fill mode. For more information, see image fill mode. |
|
inline |
Set the clockwise rotation angle of the local image
rotation | The image rendering angle. For more information, see image rendering angle. |
|
inline |
This API is used to set whether to get the audio focus automatically, which is yes by default.
requestFocus |
|
inline |
This API is used to set the playback start time.
startTime | The video stream time point in seconds, accurate down to three decimal places. |
|
inline |
This API is used to set extended option parameters.
key | |
value |
|
inline |
Configure subtitle style
renderModel | Support style reference TXSubtitleRenderModel |
|
inline |
Set subtitle rendering target.
subtitleView | TXSubtitleView |
|
inline |
This API is used to set the surface and supports only hardware decoding currently.
The player can run normally only if the surface is valid. When using this API for playback, you need to call resume()
or pause()
manually.
surface | The video rendering surface |
|
inline |
The token for HLS encryption. After the token is set, the player will automatically add voddrm.token.TOKEN
before the filename in the URL.
token |
|
inline |
This API is used to set the player callback.
listener | The player callback. For more information, see class ITXVodPlayListener |
|
inline |
This API gets the current video frame image. Note: As this operation is time-consuming, the screenshot will be called back asynchronously.
listener |
|
inline |
This API is used to start playing back a file encrypted with standard FairPlay DRM.
playerDrmBuilder | The DRM playback information. For more information, see TXPlayerDrmBuilder. |
|
inline |
This API is used to start playback.
url | The URL of the stream to be played back |
|
inline |
This API is used to start playback through fileId
. This API has been deprecated. We recommend you use this#startPlay(TXPlayInfoParams).
authBuilder |
|
inline |
This API is used to start playback through fileId
.
playInfoParams | Parameters for playback through fileId . For more information, see TXPlayInfoParams. |
|
inline |
This API is used to stop playing audio/video streams.
isNeedClearLastImg | Whether to clear the last image frame on Android. Valid values: true: yes; false: no. We recommend you set this value to true when playback ends normally. If playback stops due to an exception (for example, a network exception occurs and forces the playback to stop), but you want playback to resume when the SDK is reconnected to the server, set this value to false . |
|
inline |
This API is used to stop pushing the audio substream to TRTC.
|
inline |
This API is used to stop pushing the video substream to TRTC.