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

Update mirroring #1190

Merged
merged 3 commits into from
Sep 25, 2024
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 @@ -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,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
}
Expand Down Expand Up @@ -180,6 +183,7 @@ private fun cleanTrack(
}
}
}

private fun setupVideo(
mediaTrack: MediaTrack?,
renderer: VideoTextureViewRenderer,
Expand Down
Loading