QNLocalVideoCallback
QNLocalVideoCallback 回调主要用于回调本地预览的视频数据,并可用于对接外部第三方美颜或者滤镜。接口如下:
onSurfaceCreated
定义
void onSurfaceCreated()
说明
当有新的 surface 创建时触发
onSurfaceChanged
定义
void onSurfaceChanged(int width, int height)
说明
当 surface 发生改变时触发
参数
| 参数名 | 描述 |
|---|---|
| width | 宽度 |
| height | 高度 |
onSurfaceDestroyed
定义
void onSurfaceDestroyed()
说明
当 Surface 销毁时触发
onRenderingFrame
定义
int onRenderingFrame(int textureId, int width, int height, VideoFrame.TextureBuffer.Type type, long timestampNs)
说明
当绘帧时触发
参数
| 参数名 | 描述 |
|---|---|
| textureId | 待渲染的 SurfaceTexture 对象的 texture ID |
| width | 绘制的 surface 宽度 |
| height | 绘制的 surface 高度 |
| type | 绘制的纹理类型,包括 OES、RGB |
| timestampNs | 该帧的时间戳,单位 Ns |
返回值
新创建的制定给 SurfaceTexuture 对象的 texture ID,类型必须为 GL_TEXTURE_2D
onPreviewFrame
定义
void onPreviewFrame(byte[] data, int width, int height, int rotation, int fmt, long timestampNs)
说明
当摄像头回调一帧的数据时触发
参数
| 参数名 | 描述 |
|---|---|
| data | 摄像头返回视频帧的 YUV 数据 |
| width | 该视频帧的宽度 |
| height | 该视频帧的高度 |
| rotation | 该视频帧的旋转角度 |
| fmt | 该视频帧的 YUV 数据类型(目前仅返回 NV21 类型) |
| timestampNs | 该帧的时间戳,单位 Ns |