     
     private let camera: Camera = {
         var configurator = Camera.Configurator()
+        #if os(iOS)
+        let interfaceOrientation = UIApplication.shared.windows.first(where: { $0.windowScene != nil })?.windowScene?.interfaceOrientation
+        #endif
         configurator.videoConnectionConfigurator = { camera, connection in
             #if os(iOS)
-            switch UIApplication.shared.windows.first(where: { $0.windowScene != nil })?.windowScene?.interfaceOrientation {
+            switch interfaceOrientation {
             case .landscapeLeft:
                 connection.videoOrientation = .landscapeLeft
             case .landscapeRight:

            stateLock.lock()
            defer {
                stateLock.unlock()
            }
            _state = newValue
        }

        var isVideoMirrored: Bool = true
    }
    
    @Published private var stateChangeCount: Int = 0
    
    private var _state: State = State()
    
    private let stateLock = MTILockCreate()
    
