腾讯云直播播放器接口类
| interface com::tencent::rtmp::TXLivePlayer::ITXSnapshotListener |
Public 成员函数 | |
| void | onSnapshot (Bitmap bmp) |
| void onSnapshot | ( | Bitmap | bmp | ) |
截图回调
| bmp | 当前视频图片 |
| interface com::tencent::rtmp::TXLivePlayer::ITXVideoRawDataListener |
Public 成员函数 | |
| void | onVideoRawDataAvailable (byte[] yuvBuffer, int width, int height, int timestamp) |
| void onVideoRawDataAvailable | ( | byte[] | yuvBuffer, |
| int | width, | ||
| int | height, | ||
| int | timestamp | ||
| ) |
软解码器解出一帧数据回调一次
需要在回调中再次调用addVideoRawData(byte[])将 buffer 塞给 SDK 来填充下一帧 YUV 数据。
| yuvBuffer | I420格式 YUV 数据 |
| width | 视频宽度 |
| height | 视频高度 |
| timestamp | 视频 PTS |
| class com::tencent::rtmp::TXLivePlayer::TXLiteAVTexture |
| interface com::tencent::rtmp::TXLivePlayer::ITXLivePlayVideoRenderListener |
Public 成员函数 | |
| void | onRenderVideoFrame (TXLiteAVTexture texture) |
| void onRenderVideoFrame | ( | TXLiteAVTexture | texture | ) |
解码器解出一帧数据回调一次
| texture | 视频纹理 |
| interface com::tencent::rtmp::TXLivePlayer::ITXAudioRawDataListener |
Public 成员函数 | |
| void | onPcmDataAvailable (byte[] buf, long timestamp) |
| void | onAudioInfoChanged (int sampleRate, int channels, int bits) |
| void onAudioInfoChanged | ( | int | sampleRate, |
| int | channels, | ||
| int | bits | ||
| ) |
音频播放信息回调
| sampleRate | 采样率 |
| channels | 声道数 |
| bits | 采样点大小 |
| void onPcmDataAvailable | ( | byte[] | buf, |
| long | timestamp | ||
| ) |
音频播放数据回调,数据格式 :PCM
音频播放器会在播放数据的前一刻,调用此函数,同步回调将要播放的数据。因此在函数内部做耗时操作可能会影响播放。
| buf | pcm 数据 |
| timestamp | 时间戳 |
| interface com::tencent::rtmp::TXLivePlayer::ITXAudioVolumeEvaluationListener |
Public 成员函数 | |
| void | onAudioVolumeEvaluationNotify (int volume) |
| void onAudioVolumeEvaluationNotify | ( | int | volume | ) |
| class com::tencent::rtmp::TXLivePlayer |
静态 Public 属性 | |
| static final String | TAG = "TXLivePlayer" |
| static final int | PLAY_TYPE_LIVE_RTMP = 0 |
| static final int | PLAY_TYPE_LIVE_FLV = 1 |
| static final int | PLAY_TYPE_VOD_FLV = 2 |
| static final int | PLAY_TYPE_VOD_HLS = 3 |
| static final int | PLAY_TYPE_VOD_MP4 = 4 |
| static final int | PLAY_TYPE_LIVE_RTMP_ACC = 5 |
| static final int | PLAY_TYPE_LOCAL_VIDEO = 6 |
SDK 基础函数 | |
| TXLivePlayer (Context context) | |
| void | setConfig (TXLivePlayConfig config) |
| void | setPlayListener (ITXLivePlayListener listener) |
播放基础接口 | |
| void | setPlayerView (TXCloudVideoView glRootView) |
| int | startLivePlay (String playUrl, int playType) |
| int | stopPlay (boolean isNeedClearLastImg) |
| boolean | isPlaying () |
| void | pause () |
| void | resume () |
| void | setSurface (Surface surface) |
| void | setSurfaceSize (int width, int height) |
| long | getCurrentRenderPts () |
播放配置接口 | |
| void | setRenderMode (int mode) |
| void | setRenderRotation (int rotation) |
| boolean | enableHardwareDecode (boolean enable) |
| void | setMute (boolean mute) |
| void | setVolume (int volume) |
| void | setAudioRoute (int audioRoute) |
| int | switchStream (String playUrl) |
| void | setAudioVolumeEvaluationListener (ITXAudioVolumeEvaluationListener listener) |
| void | enableAudioVolumeEvaluation (int intervalMs) |
| void | callExperimentalAPI (final String jsonStr) |
本地录制和截图 | |
| void | setVideoRecordListener (TXRecordCommon.ITXVideoRecordListener listener) |
| int | startRecord (int recordType) |
| int | stopRecord () |
| void | snapshot (ITXSnapshotListener listener) |
自定义数据处理 | |
| boolean | addVideoRawData (byte[] yuvBuffer) |
| void | setVideoRawDataListener (final ITXVideoRawDataListener listener) |
| int | setVideoRenderListener (final ITXLivePlayVideoRenderListener listener, Object glContext) |
| void | setAudioRawDataListener (ITXAudioRawDataListener listener) |
直播时移接口 | |
| int | prepareLiveSeek (String domain, int bizid) |
| void | seek (int time) |
| int | resumeLive () |
待废弃接口 | |
| void | setAutoPlay (boolean autoPlay) |
| void | setRate (float rate) |
|
inline |
创建 TXLivePlayer 实例
| context | 上下文 |
|
inline |
设置软解码数据载体 Buffer
三个注意点:
| yuvBuffer |
|
inline |
调用实验性 API 接口
| jsonStr | 接口及参数描述的 JSON 字符串 |
|
inline |
启用音量大小评估
开启后会在 onAudioVolumeEvaluationNotify 中获取到 SDK 对音量大小值的评估。
| intervalMs | 决定了 onAudioVolumeEvaluationNotify 回调的触发间隔,单位为ms,最小间隔为100ms,如果小于等于0则会关闭回调,建议设置为300ms; |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
开启硬件加速
| enable | true:启用视频硬解码, false:禁用视频硬解码 |
|
inline |
获取当前渲染帧 pts
|
inline |
|
inline |
暂停播放
停止获取流数据,保留最后一帧画面。
|
inline |
直播时移准备
使用说明:
| domain | 时移域名 |
| bizid | 流 bizid |
|
inline |
恢复播放
重新获取数据,获取当前直播数据。
|
inline |
恢复直播播放
从直播时移播放中,恢复到直播播放。
|
inline |
直播时移跳转
直播流则会时移到该时间点。
| time | 视频流时间点,单位为秒 |
|
inline |
设置音频数据回调
| listener | 音频数据回调 |
|
inline |
设置声音播放模式
播放模式有两种:
| audioRoute | 声音播放模式,可设置值:TXLiveConstants#AUDIO_ROUTE_SPEAKER、TXLiveConstants#AUDIO_ROUTE_SPEAKER |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
|
inline |
|
inline |
设置 TXLivePlayer 播放配置项
| config | 播放器配置项了,详情见 TXLivePlayConfig |
|
inline |
设置是否静音播放
| mute | true:静音播放, false:不静音播放 |
|
inline |
|
inline |
|
inline |
|
inline |
设置播放渲染模式
渲染模式有两种:
| mode | 图像渲染模式,可以设置值为:TXLiveConstants#RENDER_MODE_FULL_FILL_SCREEN、TXLiveConstants#RENDER_MODE_ADJUST_RESOLUTION |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
设置图像渲染角度
渲染角度有两种:
| rotation | 图像渲染角度,可设置值为:TXLiveConstants#RENDER_ROTATION_PORTRAIT、TXLiveConstants#RENDER_ROTATION_LANDSCAPE |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
使用 Surface 模式用于本地渲染
| surface | 视频渲染 surface。 |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
设置渲染 Surface 的大小
| width | 宽 |
| height | 高 |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
设置软解码视频数据回调
|
inline |
设置录制回调接口
| listener | 接口 |
|
inline |
设置视频渲染纹理回调
| listener | 自定义渲染纹理回调 |
| glContext | OpenGL 上下文,如果您的渲染模块使用 (javax.microedition.khronos.egl.*) 定义的 OpenGL 接口,请填 javax.microedition.khronos.egl.EGLContext 类型的对象 如果您的渲染模块使用 (android.opengl.*) 定义的 OpenGL 接口,请填 android.opengl.EGLContext 类型的对象。 如果填 null 表示使用 SDK 内部默认的 javax.microedition.khronos.egl.EGLContext 环境 |
|
inline |
设置音量
| volume | 音量大小,取值范围0 - 100 |
|
inline |
|
inline |
播放器开始播放
可播放的直播流类型:
| playUrl | 播放的流地址 |
| playType | 播放类型 |
|
inline |
启动视频录制
目前录制格式仅支持录制直播流,TXRecordCommon#RECORD_TYPE_STREAM_SOURCE。
| recordType | TXRecordCommon#RECORD_TYPE_STREAM_SOURCE |
|
inline |
停止播放
isNeedClearLastImg 提供是否清除最后一帧画面的逻辑:
| isNeedClearLastImg | true:清除;false:不清除 |
被 WXLivePlayer , 以及 WXLivePlayerLite 重载.
|
inline |
停止视频录制
|
inline |
多清晰度切换
使用说明:
| playUrl | 播放的流地址 |
|
static |
|
static |
播放类型
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |