|
bdcn 发表于 2014-1-15 11:21
int watcherId = -1;
if (anychat.GetCameraState(watcherId) == 2
&& anychat.GetUserVideoWidth( ...
您好,同一个surfaceview切换不同用户显示是可以的。你贴上来的代码流程有问题
1、打开对方A的视频,anychat.UserCameraControl(useridA, 1);
2、然后通过计时器判断到 if (anychat.GetCameraState(useridA) == 2
&& anychat.GetUserVideoWidth(useridA) != 0) {
时执行- && anychat.GetUserVideoWidth(watcherId) != 0) {
- SurfaceHolder holder = firstSurfaceView.getHolder();
- holder.setFormat(PixelFormat.RGB_565);
- holder.setFixedSize(anychat.GetUserVideoWidth(watcherId),
- anychat.GetUserVideoHeight(watcherId));
- Surface s = holder.getSurface();
- System.out.println("firstSurfaceView=" + watcherId);
- anychat.SetVideoPos(watcherId, s, 0, 0, 0, 0);
- anychat.UserCameraControl(watcherId, 1);
- // 如果是采用Java视频显示,则需要将视频窗口与用户关联起来
- if (AnyChatCoreSDK
- .GetSDKOptionInt(AnyChatDefine.BRAC_SO_VIDEOSHOW_DRIVERCTRL) == AnyChatDefine.VIDEOSHOW_DRIVER_JAVA) {
- anychat.mVideoHelper.SetVideoUser(firstVideoIndex, watcherId);
- }
复制代码 3、参考标准demo的做法。
(本地视频是不能通过这种方式切换的)
|
|