code: 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
docs: iOS 4-9