修复开播图片后摄像头卡住问题
This commit is contained in:
@@ -5,13 +5,16 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.SurfaceView;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.SwTokenModel;
|
||||
@@ -68,6 +71,7 @@ public class SWManager extends BaseCacheManager {
|
||||
private ImageTrackOptions imageTrackOptions = null;
|
||||
|
||||
private onDrPkJoinSuccessListener onDrPkJoinSuccessListener;
|
||||
String openCameraId = "1";
|
||||
|
||||
public void setOnDrPkJoinSuccessListener(SWManager.onDrPkJoinSuccessListener onDrPkJoinSuccessListener) {
|
||||
this.onDrPkJoinSuccessListener = onDrPkJoinSuccessListener;
|
||||
@@ -252,7 +256,20 @@ public class SWManager extends BaseCacheManager {
|
||||
*/
|
||||
public void switchCamera() {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.switchCamera();
|
||||
if (openCameraId.equals("0")) {
|
||||
mRtcEngine.switchCamera("1");
|
||||
openCameraId = "1";
|
||||
} else {
|
||||
mRtcEngine.switchCamera("0");
|
||||
openCameraId = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetCamera() {
|
||||
LogUtils.e("重置摄像头", openCameraId);
|
||||
if (mRtcEngine != null && !TextUtils.isEmpty(openCameraId)) {
|
||||
mRtcEngine.switchCamera(openCameraId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +541,9 @@ public class SWManager extends BaseCacheManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void release() {
|
||||
}
|
||||
|
||||
public interface onRtcEngineListener {
|
||||
void onOpenSuccess(String channel, int uid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user