Fixed switch to fullscreen when video conference starts

This commit is contained in:
Sylvain Berfini 2022-03-01 12:05:56 +01:00
parent 00d7f93094
commit e34965d524
2 changed files with 29 additions and 8 deletions

View file

@ -120,7 +120,7 @@ class CallActivity : ProximitySensorActivity() {
override fun onUserLeaveHint() { override fun onUserLeaveHint() {
super.onUserLeaveHint() super.onUserLeaveHint()
if (coreContext.core.currentCall?.currentParams?.isVideoEnabled ?: false) { if (coreContext.core.currentCall?.currentParams?.isVideoEnabled == true) {
Log.i("[Call] Entering PiP mode") Log.i("[Call] Entering PiP mode")
Compatibility.enterPipMode(this) Compatibility.enterPipMode(this)
} }

View file

@ -134,13 +134,15 @@ class ActiveCallOrConferenceFragment : GenericFragment<VoipActiveCallOrConferenc
conferenceViewModel.conference.observe( conferenceViewModel.conference.observe(
viewLifecycleOwner viewLifecycleOwner
) { conference -> ) { conference ->
if (corePreferences.enableFullScreenWhenJoiningVideoConference) { if (conference != null) switchToFullScreenIfPossible(conference)
if (conference != null && conference.currentParams.isVideoEnabled) { }
if (conference.me.devices.find { it.getStreamAvailability(StreamType.Video) } != null) {
Log.i("[Call] Conference is video & our device has video enabled, enabling full screen mode") conferenceViewModel.conferenceCreationPending.observe(
controlsViewModel.fullScreenMode.value = true viewLifecycleOwner
} ) { creationPending ->
} if (!creationPending) {
val conference = conferenceViewModel.conference.value
if (conference != null) switchToFullScreenIfPossible(conference)
} }
} }
@ -321,6 +323,25 @@ class ActiveCallOrConferenceFragment : GenericFragment<VoipActiveCallOrConferenc
dialog?.show() dialog?.show()
} }
private fun switchToFullScreenIfPossible(conference: Conference) {
if (corePreferences.enableFullScreenWhenJoiningVideoConference) {
if (conference.currentParams.isVideoEnabled) {
when {
conference.me.devices.isEmpty() -> {
Log.w("[Call] Conference has video enabled but either our device hasn't joined yet")
}
conference.me.devices.find { it.getStreamAvailability(StreamType.Video) } != null -> {
Log.i("[Call] Conference has video enabled & our device has video enabled, enabling full screen mode")
controlsViewModel.fullScreenMode.value = true
}
else -> {
Log.w("[Call] Conference has video enabled but our device video is disabled")
}
}
}
}
}
private fun goToChat() { private fun goToChat() {
val intent = Intent() val intent = Intent()
intent.setClass(requireContext(), MainActivity::class.java) intent.setClass(requireContext(), MainActivity::class.java)