Maybe it is not ideal but the following solved my problem.
First of all it is OK to have fewer number of IceCandidate
s. During creation of IceCandidate
s on my side, sdpMid
fields still don't contain video value -i receive both video and audio values for sdpMid
key in IceCandidate
s from socket connection-.
All I had to do was to touch my views again after the connection is set with the following methods.
I walked through these here and here.
private void updateVideoViews(final boolean remoteVisible) {
activity.runOnUiThread(() -> {
ViewGroup.LayoutParams params = localVideoView.getLayoutParams();
ViewGroup.LayoutParams params2 = remoteVideoView.getLayoutParams();
if (remoteVisible) {
params.height = dpToPx(100);
params.width = dpToPx(100);
params2.height = dpToPx(100);
params2.width = dpToPx(100);
} else {
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params2 = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
localVideoView.setLayoutParams(params);
remoteVideoView.setLayoutParams(params2);
});
}
public int dpToPx(int dp) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
}