 
                 self.setVideoOrientation()
                 self.setVideoMirrored()
+
+                if sessionIsRunning {
+                    self.session.startRunning()
+                }
             }
         }
     }

            sessionQueue.async {
                guard self.isConfigured else { return }

                guard self.setSessionInput() else {
                    print("[Error] setSessionInput failed")
                    return

    // device orientation
    var deviceOrientation = UIDeviceOrientation.portrait {
        didSet {
            guard (deviceOrientation != oldValue) else { return }

            switch deviceOrientation {
            case .portrait,
                 .portraitUpsideDown,
                 .landscapeLeft,
                 .landscapeRight:
                sessionQueue.async {
                    guard self.isConfigured else { return }

                    let sessionIsRunning = self.session.isRunning
                    if sessionIsRunning {
                        self.session.stopRunning()
                    }

                    self.setVideoOrientation()

                    if sessionIsRunning {
                        self.session.startRunning()
                    }
                }
            default:
                deviceOrientation = oldValue
                break
            }
        }
