mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-03 13:47:45 +00:00
SES-1354 - Video call self viewer not mirrored (#1397)
* Fixes #874 * Removed accidentally left in line * Fixed issue - push before cleanup * Cleaned up * Removed cruft --------- Co-authored-by: = <=> Co-authored-by: AL-Session <160798022+AL-Session@users.noreply.github.com>
This commit is contained in:
parent
36edca855c
commit
8c2aaa06d8
@ -334,6 +334,10 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() {
|
||||
if (isEnabled) {
|
||||
viewModel.localRenderer?.let { surfaceView ->
|
||||
surfaceView.setZOrderOnTop(true)
|
||||
|
||||
// Mirror the video preview of the person making the call to prevent disorienting them
|
||||
surfaceView.setMirror(true)
|
||||
|
||||
binding.localRenderer.addView(surfaceView)
|
||||
}
|
||||
}
|
||||
|
@ -408,6 +408,10 @@ class CallManager(
|
||||
|
||||
override fun onCameraSwitchCompleted(newCameraState: CameraState) {
|
||||
localCameraState = newCameraState
|
||||
|
||||
// If the camera we've switched to is the front one then mirror it to match what someone
|
||||
// would see when looking in the mirror rather than the left<-->right flipped version.
|
||||
localRenderer?.setMirror(localCameraState.activeDirection == CameraState.Direction.FRONT)
|
||||
}
|
||||
|
||||
fun onPreOffer(callId: UUID, recipient: Recipient, onSuccess: () -> Unit) {
|
||||
@ -639,7 +643,11 @@ class CallManager(
|
||||
peerConnection?.let { connection ->
|
||||
connection.flipCamera()
|
||||
localCameraState = connection.getCameraState()
|
||||
localRenderer?.setMirror(localCameraState.activeDirection == CameraState.Direction.FRONT)
|
||||
|
||||
// Note: We cannot set the mirrored state of the localRenderer here because
|
||||
// localCameraState.activeDirection is still PENDING (not FRONT or BACK) until the flip
|
||||
// completes and we hit Camera.onCameraSwitchDone (followed by PeerConnectionWrapper.onCameraSwitchCompleted
|
||||
// and CallManager.onCameraSwitchCompleted).
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,8 +326,6 @@ class PeerConnectionWrapper(private val context: Context,
|
||||
}
|
||||
|
||||
override fun onCameraSwitchCompleted(newCameraState: CameraState) {
|
||||
// mirror rotation offset
|
||||
rotationVideoSink.mirrored = newCameraState.activeDirection == CameraState.Direction.FRONT
|
||||
cameraEventListener.onCameraSwitchCompleted(newCameraState)
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class Camera(context: Context,
|
||||
Log.w(TAG, "Tried to flip camera without capturer or less than 2 cameras")
|
||||
return
|
||||
}
|
||||
activeDirection = PENDING
|
||||
activeDirection = PENDING // Note: The activeDirection will be PENDING until `onCameraSwitchDone`
|
||||
capturer.switchCamera(this)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user