GetStream / stream-video-flutter

Flutter Video SDK - Build your own video app experience using Dart, Flutter and the Stream Video Messaging API.
https://getstream.io/video/docs/flutter/
Other
37 stars 11 forks source link

fix(video_renderer): disable mirroring for rendering local back camera stream #628

Closed TinhHuynh closed 1 month ago

TinhHuynh commented 1 month ago

๐ŸŽฏ Goal

Improve user experience by ensuring the video orientation matches user expectations. The change prevents mirroring for local back camera video streams, making the display more intuitive, especially in contexts where mirroring could confuse or degrade the viewing experience.

๐Ÿ›  Implementation details

Modified the StreamVideoRenderer class to detect if a video stream is local and from the back camera. If these conditions are met, the video is not mirrored. This involved checking the videoTrack's mediaConstraints.facingMode against FacingMode.environment to identify back camera usage and adjusting the mirror variable accordingly.

๐ŸŽจ UI Changes

Before After
Before Image After Image

๐Ÿงช Testing

  1. Test with front camera to ensure existing mirroring behavior remains unaffected.
  2. Switch to the back camera and confirm that mirroring is disabled.

This change targets the video rendering behavior, requiring live testing with video streams from both front and back cameras to validate the implementation.

โ˜‘๏ธ Contributor Checklist

โ˜‘๏ธ Reviewer Checklist


deven98 commented 1 month ago

Hey @TinhHuynh ๐Ÿ‘‹ , thanks for the contribution to the repo! I added a simple change that also stops mirroring the Screenshare track.

TinhHuynh commented 1 month ago

Hi @deven98 Thanks for reviewing and correcting the code!