1.设定自定义采集
~~~
private void setupLocalVideo(FrameLayout frameLayout,boolean top) {
if(mTextureCamera == null){
mTextureCamera = new TextureCamera(this, 640, 480);
mTextureCamera.setOnCaptureListener(new TextureCamera.OnCaptureListener() {
@Override
public int onTextureBufferAvailable(int textureId, byte[] buffer, int width, int height) {
int newTexture = textureId;
try {
if (mhBeautyManager == null) {
mhBeautyManager = new MHBeautyManager(getApplicationContext(),true);
mhBeautyManager.setBeautyDataModel(BeautyDataModel.getInstance());
if (beautyViewHolder != null) {
beautyViewHolder.setMhBeautyManager(mhBeautyManager);
}
}else{
if (mCameraFacing == Camera.CameraInfo.CAMERA_FACING_FRONT){
newTexture = mhBeautyManager.render10(textureId, width, height);
}else{
newTexture = mhBeautyManager.render11(textureId, width, height);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return newTexture;
}
@Override
public void onCapturerStarted() {
Log.d(TAG, "onCapturerStarted() called");
}
@Override
public void onCapturerStopped() {
Log.d(TAG, "onCapturerStopped() called");
}
@Override
public void onCameraSwitched(int facing, int orientation) {
Log.d(TAG, "onCameraSwitched() called with: facing = [" + facing + "], orientation = [" + orientation + "]");
mCameraFacing = facing;
}
});
}
mLocalView = new AgoraSurfaceView(VideoLineActivity.this);
mLocalView.init(mTextureCamera.getEglContext());
mLocalView.setBufferType(MediaIO.BufferType.TEXTURE);
mLocalView.setPixelFormat(MediaIO.PixelFormat.TEXTURE_2D);
mLocalView.setZOrderOnTop(top);
mLocalView.setZOrderMediaOverlay(top);
frameLayout.addView(mLocalView);
mRtcEngine.setLocalVideoRenderer(mLocalView);
mRtcEngine.setVideoSource(mTextureCamera);
mTextureCamera.onResume();
}
~~~
2.切换大小屏的时候销毁资源
~~~
mTextureCamera.onPause();
mTextureCamera.release();
mTextureCamera = null;
mhBeautyManager.destroy();
mhBeautyManager = null;
~~~
3. 设置本地渲染
大屏
~~~
setupLocalVideo(video_chat_big,false);
~~~
小屏
~~~
setupLocalVideo(video_chat_small,true);
~~~
- 一、产品简介
- 1.功能说明
- 2.平台支持
- 3.官方链接
- 二、集成指引
- Android集成指引
- 1.概述
- 2.接入说明
- 3.详细步骤
- 4.具体直播平台接入
- 1.腾讯云直播
- 2.阿里云
- 三、MHSDK美颜相关接口部分
- Android相关接口文档说明
- 美颜相关接口文档说明
- 四、常见问题
- Android常见问题
- 1.认证失败原因
- 2.调用美型、贴纸、特效、哈哈镜没有效果
- 3.MHBeautyManager的特别声明
- 4.使用MHUI的注意事项
- 5.卡顿问题
- 6.闪退问题
- 7.贴纸无法下载
- 8.AndroidX(腾讯云)环境集成问题
- 9.导入新的sdk出现乱码
- 10.弹出的UI有阴影效果
- 11.Android10出现网络资源失败请检查网络
- 12.美狐可以记录设置的各种参数吗
- 13.(七牛云)替换sdk画面上下颠倒
- 14.贴纸可以自定义吗
- 15.您这边可以录制视频吗
- 16.MHSDK必须本地依赖吗
- 17.找不到某个方法
- 18.环信不显示自己的头像框
- 19.如何取消特效
- 20.水印没有找到
- 21.声网视频通话大小屏切换问题