TXCPlayerAdapter-release-1.0.0.aar
to the libs
directory, and add dependencies:implementation(name:'TXCPlayerAdapter-release-1.0.0', ext:'aar')
-keep class com.tencent.** { *;}
ITXCPlayerAssistor
, and videos can be played back after it is created.fileId
is usually returned by the server after the video is uploaded:fileId
to the client.fileId
will be included in the notification of upload confirmation.// `psign` is a player signature. For more information on the signature and how to generate it, visit https://www.tencentcloud.com/document/product/266/42436?from_cn_redirect=1.private String mFileId, mPSign;ITXCPlayerAssistor mPlayerAssistor = TXCPlayerAdapter.createPlayerAssistor(mFileId, mPSign);
// Initialize the componentTXCPlayerAdapter.init(appId); // `appid` can be applied for in Tencent Cloud VODTXCPlayerAdapter.setLogEnable(true); // Enable logmSuperPlayerView = findViewById(R.id.sv_videoplayer);mPlayerAssistor = TXCPlayerAdapter.createPlayerAssistor(mFileId, mPSign);
mPlayerAssistor.requestVideoInfo(new ITXCRequestVideoInfoCallback() {@Overridepublic void onError(int errCode, String msg) {Log.d(TAG, "onError msg = " + msg);runOnUiThread(new Runnable() {@Overridepublic void run() {Toast.makeText(VideoActivity.this, "onError msg = " + msg, Toast.LENGTH_SHORT).show();}});}@Overridepublic void onSuccess() {Log.d(TAG, "onSuccess");TXCStreamingInfo streamingInfo = mPlayerAssistor.getStreamingInfo();Log.d(TAG, "streamingInfo = " + streamingInfo);runOnUiThread(new Runnable() {@Overridepublic void run() {if (mPlayerAssistor.getStreamingInfo() != null) {// Play back the videomSuperPlayerView.play(mPlayerAssistor.getStreamingInfo().playUrl);} else {Toast.makeText(VideoActivity.this, "streamInfo = null", Toast.LENGTH_SHORT).show();}}});}});
TXCPlayerAdapter.destroy();
TXCPlayerAdapter.init(String appId);
appid
(if a subapplication is used, enter the subappid
). |TXCPlayerAdapter.destroy();
fileId
and process DRM encryption APIs.ITXCPlayerAssistor playerAssistor = TXCPlayerAdapter.createPlayerAssistor(String fileId, String pSign);
Parameter | Type | Description |
fileId | String | The fileId of the video to be played. back. |
pSign | String | The player signature. |
TXCPlayerAdapter.destroyPlayerAssistor(ITXCPlayerAssistor assistor);
playerAssistor.requestVideoInfo(ITXCRequestVideoInfoCallback callback);
Parameter | Type | Description |
callback | ITXCRequestVideoInfoCallback | Async callback function. |
playerAssistor.requestPlayInfo
is called back.TXCVideoBasicInfo playerAssistor.getVideoBasicInfo();
TXCVideoBasicInfo
are as follows:Parameter | Type | Description |
name | String | The video name. |
duration | Float | The video duration in seconds. |
description | String | The video description. |
coverUrl | String | The video thumbnail. |
playerAssistor.requestPlayInfo
is called back.TXCStreamingInfo playerAssistor.getStreamimgInfo();
Parameter | Type | Description |
playUrl | String | The playback URL. |
subStreams | List |
SubStreamInfo
are as follows:Parameter | Type | Description |
type | String | Substream type. Valid values: video |
width | Int | The substream video width in px. |
height | Int | The substream video height in px. |
resolutionName | String | The specification name of the substream video displayed in the player. |
playerAssistor.requestPlayInfo
is called back.List<TXCKeyFrameDescInfo> playerAssistor.getKeyFrameDescInfo();
TXCKeyFrameDescInfo
are as follows:Parameter | Type | Description |
timeOffset | Float | 1.1 |
content | String | "Beginning now..." |
playerAssistor.requestPlayInfo
is called back.TXCImageSpriteInfo playerAssistor.getImageSpriteInfo();
TCXImageSpriteInfo
are as follows:Parameter | Type | Description |
imageUrls | List | Array of thumbnail download URLs of String type. |
webVttUrl | String | Thumbnail VTT file download URL. |
Was this page helpful?