AVCaptureDevice: cancelVideoZoomRamp() method
The cancelVideoZoomRamp() method stops a smooth zoom started by rampToVideoZoomFactor(), leaving the picture at the factor reached at that moment.
Syntax
cancelVideoZoomRamp()Parameters
None.
Return value
None (undefined).
Exceptions
None. Calling it without lockForConfiguration() doesn't throw either (verified by testing).
Description
- Which factor the picture stops at, and what
videoZoomFactorreads afterwards, is not verified on a device. - Calling it when no zoom is in progress doesn't throw (verified by testing).
Examples
js
const device = AVCaptureDevice.defaultDeviceWithMediaType('video');
if (device !== null) {
device.lockForConfiguration();
try {
device.rampToVideoZoomFactor(Math.min(8, device.maxAvailableVideoZoomFactor), { withRate: 1 });
} finally {
device.unlockForConfiguration();
}
// Stop after one second
setTimeout(() => {
device.lockForConfiguration();
try {
device.cancelVideoZoomRamp();
} finally {
device.unlockForConfiguration();
}
}, 1000);
}Effect: the picture zooms in slowly and stops after one second, at about 2×. Not verified on a device.
Corresponding iOS API
-[AVCaptureDevice cancelVideoZoomRamp].
See also
rampToVideoZoomFactor(): start a smooth zoom