From 5e07d997779a5610229b085fad8caa69b6c7b15e Mon Sep 17 00:00:00 2001 From: Luuk Date: Thu, 1 Oct 2020 00:03:31 +0200 Subject: [PATCH] conditionally republish video on resume --- .../main/java/com/twiliorn/library/CustomTwilioVideoView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java b/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java index e4f0234a..e0129f5d 100644 --- a/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java +++ b/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java @@ -164,6 +164,7 @@ public class CustomTwilioVideoView extends View implements LifecycleEventListene */ private static PatchedVideoView thumbnailVideoView; private static LocalVideoTrack localVideoTrack; + private boolean isLocalVideoPublished = false; private static CameraCapturer cameraCapturer; private LocalAudioTrack localAudioTrack; @@ -301,7 +302,7 @@ public void onHostResume() { /* * If connected to a Room then share the local video track. */ - if (localParticipant != null) { + if (localParticipant != null && isLocalVideoPublished) { localParticipant.publishTrack(localVideoTrack); } } @@ -588,6 +589,7 @@ public void toggleRemoteAudio(boolean enabled) { public void publishLocalVideo(boolean enabled) { if (localParticipant != null && localVideoTrack != null) { + isLocalVideoPublished = enabled; if (enabled) { localParticipant.publishTrack(localVideoTrack); } else {