From 9f00bf827778c86a6e230152383ac22af3c000ee Mon Sep 17 00:00:00 2001 From: holzgeist Date: Fri, 29 Nov 2024 15:16:13 +0100 Subject: [PATCH] fix: more robust mirror rendering detection (#624) use settings (see also https://github.com/flutter-webrtc/flutter-webrtc/pull/1695) to detect front/back facing camera --- lib/src/widgets/video_track_renderer.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/widgets/video_track_renderer.dart b/lib/src/widgets/video_track_renderer.dart index 5cd82886..6fba7707 100644 --- a/lib/src/widgets/video_track_renderer.dart +++ b/lib/src/widgets/video_track_renderer.dart @@ -212,6 +212,11 @@ class _VideoTrackRendererState extends State { 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