You do not normalize the location of the touch and the corresponding time values. Is there a 1: 1 ratio between the two? It's impossible.
Take the minimum and maximum values for the location of the touch pan gestures and the minimum and maximum values for the duration of the asset (obviously, from zero to the length of the video), and then apply the following formula to translate the location of the touch to the search time:
// Map
Here the code I wrote uses this formula:
- (IBAction)handlePanGesture:(UIPanGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateChanged){ CGPoint location = [sender locationInView:self]; float nlx = ((location.x / ((CGRectGetMidX(self.frame) / (self.frame.size.width / 2.0)))) / (self.frame.size.width / 2.0)) - 1.0;
I rejected the shortcut that displays the speed and the Play icon that appears during cleaning and that resizes depending on how fast or slow you pan the video. Although you did not ask for it, if you want, just ask.
Oh, the one-two factor is designed to add an acceleration curve to the panorama stiffness value sent to the delegate's setRate method. You can use any formula for this, even the actual curve, such as pow (nlx, 2.0) or something else ...
source share