4

I am developing Android Video call using Sinch and I've follow the Sinch tutorials and samples. Most of them are working fine, but I encountered 2 problems that I have no idea how to solve it.

1) I can't resume the video rendering. Scenario: When I established a call everything works fine, then I exit the activity without hang up (so the video call is still on going). When I start the activity again the localview(my own camera)does not continue to render. This causes the other phone to see me as if the video call hang/stuck.

    @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) Another problem I encounter is that I can't switch the camera

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();
}

but I got this error

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

Anyone have any idea how to solve these? Thanks in advance, sorry for my bad English

Invalid Name
  • 121
  • 1
  • 5

1 Answers1

0

You can try following code for switching your camera(second question)

VideoController vcLocal = getSinchServiceInterface().getVideoController();

on some button click use following code

vcLocal.toggleCaptureDevicePosition();
Sumit Kumar
  • 564
  • 6
  • 14