in azure-communication-ui/calling/src/main/java/com/azure/android/communication/ui/calling/presentation/fragment/calling/localuser/LocalParticipantViewModel.kt [107:145]
fun init(
displayName: String?,
audioOperationalStatus: AudioOperationalStatus,
videoStreamID: String?,
numberOfRemoteParticipants: Int,
callingState: CallingStatus,
cameraDeviceSelectionStatus: CameraDeviceSelectionStatus,
camerasCount: Int,
pipStatus: VisibilityStatus,
avMode: CallCompositeAudioVideoMode,
isOverlayDisplayedOverGrid: Boolean,
) {
val viewMode = getLocalParticipantViewMode(numberOfRemoteParticipants)
val displayVideo = shouldDisplayVideo(videoStreamID)
val displayFullScreenAvatar =
shouldDisplayFullScreenAvatar(displayVideo, viewMode, callingState)
videoStatusFlow = MutableStateFlow(VideoModel(displayVideo, videoStreamID, viewMode))
displayNameStateFlow = MutableStateFlow(displayName)
localUserMutedStateFlow =
MutableStateFlow(audioOperationalStatus == AudioOperationalStatus.OFF)
displayFullScreenAvatarFlow = MutableStateFlow(displayFullScreenAvatar)
displaySwitchCameraButtonFlow =
MutableStateFlow(
displayVideo &&
viewMode == LocalParticipantViewMode.FULL_SCREEN && camerasCount > 1 &&
pipStatus == VisibilityStatus.VISIBLE
)
displayPipSwitchCameraButtonFlow =
MutableStateFlow(displayVideo && viewMode == LocalParticipantViewMode.SELFIE_PIP && camerasCount > 1)
enableCameraSwitchFlow = MutableStateFlow(
cameraDeviceSelectionStatus != CameraDeviceSelectionStatus.SWITCHING
)
cameraDeviceSelectionFlow = MutableStateFlow(cameraDeviceSelectionStatus)
isOverlayDisplayedFlow = MutableStateFlow(isOverlayDisplayedOverGrid)
numberOfRemoteParticipantsFlow = MutableStateFlow(numberOfRemoteParticipants)
isVisibleFlow = MutableStateFlow(isVisible(displayVideo, pipStatus, displayFullScreenAvatar, avMode))
}