Merge pull request #2120 from vitorpamplona/claude/fix-voice-to-video-upgrade-XcRvN

Improve video call detection to include active video streams
This commit is contained in:
Vitor Pamplona
2026-04-03 17:31:23 -04:00
committed by GitHub
@@ -412,7 +412,10 @@ private fun ConnectedCallUI(
val isAudioMuted by (callController?.isAudioMuted ?: defaultFalse).collectAsState() val isAudioMuted by (callController?.isAudioMuted ?: defaultFalse).collectAsState()
val isVideoEnabled by (callController?.isVideoEnabled ?: defaultTrue).collectAsState() val isVideoEnabled by (callController?.isVideoEnabled ?: defaultTrue).collectAsState()
val currentAudioRoute by (callController?.audioRoute ?: defaultRoute).collectAsState() val currentAudioRoute by (callController?.audioRoute ?: defaultRoute).collectAsState()
val isVideoCall = state.callType == com.vitorpamplona.quartz.nipACWebRtcCalls.tags.CallType.VIDEO val hasActiveVideo =
state.callType == com.vitorpamplona.quartz.nipACWebRtcCalls.tags.CallType.VIDEO ||
isVideoEnabled ||
remoteVideoTracks.isNotEmpty()
var showAddParticipant by remember { mutableStateOf(false) } var showAddParticipant by remember { mutableStateOf(false) }
@@ -439,7 +442,7 @@ private fun ConnectedCallUI(
state.allPeerPubKeys - accountViewModel.account.signer.pubKey state.allPeerPubKeys - accountViewModel.account.signer.pubKey
} }
if (isVideoCall) { if (hasActiveVideo) {
// Video call: always show the peer grid with video for active peers, avatar for inactive // Video call: always show the peer grid with video for active peers, avatar for inactive
PeerVideoGrid( PeerVideoGrid(
peerPubKeys = otherMembers, peerPubKeys = otherMembers,
@@ -802,7 +805,11 @@ private fun PipConnectedCallUI(
val activePeerVideos by (callController?.activePeerVideos ?: emptySetFlow).collectAsState() val activePeerVideos by (callController?.activePeerVideos ?: emptySetFlow).collectAsState()
val defaultFalse = remember { kotlinx.coroutines.flow.MutableStateFlow(false) } val defaultFalse = remember { kotlinx.coroutines.flow.MutableStateFlow(false) }
val isRemoteVideoActive by (callController?.isRemoteVideoActive ?: defaultFalse).collectAsState() val isRemoteVideoActive by (callController?.isRemoteVideoActive ?: defaultFalse).collectAsState()
val isVideoCall = state.callType == com.vitorpamplona.quartz.nipACWebRtcCalls.tags.CallType.VIDEO val isVideoEnabled by (callController?.isVideoEnabled ?: defaultFalse).collectAsState()
val hasActiveVideo =
state.callType == com.vitorpamplona.quartz.nipACWebRtcCalls.tags.CallType.VIDEO ||
isVideoEnabled ||
remoteVideoTracks.isNotEmpty()
val otherMembers = val otherMembers =
remember(state.allPeerPubKeys) { remember(state.allPeerPubKeys) {
@@ -815,8 +822,8 @@ private fun PipConnectedCallUI(
.fillMaxSize() .fillMaxSize()
.background(Color.Black), .background(Color.Black),
) { ) {
if (isVideoCall) { if (hasActiveVideo) {
// Video call: show first active peer's video or avatar // Video active: show first active peer's video or avatar
val firstActivePeer = otherMembers.firstOrNull { it in activePeerVideos } val firstActivePeer = otherMembers.firstOrNull { it in activePeerVideos }
val activeTrack = firstActivePeer?.let { remoteVideoTracks[it] } val activeTrack = firstActivePeer?.let { remoteVideoTracks[it] }
if (activeTrack != null) { if (activeTrack != null) {