diff --git a/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt b/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt index 53496d75fe..4414cb5f1c 100644 --- a/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt +++ b/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt @@ -250,18 +250,21 @@ public fun ParticipantVideoRenderer( val video by participant.video.collectAsStateWithLifecycle() val cameraDirection by call.camera.direction.collectAsStateWithLifecycle() val me by call.state.me.collectAsStateWithLifecycle() - val mirror by remember { - derivedStateOf { - participant.sessionId == me?.sessionId && cameraDirection == CameraDirection.Front + val mirror by remember(cameraDirection) { + mutableStateOf( + cameraDirection == CameraDirection.Front && me?.sessionId == participant.sessionId, + ) + } + val videoRendererConfig = remember(mirror, videoFallbackContent) { + videoRenderConfig { + mirrorStream = mirror + this.fallbackContent = videoFallbackContent } } VideoRenderer( call = call, video = video, - videoRendererConfig = videoRenderConfig { - mirrorStream = mirror - this.fallbackContent = videoFallbackContent - }, + videoRendererConfig = videoRendererConfig, ) } diff --git a/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/video/VideoRenderer.kt b/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/video/VideoRenderer.kt index 4077f9e3c5..5b39f960ca 100644 --- a/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/video/VideoRenderer.kt +++ b/stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/video/VideoRenderer.kt @@ -120,7 +120,10 @@ public fun VideoRenderer( view = this } }, - update = { v -> setupVideo(mediaTrack, v) }, + update = { v -> + v.setMirror(videoRendererConfig.mirrorStream) + setupVideo(mediaTrack, v) + }, modifier = modifier.testTag("video_renderer"), ) } @@ -180,6 +183,7 @@ private fun cleanTrack( } } } + private fun setupVideo( mediaTrack: MediaTrack?, renderer: VideoTextureViewRenderer,