TXCPlayerAdapter-release-1.0.0.aar
到 libs 目录,添加依赖项:implementation(name:'TXCPlayerAdapter-release-1.0.0', ext:'aar')
-keep class com.tencent.** { *; }
ITXCPlayerAssistor
,创建后即可播放视频。//psign 即播放器签名,签名介绍和生成方式参见链接:https://www.tencentcloud.com/document/product/266/42436?from_cn_redirect=1private String mFileId, mPSign;ITXCPlayerAssistor mPlayerAssistor = TXCPlayerAdapter.createPlayerAssistor(mFileId, mPSign);
// 初始化TXCPlayerAdapter.init(appId); //appid 在腾讯云点播申请TXCPlayerAdapter.setLogEnable(true); //开启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) {//播放视频mSuperPlayerView.play(mPlayerAssistor.getStreamingInfo().playUrl);} else {Toast.makeText(VideoActivity.this, "streamInfo = null", Toast.LENGTH_SHORT).show();}}});}});
TXCPlayerAdapter.destroy();
TXCPlayerAdapter.init(String appId);
TXCPlayerAdapter.destroy();
ITXCPlayerAssistor playerAssistor = TXCPlayerAdapter.createPlayerAssistor(String fileId, String pSign);
参数名 | 类型 | 描述 |
fileId | String | 要播放的视频 fileId |
pSign | String | 播放器签名 |
TXCPlayerAdapter.destroyPlayerAssistor(ITXCPlayerAssistor assistor);
playerAssistor.requestVideoInfo(ITXCRequestVideoInfoCallback callback);
参数名 | 类型 | 描述 |
callback | ITXCRequestVideoInfoCallback | 异步回调函数 |
playerAssistor.requestPlayInfo
回调之后才生效。TXCVideoBasicInfo playerAssistor.getVideoBasicInfo();
参数名 | 类型 | 描述 |
name | String | 视频名称 |
duration | Float | 视频时长,单位:秒 |
description | String | 视频描述 |
coverUrl | String | 视频封面 |
playerAssistor.requestPlayInfo
回调之后才生效。TXCStreamingInfo playerAssistor.getStreamimgInfo();
参数名 | 类型 | 描述 |
playUrl | String | 播放 URL |
subStreams | List | 自适应码流子流信息,类型为 SubStreamInfo |
参数名 | 类型 | 描述 |
type | String | 子流的类型,目前可能的取值仅有 video |
width | Int | 子流视频的宽,单位:px |
height | Int | 子流视频的高,单位:px |
resolutionName | String | 子流视频在播放器中展示的规格名 |
playerAssistor.requestPlayInfo
回调之后才生效。List<TXCKeyFrameDescInfo> playerAssistor.getKeyFrameDescInfo();
参数名 | 类型 | 描述 |
timeOffset | Float | 1.1 |
content | String | "片头开始..." |
playerAssistor.requestPlayInfo
回调之后才生效。TXCImageSpriteInfo playerAssistor.getImageSpriteInfo();
参数名 | 类型 | 描述 |
imageUrls | List | 缩略图下载 URL 数组,类型为 String |
webVttUrl | String | 缩略图 VTT 文件下载 URL |
本页内容是否解决了您的问题?