Commit ff62393d authored by Kevin Chromik's avatar Kevin Chromik Committed by Felix Paul Kühne

make swipe jump duration variable to video length

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 36b4bc21
......@@ -31,8 +31,6 @@
#import "VLCStatusLabel.h"
#define INPUT_RATE_DEFAULT 1000.
#define FORWARD_SWIPE_DURATION 30
#define BACKWARD_SWIPE_DURATION 10
#define TRACK_SELECTOR_TABLEVIEW_CELL @"track selector table view cell"
#define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header"
......@@ -1720,22 +1718,25 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
return;
NSString * hudString = @" ";
int swipeDuration = (int)(_mediaDuration*0.001*0.05);
if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
double timeRemainingDouble = (-_mediaPlayer.remainingTime.intValue*0.001);
int timeRemaining = timeRemainingDouble;
if (FORWARD_SWIPE_DURATION < timeRemaining) {
[_mediaPlayer jumpForward:FORWARD_SWIPE_DURATION];
hudString = [NSString stringWithFormat:@"⇒ %is", FORWARD_SWIPE_DURATION];
if (swipeDuration < timeRemaining) {
if (swipeDuration < 1)
swipeDuration = 1;
[_mediaPlayer jumpForward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇒ %is", swipeDuration];
} else {
[_mediaPlayer jumpForward:(timeRemaining - 5)];
hudString = [NSString stringWithFormat:@"⇒ %is",(timeRemaining - 5)];
}
}
else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
[_mediaPlayer jumpBackward:BACKWARD_SWIPE_DURATION];
hudString = [NSString stringWithFormat:@"⇐ %is",BACKWARD_SWIPE_DURATION];
[_mediaPlayer jumpBackward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇐ %is",swipeDuration];
}
if (swipeRecognizer.state == UIGestureRecognizerStateEnded) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment