tencent cloud

Video on Demand

動向とお知らせ
製品アップデート情報
製品紹介
製品概要
Product Features
製品の機能
製品の強み
ユースケース
ソリューション
購入ガイド
課金概要
課金方式
購入ガイドライン
請求書の照会
支払い更新の説明
支払い延滞の説明
返金説明
クイックスタート
コンソールガイド
コンソールの説明
サービスの概要
アプリケーション管理
メディア管理
リソースパック管理
License Management
プラクティスチュートリアル
メディアのアップロード
オンデマンドメディアファイルのインテリジェントコールド化方法
ビデオ処理
配信と再生
イベント通知の受信方法
オリジンサーバーのマイグレーションツール
Live Recording
カスタムオリジンサーバーback-to-originの方法
ライブストリーミングハイライトクリップを VOD に永続化するためのガイド
EdgeOne を使用して VOD コンテンツを配信する方法
開発ガイド
メディアアップロード
メディア加工処理
ビデオAI
イベント通知
ビデオ再生
メディアファイルのダウンロード
サブアプリケーションシステム
エラーコード
Player+ドキュメント
Overview
Basic Concepts
Features
Free Demo
Free Trial License
Purchase Guide
SDK Download
Licenses
Player Guide
Integration (UI Included)
Integration (No UI)
Advanced Features
API Documentation
Player Adapter
Player SDK Policy
よくあるご質問
モバイル端末再生に関するご質問
料金
ビデオのアップロード
ビデオの公開
ビデオの再生
Web側の再生
全画面表示再生
データ統計
CAM関連
メディア資産冷却に関する質問
Agreements
Service Level Agreement
VOD ポリシー
プライバシーポリシー
データ処理とセキュリティ契約
お問い合わせ
用語集

Player Adapter for Android

PDF
フォーカスモード
フォントサイズ
最終更新日: 2022-10-17 11:16:01
Player Adapter for Android is a player plugin provided by VOD for customers who want to use a third-party or proprietary player to connect to Tencent Cloud PaaS resources. It is generally used by customers who strongly need to customize player features.

SDK Download

The Player Adapter SDK and demo for Android can be downloaded here.

Integration Guide

Integrating the SDK

Integrate the SDK, copy TXCPlayerAdapter-release-1.0.0.aar to the libs directory, and add dependencies:
implementation(name:'TXCPlayerAdapter-release-1.0.0', ext:'aar')
Add the script for obfuscation:
-keep class com.tencent.** { *;}

Using the Player

Declare the variables and then create an instance. The main class of the player is ITXCPlayerAssistor, and videos can be played back after it is created.
A fileId is usually returned by the server after the video is uploaded:
1. After the video is published on the client, the server will return a fileId to the client.
2. When the video is uploaded to the server, the corresponding fileId will be included in the notification of upload confirmation.
If the file already exists in Tencent Cloud, you can go to Media Assets and find it. After clicking it, you can view relevant parameters in the video details on the right.
// `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);
Initialization:
// Initialize the component
TXCPlayerAdapter.init(appId); // `appid` can be applied for in Tencent Cloud VOD
TXCPlayerAdapter.setLogEnable(true); // Enable log

mSuperPlayerView = findViewById(R.id.sv_videoplayer);
mPlayerAssistor = TXCPlayerAdapter.createPlayerAssistor(mFileId, mPSign);
Request the video information and play back the video:
mPlayerAssistor.requestVideoInfo(new ITXCRequestVideoInfoCallback() {

@Override
public void onError(int errCode, String msg) {
Log.d(TAG, "onError msg = " + msg);
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(VideoActivity.this, "onError msg = " + msg, Toast.LENGTH_SHORT).show();
}
});
}

@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
TXCStreamingInfo streamingInfo = mPlayerAssistor.getStreamingInfo();
Log.d(TAG, "streamingInfo = " + streamingInfo);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (mPlayerAssistor.getStreamingInfo() != null) {
// Play back the video
mSuperPlayerView.play(mPlayerAssistor.getStreamingInfo().playUrl);
} else {
Toast.makeText(VideoActivity.this, "streamInfo = null", Toast.LENGTH_SHORT).show();
}
}
});
}
});
Terminate the player after use
TXCPlayerAdapter.destroy();

SDK API Description

Initializing TXCPlayerAdatper

This API is used to initialize Adapter each time.
API
TXCPlayerAdapter.init(String appId);
Parameter description
appId: Enter the appid (if a subapplication is used, enter the subappid). |

Terminating TXCPlayerAdatper

This API is used to terminate Adapter. It can be called after the program exits.
API
TXCPlayerAdapter.destroy();

Creating the Player auxiliary class

An auxiliary class of the player can be used to get the playback fileId and process DRM encryption APIs.
API
ITXCPlayerAssistor playerAssistor = TXCPlayerAdapter.createPlayerAssistor(String fileId, String pSign);
Parameter description
Parameter
Type
Description
fileId
String
The fileId of the video to be played. back.
pSign
String
The player signature.

Terminating the Player auxiliary class

This API is used to terminate an auxiliary class. You can call it when exiting the player or switching to the next video for playback.
API
TXCPlayerAdapter.destroyPlayerAssistor(ITXCPlayerAssistor assistor);

Requesting video playback information

This API is used to request the stream information of the video to be played back from the Tencent Cloud VOD server.
API
playerAssistor.requestVideoInfo(ITXCRequestVideoInfoCallback callback);
Parameter description
Parameter
Type
Description
callback
ITXCRequestVideoInfoCallback
Async callback function.

Getting the basic video information

This API is used to get the video information and will take effect only after playerAssistor.requestPlayInfo is called back.
API
TXCVideoBasicInfo playerAssistor.getVideoBasicInfo();
Parameter description
The parameters of 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.

Getting video stream information

This API is used to get the video stream information list and will take effect only after playerAssistor.requestPlayInfo is called back.
API
TXCStreamingInfo playerAssistor.getStreamimgInfo();
Parameter description
TXCStreamingInfo
Parameter
Type
Description
playUrl
String
The playback URL.
subStreams
List
The adaptive bitrate substream information of the SubStreamInfo type.
The parameters of 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.

Getting keyframe timestamp information

This API is used to get the video keyframe timestamp information and will take effect only after playerAssistor.requestPlayInfo is called back.
API
List<TXCKeyFrameDescInfo> playerAssistor.getKeyFrameDescInfo();
Parameter description
The parameters of TXCKeyFrameDescInfo are as follows:
Parameter
Type
Description
timeOffset
Float
1.1
content
String
"Beginning now..."

Getting thumbnail information

This API is used to get the thumbnail information and will take effect only after playerAssistor.requestPlayInfo is called back.
API
TXCImageSpriteInfo playerAssistor.getImageSpriteInfo();
Parameter description
The parameters of TCXImageSpriteInfo are as follows:
Parameter
Type
Description
imageUrls
List
Array of thumbnail download URLs of String type.
webVttUrl
String
Thumbnail VTT file download URL.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック