diff --git a/build.gradle b/build.gradle index 3de6c61..9d1ea98 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:3.4.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1a71ef..1ef657d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Aug 30 13:59:30 EEST 2016 +#Fri Apr 26 16:01:04 PKT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/webrtcpeer-android/build.gradle b/webrtcpeer-android/build.gradle index 9177040..e7c14e0 100644 --- a/webrtcpeer-android/build.gradle +++ b/webrtcpeer-android/build.gradle @@ -5,12 +5,11 @@ apply plugin: "com.jfrog.bintray" version "1.1.1" android { - compileSdkVersion 25 - buildToolsVersion '23.0.2' + compileSdkVersion 28 defaultConfig { minSdkVersion 15 - targetSdkVersion 25 + targetSdkVersion 28 versionCode 1 versionName "1.1.1" } @@ -24,9 +23,9 @@ android { dependencies { // compile fileTree(dir: 'libs', include: ['*.jar']) - testCompile 'junit:junit:4.12' - compile('fi.vtt.nubomedia:utilities-android:1.0.2@aar') { transitive=true } - compile('io.pristine:libjingle:11139@aar') { transitive=true } + testImplementation 'junit:junit:4.12' + implementation('fi.vtt.nubomedia:utilities-android:1.0.2@aar') { transitive=true } + implementation('io.pristine:libjingle:11139@aar') { transitive=true } } def siteUrl = 'https://github.com/nubomedia-vtt/webrtcpeer-android' // Homepage URL of the library diff --git a/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/MediaResourceManager.java b/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/MediaResourceManager.java index 74453c2..7acae1d 100644 --- a/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/MediaResourceManager.java +++ b/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/MediaResourceManager.java @@ -101,7 +101,8 @@ final class MediaResourceManager implements NBMWebRTCPeer.Observer { private MediaConstraints audioConstraints; private MediaConstraints sdpMediaConstraints; private boolean videoCallEnabled; - private boolean renderVideo; + private boolean renderLocalVideo; + private boolean renderRemoteVideo; private boolean videoSourceStopped; private MediaStream localMediaStream; private VideoSource videoSource; @@ -121,7 +122,8 @@ final class MediaResourceManager implements NBMWebRTCPeer.Observer { this.localMediaStream = null; this.executor = executor; this.factory = factory; - renderVideo = true; + renderLocalVideo = true; + renderRemoteVideo = true; remoteVideoTracks = new HashMap<>(); remoteVideoRenderers = new HashMap<>(); remoteVideoMediaStreams = new HashMap<>(); @@ -238,7 +240,7 @@ public void run() { private VideoTrack createCapturerVideoTrack(VideoCapturerAndroid capturer) { videoSource = factory.createVideoSource(capturer, videoConstraints); localVideoTrack = factory.createVideoTrack(VIDEO_TRACK_ID, videoSource); - localVideoTrack.setEnabled(renderVideo); + localVideoTrack.setEnabled(renderLocalVideo); localVideoTrack.addRenderer(new VideoRenderer(localRender)); return localVideoTrack; } @@ -259,7 +261,7 @@ public void run() { // Get the video track VideoTrack remoteVideoTrack = remoteStream.videoTracks.get(0); // Set video track enabled if we have enabled video rendering - remoteVideoTrack.setEnabled(renderVideo); + remoteVideoTrack.setEnabled(renderRemoteVideo); VideoRenderer videoRenderer = remoteVideoRenderers.get(remoteRender); if (videoRenderer != null) { @@ -375,23 +377,35 @@ public void run() { }); } - void setVideoEnabled(final boolean enable) { + void setLocalVideoEnabled(final boolean enable) { executor.execute(new Runnable() { @Override public void run() { - renderVideo = enable; + renderLocalVideo = enable; if (localVideoTrack != null) { - localVideoTrack.setEnabled(renderVideo); + localVideoTrack.setEnabled(renderLocalVideo); } + } + }); + } + + void setRemoteVideoEnabled(final boolean enable) { + executor.execute(new Runnable() { + @Override + public void run() { + renderRemoteVideo = enable; for (VideoTrack tv : remoteVideoTracks.values()) { - tv.setEnabled(renderVideo); + tv.setEnabled(renderRemoteVideo); } } }); } - boolean getVideoEnabled(){ - return renderVideo; + boolean getRemoteVideoEnabled(){ + return renderRemoteVideo; + } + boolean getLocalVideoEnabled(){ + return renderLocalVideo; } boolean hasCameraPosition(NBMMediaConfiguration.NBMCameraPosition position){ diff --git a/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/NBMWebRTCPeer.java b/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/NBMWebRTCPeer.java index 88538d0..97c62b2 100644 --- a/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/NBMWebRTCPeer.java +++ b/webrtcpeer-android/src/main/java/fi/vtt/nubomedia/webrtcpeerandroid/NBMWebRTCPeer.java @@ -209,8 +209,8 @@ public SignalingParameters( * Peer connection parameters. */ public static class NBMPeerConnectionParameters { - public final boolean videoCallEnabled; - public final boolean loopback; + public boolean videoCallEnabled; + public boolean loopback; public final int videoWidth; public final int videoHeight; public final int videoFps; @@ -608,7 +608,7 @@ public boolean hasCameraPosition(NBMMediaConfiguration.NBMCameraPosition positio */ @SuppressWarnings("unused") public boolean videoEnabled(){ - return mediaResourceManager.getVideoEnabled(); + return mediaResourceManager.getRemoteVideoEnabled(); } /** @@ -617,7 +617,7 @@ public boolean videoEnabled(){ */ @SuppressWarnings("unused") public void enableVideo(boolean enable){ - mediaResourceManager.setVideoEnabled(enable); + mediaResourceManager.setLocalVideoEnabled(enable); } /**