Apply proper rotation to buttons and video in landscape.

This commit is contained in:
Alex Hart
2021-01-29 16:22:01 -04:00
committed by Greyson Parrelli
parent e6e8786d86
commit 2678a00781
19 changed files with 326 additions and 35 deletions

View File

@@ -46,6 +46,7 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
@NonNull private CameraState.Direction activeDirection;
private boolean enabled;
private boolean isInitialized;
private int orientation;
public Camera(@NonNull Context context,
@NonNull CameraEventListener cameraEventListener,
@@ -81,6 +82,7 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
capturer.initialize(SurfaceTextureHelper.create("WebRTC-SurfaceTextureHelper", eglBase.getEglBaseContext()),
context,
observer);
capturer.setOrientation(orientation);
isInitialized = true;
}
}
@@ -99,6 +101,15 @@ public class Camera implements CameraControl, CameraVideoCapturer.CameraSwitchHa
capturer.switchCamera(this);
}
@Override
public void setOrientation(@Nullable Integer orientation) {
this.orientation = orientation;
if (isInitialized && capturer != null) {
capturer.setOrientation(orientation);
}
}
@Override
public void setEnabled(boolean enabled) {
Log.i(TAG, "setEnabled(): " + enabled);