Youtube-like double tap to forward/rewind animation with ripple effect.
Please feel free to make pull requests.
To run the example project, clone the repo, and run pod install
from the Example directory first.
VideoQuickSeeking is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'VideoQuickSeeking'
let quickSeekingView = QuickSeekingView(seekingDuration: 10)
To achieve ripple effect, add QuickSeekingView onto the top of video player view. Handle double tap gesture of video player view and pass it to QuickSeekingView.
let doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(doubleTap))
doubleTapGesture.numberOfTapsRequired = 2
<video_player_view>.addGestureRecognizer(doubleTapGesture)
@objc private func doubleTap(_ sender: UIGestureRecognizer) {
let point = sender.location(in: self.quickSeekingView)
// Pass touch point to QuickSeekingView here
}
The following methods are available on QuickSeekingView.
Set the expected style of ripple effect
func setRippleStyle(color: UIColor,
withRippleAlpha rippleAlpha: CGFloat,
withBackgroundAlpha backgroundAlpha: CGFloat)
Get the direction(Forward/Rewind) of the current point
func directionOfPoint(point: CGPoint) -> FRDirection?
Perform ripple effect at a specific point
func animate(direction: FRDirection, at point: CGPoint,shouldResetSeekingCounter: Bool = false)
Hai Pham, [email protected]
This project reuse RippleLayer of Twho
VideoQuickSeeking is available under the MIT license. See the LICENSE file for more info.