【问题标题】:Android Sinch Video Call can't switch camera and resume videocontrollerAndroid Sinch Video Call 无法切换摄像头和恢复视频控制器
【发布时间】:2018-06-15 17:14:50
【问题描述】:

我正在使用 Sinch 开发 Android 视频通话,并遵循 Sinch 教程和示例。他们中的大多数都工作正常,但我遇到了 2 个我不知道如何解决的问题。

1) 我无法恢复视频渲染。 场景:当我建立通话时一切正常,然后我退出活动而不挂断(因此视频通话仍在进行中)。当我再次开始活动时,localview(我自己的相机)不会继续渲染。这会导致另一部手机看到我,就好像视频通话挂起/卡住一样。

    @Override
    public void onServiceConnected(ComponentName name, IBinder svc)
    {
         service = ((ServiceChat.ChatBinder) svc).getService();
         VideoController controller = service.GetSinchVideoController();
         if(controller != null)
         {
             // your own face
             localVideo.addView(controller.getLocalView());
             // contact face
             remoteVideo.addView(controller.getRemoteView());
         }
    }
    @Override
    protected void onDestroy()
    {
        VideoController controller = service.GetSinchVideoController();
        if(controller != null)
        {
            localVideo.removeView(controller.getLocalView());
            remoteVideo.removeView(controller.getRemoteView());
        }
        super.onDestroy();
    }

2)我遇到的另一个问题是无法切换相机

private void SwitchCamera()
{
    VideoController controller = service.GetSinchVideoController();
    if(controller.getCaptureDevicePosition() == Camera.CameraInfo.CAMERA_FACING_FRONT)
    {
        controller.setCaptureDevicePosition(Camera.CameraInfo.CAMERA_FACING_BACK);
    }
    else
    {
        controller.setCaptureDevicePosition(Camera.CameraInfo.CAMERA_FACING_FRONT);
    }
    //controller.toggleCaptureDevicePosition();
}

但我收到了这个错误

org.webrtc.Logging: VideoCapturerAndroid: Ignoring camera switch request.
org.webrtc.Logging: VideoCapturerAndroid: Could not switch to camera with id 0

有人知道如何解决这些问题吗?提前谢谢,对不起我的英语不好

【问题讨论】:

    标签: android video sinch android-sinch-api


    【解决方案1】:

    您可以尝试以下代码来切换相机(第二个问题)

    VideoController vcLocal = getSinchServiceInterface().getVideoController();
    

    在某些按钮上单击使用以下代码

    vcLocal.toggleCaptureDevicePosition();
    

    【讨论】:

      猜你喜欢
      • 2018-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多