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.聲網視頻通話大小屏切換問題