lib/project/motion-capture.rb
def update_video_orientation!
    photo_output.connectionWithMediaType(AVMediaTypeVideo).tap do |connection|
      device_orientation = UIDevice.currentDevice.orientation
      video_orientation  = orientation_mapping.fetch(device_orientation, AVCaptureVideoOrientationPortrait)

      connection.setVideoOrientation(video_orientation) if connection.videoOrientationSupported?
    end
  end
def update_video_orientation!
    photo_output.connectionWithMediaType(AVMediaTypeVideo).tap do |connection|
      device_orientation = UIDevice.currentDevice.orientation
      video_orientation  = orientation_mapping.fetch(device_orientation, AVCaptureVideoOrientationPortrait)

      connection.setVideoOrientation(video_orientation) if connection.videoOrientationSupported?
    end
  end
iOS 10+