VideoQuickSeeking
Youtube-like double tap to forward/rewind animation with ripple effect.
Please feel free to make pull requests.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
VideoQuickSeeking is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'VideoQuickSeeking'
Usage In Swift
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.
1. setRippleStyle
Set the expected style of ripple effect
func setRippleStyle(color: UIColor,
withRippleAlpha rippleAlpha: CGFloat,
withBackgroundAlpha backgroundAlpha: CGFloat)
2. directionOfPoint
Get the direction(Forward/Rewind) of the current point
func directionOfPoint(point: CGPoint) -> FRDirection?
3. animate
Perform ripple effect at a specific point
func animate(direction: FRDirection, at point: CGPoint,shouldResetSeekingCounter: Bool = false)
Author
Hai Pham, [email protected]
Inspired
This project reuse RippleLayer of Twho
License
VideoQuickSeeking is available under the MIT license. See the LICENSE file for more info.