mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Showing floating video inset only when there is at least one video stream active, hiding it when both are inactive
This commit is contained in:
parent
1bc35723fa
commit
f9e9bc86d2
@ -247,6 +247,12 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We need to track the device's orientation so we can calculate whether or not to rotate the video streams
|
||||||
|
* This works a lot better than using `OrientationEventListener > onOrientationChanged'
|
||||||
|
* which gives us a rotation angle that doesn't take into account pitch vs roll, so tipping the device from front to back would
|
||||||
|
* trigger the video rotation logic, while we really only want it when the device is in portrait or landscape.
|
||||||
|
*/
|
||||||
override fun onSensorChanged(event: SensorEvent) {
|
override fun onSensorChanged(event: SensorEvent) {
|
||||||
if (event.sensor.type == Sensor.TYPE_ROTATION_VECTOR) {
|
if (event.sensor.type == Sensor.TYPE_ROTATION_VECTOR) {
|
||||||
// Get the quaternion from the rotation vector sensor
|
// Get the quaternion from the rotation vector sensor
|
||||||
@ -268,7 +274,6 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
|||||||
|
|
||||||
if (currentOrientation != lastOrientation) {
|
if (currentOrientation != lastOrientation) {
|
||||||
lastOrientation = currentOrientation
|
lastOrientation = currentOrientation
|
||||||
Log.d("", "*********** orientation: $currentOrientation")
|
|
||||||
viewModel.deviceOrientation = currentOrientation
|
viewModel.deviceOrientation = currentOrientation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,12 +427,22 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle video windows
|
// handle video state
|
||||||
launch {
|
launch {
|
||||||
viewModel.videoState.collect { state ->
|
viewModel.videoState.collect { state ->
|
||||||
binding.floatingRenderer.removeAllViews()
|
binding.floatingRenderer.removeAllViews()
|
||||||
binding.fullscreenRenderer.removeAllViews()
|
binding.fullscreenRenderer.removeAllViews()
|
||||||
|
|
||||||
|
// the floating video inset (empty or not) should be shown
|
||||||
|
// the moment we have either of the video streams
|
||||||
|
if(!state.userVideoEnabled && !state.remoteVideoEnabled){
|
||||||
|
binding.floatingRendererContainer.isVisible = false
|
||||||
|
binding.swapViewIcon.isVisible = false
|
||||||
|
} else {
|
||||||
|
binding.floatingRendererContainer.isVisible = true
|
||||||
|
binding.swapViewIcon.isVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
// handle fullscreen video window
|
// handle fullscreen video window
|
||||||
if(state.showFullscreenVideo()){
|
if(state.showFullscreenVideo()){
|
||||||
viewModel.fullscreenRenderer?.let { surfaceView ->
|
viewModel.fullscreenRenderer?.let { surfaceView ->
|
||||||
|
@ -628,9 +628,7 @@ class CallManager(
|
|||||||
_videoState.value = _videoState.value.copy(swapped = videoSwapped)
|
_videoState.value = _videoState.value.copy(swapped = videoSwapped)
|
||||||
handleMirroring()
|
handleMirroring()
|
||||||
|
|
||||||
//todo TOM received rotated video shouldn't be full scale
|
//todo TOM floating inset loses its rounded corners when the second surfaceview is added
|
||||||
//todo TOM make sure the swap icon is visible
|
|
||||||
//todo TOM Should we show the 'no video' inset straight away?
|
|
||||||
//todo TOM ios rotates the controls in landscape ( just the buttons though, not the whole ui??)
|
//todo TOM ios rotates the controls in landscape ( just the buttons though, not the whole ui??)
|
||||||
|
|
||||||
if (!videoSwapped) {
|
if (!videoSwapped) {
|
||||||
|
Loading…
Reference in New Issue
Block a user