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() {
super.onUserLeaveHint()
if (coreContext.core.currentCall?.currentParams?.isVideoEnabled ?: false) {
if (coreContext.core.currentCall?.currentParams?.isVideoEnabled == true) {
Log.i("[Call] Entering PiP mode")
Compatibility.enterPipMode(this)
}

View file

@ -134,13 +134,15 @@ class ActiveCallOrConferenceFragment : GenericFragment<VoipActiveCallOrConferenc
conferenceViewModel.conference.observe(
viewLifecycleOwner
) { conference ->
if (corePreferences.enableFullScreenWhenJoiningVideoConference) {
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")
controlsViewModel.fullScreenMode.value = true
}
}
if (conference != null) switchToFullScreenIfPossible(conference)
}
conferenceViewModel.conferenceCreationPending.observe(
viewLifecycleOwner
) { creationPending ->
if (!creationPending) {
val conference = conferenceViewModel.conference.value
if (conference != null) switchToFullScreenIfPossible(conference)
}
}
@ -321,6 +323,25 @@ class ActiveCallOrConferenceFragment : GenericFragment<VoipActiveCallOrConferenc
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() {
val intent = Intent()
intent.setClass(requireContext(), MainActivity::class.java)