Trying to fix lost remote video upon rotation

This commit is contained in:
Sylvain Berfini 2024-04-15 12:20:11 +02:00
parent 3e845b32b6
commit c0b0ef66ff
2 changed files with 15 additions and 14 deletions

View file

@ -336,18 +336,14 @@ class ActiveCallFragment : GenericCallFragment() {
}
callViewModel.isSendingVideo.observe(viewLifecycleOwner) { sending ->
coreContext.core.nativePreviewWindowId = if (sending) {
binding.localPreviewVideoSurface
} else {
null
}
}
callViewModel.isReceivingVideo.observe(viewLifecycleOwner) { receiving ->
coreContext.core.nativeVideoWindowId = if (receiving) {
binding.remoteVideoSurface
} else {
null
coreContext.postOnCoreThread { core ->
core.nativePreviewWindowId = if (sending) {
Log.i("$TAG We are sending video, setting capture preview surface")
binding.localPreviewVideoSurface
} else {
Log.i("$TAG We are not sending video, clearing capture preview surface")
null
}
}
}
@ -384,6 +380,8 @@ class ActiveCallFragment : GenericCallFragment() {
super.onResume()
coreContext.postOnCoreThread { core ->
core.nativeVideoWindowId = binding.remoteVideoSurface
binding.localPreviewVideoSurface.setOnTouchListener(previewTouchListener)
// Need to be done manually

View file

@ -1070,12 +1070,15 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
@WorkerThread
private fun updateVideoDirection(direction: MediaDirection) {
val isSending = direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly
val isReceived = direction == MediaDirection.SendRecv || direction == MediaDirection.RecvOnly
isSendingVideo.postValue(
direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly
isSending
)
isReceivingVideo.postValue(
direction == MediaDirection.SendRecv || direction == MediaDirection.RecvOnly
isReceived
)
Log.i("$TAG Is video being sent? [$isSending] Is video being received? [$isReceived]")
}
@AnyThread