Skip to content

Add mirrorStream support to ParticipantVideo for video mirroring#1665

Open
rahul-lohra wants to merge 3 commits intodevelopfrom
feature/rahullohra/expose-video-renderer-modifier
Open

Add mirrorStream support to ParticipantVideo for video mirroring#1665
rahul-lohra wants to merge 3 commits intodevelopfrom
feature/rahullohra/expose-video-renderer-modifier

Conversation

@rahul-lohra
Copy link
Copy Markdown
Contributor

@rahul-lohra rahul-lohra commented Apr 30, 2026

Goal

We currently do not provide any API to mirror participant video streams. This limitation was raised in Stream Video Android Issue #1657

Mirroring is a common requirement, especially for:

  • front camera preview parity (self-view)
  • UI consistency across platforms

Implementation

This PR introduces a new parameter mirrorStream in ParticipantVideo, allowing developers to control horizontal mirroring of the rendered video stream.

The mirroring is applied at the rendering layer using the underlying WebRTC renderer, ensuring minimal performance overhead.

Usage

CallContent(
    videoRenderer = { modifier, call, participant, style ->
        ParticipantVideo(mirrorStream = (participant.sessionId != me?.sessionId)..)
     }
} 

Notes

  • Mirroring is handled at the renderer level (not via UI transforms), avoiding additional composition cost.
  • Defaults are preserved; existing behavior remains unchanged unless explicitly enabled.
  • Provides flexibility without exposing rendering internals to the UI layer.

🎨 UI Changes

None

Testing

Join a video call with 2 people, see that the other user is not mirrored

Summary by CodeRabbit

  • New Features
    • Improved video participant rendering with enhanced mirroring behavior. Remote participants' video streams are now properly mirrored for optimal display orientation, while local participant video is rendered appropriately without unnecessary mirroring adjustments in video calls.

@rahul-lohra rahul-lohra self-assigned this Apr 30, 2026
@rahul-lohra rahul-lohra added the pr:new-feature Adds new functionality label Apr 30, 2026
@rahul-lohra rahul-lohra requested a review from a team as a code owner April 30, 2026 05:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@rahul-lohra rahul-lohra changed the title Add mirrorStream support to ParticipantVideo for video mirroring [AND-1164] Add mirrorStream support to ParticipantVideo for video mirroring Apr 30, 2026
@rahul-lohra rahul-lohra changed the title [AND-1164] Add mirrorStream support to ParticipantVideo for video mirroring Add mirrorStream support to ParticipantVideo for video mirroring Apr 30, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Walkthrough

A mirrorStream boolean parameter is added to video rendering components, computed by comparing each participant's session ID against the local user's session ID to conditionally mirror non-local participant video streams.

Changes

Cohort / File(s) Summary
Video Mirror Parameter Addition
stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt, demo-app/src/main/kotlin/io/getstream/video/android/ui/call/CallScreen.kt
Introduces mirrorStream: Boolean = false parameter to ParticipantVideo and ParticipantVideoRenderer composables. Parameter is computed in CallScreen by comparing participant session ID to local user session ID and forwarded to the renderer where it affects the mirror state calculation.
Public API Signature Updates
stream-video-android-ui-compose/api/stream-video-android-ui-compose.api
Updates method signatures for ParticipantVideo and ParticipantVideoRenderer to include the new boolean mirrorStream parameter after VideoScalingType; removes previous overload signatures without this parameter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Whiskers twitch with glee,
Session IDs dance and see,
Local stays true, remote gets flipped,
Mirror logic, deftly scripted!
Participants now face the right way,

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description covers Goal, Implementation, and Testing sections. However, it lacks UI Changes screenshots/videos, contributor/reviewer checklists, and changelog updates required by the template. Complete the contributor checklist, include changelog updates, and verify all required documentation sections are addressed. The description lacks formal structure adherence.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding mirrorStream support to ParticipantVideo for video mirroring. It is clear, concise, and directly reflects the primary feature introduced.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/rahullohra/expose-video-renderer-modifier

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt`:
- Around line 268-271: The memoized `mirror` state uses remember with keys
(cameraDirection, mirrorStream) but reads `me?.sessionId` and
`participant.sessionId`, causing stale values when `me` changes; instead remove
the remember/mutableStateOf and compute `mirror` as a derived (immutable) value
directly from `mirrorStream`, `cameraDirection`, `me?.sessionId`, and
`participant.sessionId` (i.e., replace the remembered mutableState logic around
`mirror` with a plain val expression that uses those symbols).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ea5c9d74-bd58-4a1e-b216-c9e16570c816

📥 Commits

Reviewing files that changed from the base of the PR and between 1d744dc and 5ad6bbe.

📒 Files selected for processing (3)
  • demo-app/src/main/kotlin/io/getstream/video/android/ui/call/CallScreen.kt
  • stream-video-android-ui-compose/api/stream-video-android-ui-compose.api
  • stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/renderer/ParticipantVideo.kt

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.02 MB 12.02 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.28 MB 6.28 MB 0.00 MB 🟢

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:new-feature Adds new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant