Fixed auto full screen issue in conference

This commit is contained in:
Sylvain Berfini 2024-10-31 10:20:31 +01:00
parent 2be4f691f2
commit 6ad5f7573b
3 changed files with 36 additions and 5 deletions

View file

@ -226,6 +226,17 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
}
}
callViewModel.conferenceModel.firstParticipantOtherThanOurselvesJoinedEvent.observe(
viewLifecycleOwner
) {
it.consume {
if (callViewModel.fullScreenMode.value == false) {
Log.i("$TAG First participant joined conference, switching to full screen mode")
callViewModel.toggleFullScreen()
}
}
}
callViewModel.goToCallEvent.observe(viewLifecycleOwner) {
it.consume {
if (findNavController().currentDestination?.id == R.id.activeConferenceCallFragment) {

View file

@ -73,6 +73,10 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() {
val isMeAdmin = MutableLiveData<Boolean>()
val firstParticipantOtherThanOurselvesJoinedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val showLayoutMenuEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -90,6 +94,11 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() {
"$TAG Participant added: ${participant.address.asStringUriOnly()}"
)
addParticipant(participant)
if (conference.participantList.size == 1) { // we do not count
Log.i("$TAG First participant other than ourselves joined the conference")
firstParticipantOtherThanOurselvesJoinedEvent.postValue(Event(true))
}
}
@WorkerThread
@ -226,9 +235,13 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() {
if (conference.state == Conference.State.Created) {
val isIn = conference.isIn
isPaused.postValue(!isIn)
Log.i("$TAG We ${if (isIn) "are" else "aren't"} in the conference")
Log.i("$TAG We [${if (isIn) "are" else "aren't"}] in the conference")
computeParticipants(false)
if (conference.participantList.size >= 1) { // we do not count
Log.i("$TAG Joined conference already has at least another participant")
firstParticipantOtherThanOurselvesJoinedEvent.postValue(Event(true))
}
}
}
}
@ -278,6 +291,10 @@ class ConferenceViewModel @UiThread constructor() : GenericViewModel() {
if (conference.state == Conference.State.Created) {
computeParticipants(false)
if (conference.participantList.size >= 1) { // we do not count
Log.i("$TAG Joined conference already has at least another participant")
firstParticipantOtherThanOurselvesJoinedEvent.postValue(Event(true))
}
}
val currentLayout = getCurrentLayout(call)

View file

@ -1198,10 +1198,13 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
if (((isReceiving) && !wasReceiving)) {
if (fullScreenMode.value != true) {
Log.i(
"$TAG Video is being received (it wasn't before), switching to full-screen mode"
)
fullScreenMode.postValue(true)
val inConference = conferenceModel.isCurrentCallInConference.value == true
if (!inConference) {
Log.i(
"$TAG Video is being received (it wasn't before), switching to full-screen mode"
)
fullScreenMode.postValue(true)
}
}
} else if (!isSending && !isReceiving && fullScreenMode.value == true) {
Log.w("$TAG Video is no longer enabled, leaving full screen mode")