Some progress

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-11-29 22:40:29 +01:00
parent f7febd355b
commit 4671575418
4 changed files with 30 additions and 25 deletions

View File

@ -68,6 +68,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
implementation "com.android.support:percent:${supportLibraryVersion}"
implementation 'com.android.support:multidex:1.0.2'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

View File

@ -34,8 +34,7 @@ import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.GridLayout;
import android.widget.RelativeLayout;
import android.widget.LinearLayout;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
@ -106,8 +105,8 @@ public class CallActivity extends AppCompatActivity {
@BindView(R.id.pip_video_view)
SurfaceViewRenderer pipVideoView;
@BindView(R.id.videos_grid_view)
GridLayout videosGrid;
@BindView(R.id.remote_renderers_layout)
LinearLayout remoteRenderersLayout;
@Inject
NcApi ncApi;
@ -449,9 +448,14 @@ public class CallActivity extends AppCompatActivity {
case "offer":
case "answer":
magicPeerConnectionWrapper.setNick(ncSignalingMessage.getPayload().getNick());
if (!magicPeerConnectionWrapper.getPeerConnection().signalingState().equals
(PeerConnection.SignalingState.STABLE) &&
magicPeerConnectionWrapper.getPeerConnection().getRemoteDescription() == null ||
magicPeerConnectionWrapper.getPeerConnection().getLocalDescription() == null) {
magicPeerConnectionWrapper.getPeerConnection().setRemoteDescription(magicPeerConnectionWrapper
.getMagicSdpObserver(), new SessionDescription(SessionDescription.Type.fromCanonicalForm(type),
ncSignalingMessage.getPayload().getSdp()));
}
break;
case "candidate":
NCIceCandidate ncIceCandidate = ncSignalingMessage.getPayload().getIceCandidate();
@ -617,11 +621,11 @@ public class CallActivity extends AppCompatActivity {
public void run() {
if (stream.videoTracks.size() == 1) {
try {
RelativeLayout relativeLayout = (RelativeLayout)
getLayoutInflater().inflate(R.layout.surface_renderer, videosGrid,
LinearLayout linearLayout = (LinearLayout)
getLayoutInflater().inflate(R.layout.surface_renderer, remoteRenderersLayout,
false);
relativeLayout.setTag(session);
SurfaceViewRenderer surfaceViewRenderer = relativeLayout.findViewById(R.id
linearLayout.setTag(session);
SurfaceViewRenderer surfaceViewRenderer = linearLayout.findViewById(R.id
.surface_view);
surfaceViewRenderer.setMirror(false);
surfaceViewRenderer.init(rootEglBase.getEglBaseContext(), null);
@ -631,7 +635,8 @@ public class CallActivity extends AppCompatActivity {
VideoRenderer remoteRenderer = new VideoRenderer(surfaceViewRenderer);
videoRendererHashMap.put(session, remoteRenderer);
videoTrack.addRenderer(remoteRenderer);
videosGrid.addView(relativeLayout);
remoteRenderersLayout.addView(linearLayout);
linearLayout.invalidate();
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -24,16 +24,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/relative_layout"
tools:context=".activities.CallActivity">
<GridLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/videos_grid_view"
android:columnCount="4"
android:rowCount="2">
</GridLayout>
android:layout_height="match_parent"
android:id="@+id/remote_renderers_layout"
android:orientation="vertical">
</LinearLayout>
<org.webrtc.SurfaceViewRenderer
android:id="@+id/pip_video_view"

View File

@ -19,12 +19,11 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative_layout"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<org.webrtc.SurfaceViewRenderer
@ -32,4 +31,4 @@
android:layout_height="match_parent"
android:id="@+id/surface_view"/>
</RelativeLayout>
</LinearLayout>