parent
763e14f25f
commit
d70213e031
4 changed files with 15 additions and 4 deletions
|
@ -35,7 +35,6 @@ import android.view.WindowManager;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.util.Consumer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
@ -469,7 +468,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
|
|||
.ifNecessary()
|
||||
.withRationaleDialog(getString(R.string.WebRtcCallActivity__to_call_s_signal_needs_access_to_your_camera, recipientDisplayName), R.drawable.ic_video_solid_24_tinted)
|
||||
.withPermanentDenialDialog(getString(R.string.WebRtcCallActivity__to_call_s_signal_needs_access_to_your_camera, recipientDisplayName))
|
||||
.onAllGranted(() -> ApplicationDependencies.getSignalCallManager().setMuteVideo(!muted))
|
||||
.onAllGranted(() -> ApplicationDependencies.getSignalCallManager().setEnableVideo(!muted))
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.ringrtc;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
|
@ -318,6 +317,7 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
|
|||
@Override
|
||||
public void onCapturerStopped() {
|
||||
observer.onCapturerStopped();
|
||||
cameraEventListener.onCameraStopped();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,13 @@ package org.thoughtcrime.securesms.ringrtc;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Event listener that are (indirectly) bound to WebRTC events.
|
||||
* onFullyInitialized and onCameraStopped are hardware lifecycle methods triggered by our implementation of {@link org.webrtc.CapturerObserver}
|
||||
* onCameraSwitchCompleted is triggered by {@link org.webrtc.CameraVideoCapturer.CameraSwitchHandler}
|
||||
*/
|
||||
public interface CameraEventListener {
|
||||
void onFullyInitialized();
|
||||
void onCameraSwitchCompleted(@NonNull CameraState newCameraState);
|
||||
void onCameraStopped();
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ private void processStateless(@NonNull Function1<WebRtcEphemeralState, WebRtcEph
|
|||
process((s, p) -> p.handleSetMuteAudio(s, enabled));
|
||||
}
|
||||
|
||||
public void setMuteVideo(boolean enabled) {
|
||||
public void setEnableVideo(boolean enabled) {
|
||||
process((s, p) -> p.handleSetEnableVideo(s, enabled));
|
||||
}
|
||||
|
||||
|
@ -817,6 +817,12 @@ private void processStateless(@NonNull Function1<WebRtcEphemeralState, WebRtcEph
|
|||
process((s, p) -> p.handleCameraSwitchCompleted(s, newCameraState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraStopped() {
|
||||
Log.i(TAG, "Camera error. Muting video.");
|
||||
setEnableVideo(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onForeground() {
|
||||
process((s, p) -> {
|
||||
|
|
Loading…
Add table
Reference in a new issue