|
目标效果:实现点击小窗口,大窗口显示的视频,切换到小窗口显示,小窗口显示的视频,切换到大窗口显示。初始的状态是,小窗口为本地摄像头,而大窗口是远程视频。我使用重新绑定对象,达不到该效果。以下是控制的代码片段:
anyChatSDK.UserCameraControl(mFirstUserId, CLOSE_DEVICE); //关闭远程
anyChatSDK.UserCameraControl(-1, CLOSE_DEVICE); //关闭本地
mMyView.getHolder().removeCallback(AnyChatCoreSDK.mCameraHelper); //小窗口移除本地摄像头
// 如果是采用Java视频采集,则需要设置Surface的CallBack
if (AnyChatCoreSDK
.GetSDKOptionInt(AnyChatDefine.BRAC_SO_LOCALVIDEO_CAPDRIVER) == AnyChatDefine.VIDEOCAP_DRIVER_JAVA) {
Log.v(TAG, "本地视频");
mOtherView.getHolder().addCallback(AnyChatCoreSDK.mCameraHelper); //大窗口绑定本地摄像头
Toast.makeText(this, "绑定本地视频", Toast.LENGTH_SHORT).show();
}
if (AnyChatCoreSDK
.GetSDKOptionInt(AnyChatDefine.BRAC_SO_VIDEOSHOW_DRIVERCTRL) == AnyChatDefine.VIDEOSHOW_DRIVER_JAVA) {
int index = anyChatSDK.mVideoHelper.bindVideo(mMyView
.getHolder());
anyChatSDK.mVideoHelper.SetVideoUser(index, mFirstUserId);
}
anyChatSDK.UserCameraControl(-1, OPEN_DEVICE); //打开本地
anyChatSDK.UserCameraControl(mFirstUserId, OPEN_DEVICE); //打开远程
|
|