def still_image_connection
    still_image_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 still_image_connection
    still_image_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 4-9