Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Stream Video SDK 0.4.0 and complete video calling feature #111

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
Expand All @@ -33,7 +34,9 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import io.getstream.video.android.compose.theme.VideoTheme
import io.getstream.video.android.compose.ui.components.call.activecall.CallContent
import io.getstream.video.android.compose.ui.components.call.controls.ControlActions
import io.getstream.video.android.compose.ui.components.call.controls.actions.FlipCameraAction
import io.getstream.video.android.compose.ui.components.call.controls.actions.LeaveCallAction
import io.getstream.video.android.compose.ui.components.call.controls.actions.ToggleCameraAction
import io.getstream.video.android.compose.ui.components.call.controls.actions.ToggleMicrophoneAction
import io.getstream.video.android.core.Call
import io.getstream.whatsappclone.designsystem.component.WhatsAppLoadingIndicator
Expand Down Expand Up @@ -71,12 +74,15 @@ fun WhatsAppVideoCallContent(
videoCall: Boolean,
onBackPressed: () -> Unit
) {
val isCameraEnabled by call.camera.isEnabled.collectAsStateWithLifecycle()
val isMicrophoneEnabled by call.microphone.isEnabled.collectAsStateWithLifecycle()

LaunchedEffect(key1 = call.id) {
DisposableEffect(key1 = call.id) {
if (!videoCall) {
call.camera.setEnabled(false)
}

onDispose { call.leave() }
}

VideoTheme {
Expand All @@ -85,7 +91,37 @@ fun WhatsAppVideoCallContent(
onBackPressed = onBackPressed,
controlsContent = {
if (videoCall) {
ControlActions(call = call)
ControlActions(
call = call,
actions = listOf(
{
ToggleCameraAction(
modifier = Modifier.size(52.dp),
isCameraEnabled = isCameraEnabled,
onCallAction = { call.camera.setEnabled(it.isEnabled) }
)
},
{
ToggleMicrophoneAction(
modifier = Modifier.size(52.dp),
isMicrophoneEnabled = isMicrophoneEnabled,
onCallAction = { call.microphone.setEnabled(it.isEnabled) }
)
},
{
FlipCameraAction(
modifier = Modifier.size(52.dp),
onCallAction = { call.camera.flip() }
)
},
{
LeaveCallAction(
modifier = Modifier.size(52.dp),
onCallAction = { onBackPressed.invoke() }
)
}
)
)
} else {
ControlActions(
call = call,
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
streamChatSDK = "6.0.5"
streamVideoSDK = "0.3.4"
streamVideoSDK = "0.4.0"
streamLog = "1.1.4"
sealedx = "1.0.1"
landscapist = "2.2.10"
Expand All @@ -26,7 +26,7 @@ androidxTest = "1.5.0"
androidxTestExt = "1.1.3"
androidxTracing = "1.1.0"
androidxUiAutomator = "2.2.0"
composeStableMarker = "1.0.1"
composeStableMarker = "1.0.2"
hilt = "2.48.1"
hiltExt = "1.0.0"
junit4 = "4.13.2"
Expand Down