Created
October 24, 2020 18:41
-
-
Save rorodriguez116/38a7360a44d2f38cf0ef45cbdbe5adee to your computer and use it in GitHub Desktop.
Configuring the zoom factor in the video capture device.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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