@@ -207,11 +207,13 @@ public class NSCameraView: UIView, NextLevelVideoDelegate, NextLevelPhotoDelegat
207207 }
208208 public func toggleCamera( ) {
209209 self . nextLevel? . flipCaptureDevicePosition ( )
210- if self . _frontMirrored && let previewLayer = nextLevel. previewLayer {
211- previewLayer. connection? . automaticallyAdjustsVideoMirroring = false
212- previewLayer. connection? . isVideoMirrored = false // or true if you want mirrored
213- } else {
214- previewLayer. connection? . automaticallyAdjustsVideoMirroring = true
210+ if let previewLayer = nextLevel. previewLayer {
211+ if self . _frontMirrored {
212+ previewLayer. connection? . automaticallyAdjustsVideoMirroring = true
213+ } else {
214+ previewLayer. connection? . automaticallyAdjustsVideoMirroring = false
215+ previewLayer. connection? . isVideoMirrored = false // or true if you want mirrored
216+ }
215217 }
216218 }
217219 public func focusAtAdjustedPointOfInterest( _ adjustedPoint: CGPoint ) {
@@ -271,18 +273,20 @@ public class NSCameraView: UIView, NextLevelVideoDelegate, NextLevelPhotoDelegat
271273 }
272274 }
273275
274- private var _frontMirrored : Bool
276+ private var _frontMirrored : Bool = true
275277 public var frontMirrored : Bool {
276278 get {
277279 return self . frontMirrored
278280 }
279281 set {
280282 self . _frontMirrored = newValue
281- if newValue && let previewLayer = nextLevel. previewLayer {
282- previewLayer. connection? . automaticallyAdjustsVideoMirroring = false
283- previewLayer. connection? . isVideoMirrored = false // or true if you want mirrored
284- } else {
285- previewLayer. connection? . automaticallyAdjustsVideoMirroring = true
283+ if let previewLayer = nextLevel. previewLayer {
284+ if self . _frontMirrored {
285+ previewLayer. connection? . automaticallyAdjustsVideoMirroring = true
286+ } else {
287+ previewLayer. connection? . automaticallyAdjustsVideoMirroring = false
288+ previewLayer. connection? . isVideoMirrored = false // or true if you want mirrored
289+ }
286290 }
287291 }
288292 }
0 commit comments