Skip to content

Instantly share code, notes, and snippets.

@rorodriguez116
Created October 24, 2020 18:41
Show Gist options
  • Save rorodriguez116/38a7360a44d2f38cf0ef45cbdbe5adee to your computer and use it in GitHub Desktop.
Save rorodriguez116/38a7360a44d2f38cf0ef45cbdbe5adee to your computer and use it in GitHub Desktop.
Configuring the zoom factor in the video capture device.
public func set(zoom: CGFloat){
let factor = zoom < 1 ? 1 : zoom
let device = self.videoDeviceInput.device
do {
try device.lockForConfiguration()
device.videoZoomFactor = factor
device.unlockForConfiguration()
}
catch {
print(error.localizedDescription)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment