In my app, I am implementing video chat and for that I am using sinch client and I am reffering below link provided by official documentation.
https://www.sinch.com/docs/video/android/#videocalling
and using below code i am adding remote view to the layout
@Override
public void onVideoTrackAdded(Call call) {
Log.e("test","video track added is called now");
SinchClient sinchClient = getSinchServiceInterface().getSinchClient();
if (sinchClient != null) {
VideoController videoController = sinchClient.getVideoController();
View myPreview = videoController.getLocalView();
View remoteView = videoController.getRemoteView();
mUpperLinearLayout.addView(myPreview);
mLowerLinearLayout.addView(remoteView);
}
}
I have splitted out my UI into two linear layouts name upper layout and lower layout and I am adding remote view to the linear layout as mentioned in the documents. But I am getting black or blank view on connecting video call successfully.Why is that so am I missing anything?one more thing I have observed in log cat there is an error as mentioned below
CameraEnumerator: java.lang.RuntimeException: Fail to connect to camera service
I have googled a lot and tried different links as mentioned below
Sinch Video Chat - Remote Video Issue
but no luck . Any help?
I am using below code for permission.
private void callVideo() {
try {
Call call = getSinchServiceInterface().callVideoUser(mVoipContact.getUserName());
if (call == null) {
// Service failed for some reason, show a Toast and abort
Toast.makeText(getApplicationContext(), getString(R.string.txt_service_not_started) + getString(R.string.txt_placing_call), Toast.LENGTH_LONG).show();
return;
}
String callId = call.getCallId();
Intent callScreen = new Intent(getApplicationContext(), VideoCallScreenActivity.class);
callScreen.putExtra(VoipConstants.CALL_ID, callId);
startActivity(callScreen);
} catch (MissingPermissionException e) {
ActivityCompat.requestPermissions(MessagingActivity.this, new String[]{e.getRequiredPermission()}, REQUEST_CODE_PERMISSION_CALL);
}
}
Now i can see below log cat error
VideoCapturerAndroid: Camera freezed: Camera failure.