'Zoom upwards while recording video in Swift
I'm trying to do something like Snapchat does, while you are recording, if you drag upwards your finger, the video is zoomed. Does anyone know how to do it in Swift3 or if there's a pod that I can based on.
I'm using SCRecorder to record the video, which is based on AVFoundation Framework.
Here's a link of a video showing exactly what I want to do.
Thank you!
Solution 1:[1]
this solution might be helpful for others.You can use long press gesture to start recording video and pan gesture simultaneously to zoom upwards and downwards to zoom back.
let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture))
longGesture.delegate = self
panGestureRecognizer.delegate = self
self.addGestureRecognizer(panGestureRecognizer)
self.addGestureRecognizer(tapGesture)
self.addGestureRecognizer(longGesture)
extension CameraButton: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hamza Hashmi |