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

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 @@ ...@@ -31,8 +31,6 @@
#import "VLCStatusLabel.h" #import "VLCStatusLabel.h"
#define INPUT_RATE_DEFAULT 1000. #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_CELL @"track selector table view cell"
#define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header" #define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header"
...@@ -1720,22 +1718,25 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -1720,22 +1718,25 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
return; return;
NSString * hudString = @" "; NSString * hudString = @" ";
int swipeDuration = (int)(_mediaDuration*0.001*0.05);
if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionRight) { if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
double timeRemainingDouble = (-_mediaPlayer.remainingTime.intValue*0.001); double timeRemainingDouble = (-_mediaPlayer.remainingTime.intValue*0.001);
int timeRemaining = timeRemainingDouble; int timeRemaining = timeRemainingDouble;
if (FORWARD_SWIPE_DURATION < timeRemaining) { if (swipeDuration < timeRemaining) {
[_mediaPlayer jumpForward:FORWARD_SWIPE_DURATION]; if (swipeDuration < 1)
hudString = [NSString stringWithFormat:@"⇒ %is", FORWARD_SWIPE_DURATION]; swipeDuration = 1;
[_mediaPlayer jumpForward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇒ %is", swipeDuration];
} else { } else {
[_mediaPlayer jumpForward:(timeRemaining - 5)]; [_mediaPlayer jumpForward:(timeRemaining - 5)];
hudString = [NSString stringWithFormat:@"⇒ %is",(timeRemaining - 5)]; hudString = [NSString stringWithFormat:@"⇒ %is",(timeRemaining - 5)];
} }
} }
else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) { else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
[_mediaPlayer jumpBackward:BACKWARD_SWIPE_DURATION]; [_mediaPlayer jumpBackward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇐ %is",BACKWARD_SWIPE_DURATION]; hudString = [NSString stringWithFormat:@"⇐ %is",swipeDuration];
} }
if (swipeRecognizer.state == UIGestureRecognizerStateEnded) { 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