Skip to content

Commit

Permalink
fix: more robust mirror rendering detection (#624)
Browse files Browse the repository at this point in the history
use settings (see also flutter-webrtc/flutter-webrtc#1695) to detect front/back facing camera
  • Loading branch information
holzgeist authored Nov 29, 2024
1 parent 3a9540a commit 9f00bf8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/widgets/video_track_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ class _VideoTrackRendererState extends State<VideoTrackRenderer> {
if (widget.mirrorMode == VideoViewMirrorMode.auto) {
final track = widget.track;
if (track is LocalVideoTrack) {
final settings = track.mediaStreamTrack.getSettings();
final facingMode = settings['facingMode'];
if (facingMode != null) {
return facingMode == 'user';
}
final options = track.currentOptions;
if (options is CameraCaptureOptions) {
// mirror if front camera
Expand Down

0 comments on commit 9f00bf8

Please sign in to comment.