Browse Source

workaround issue with [VLCMediaPlayer setTime:]

Tobias Conradi 9 years ago
parent
commit
09e0585543
1 changed files with 17 additions and 2 deletions
  1. 17 2
      Apple-TV/Playback/VLCFullscreenMovieTVViewController.m

+ 17 - 2
Apple-TV/Playback/VLCFullscreenMovieTVViewController.m

@@ -366,7 +366,7 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
     VLCMediaPlayer *player = vpc.mediaPlayer;
 
     if (player.isPlaying) {
-        [player jumpForward:VLCJumpInterval];
+        [self jumpInterval:VLCJumpInterval];
     } else {
         [self scrubbingJumpInterval:VLCJumpInterval];
     }
@@ -377,12 +377,27 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
     VLCMediaPlayer *player = vpc.mediaPlayer;
 
     if (player.isPlaying) {
-        [player jumpBackward:VLCJumpInterval];
+        [self jumpInterval:-VLCJumpInterval];
     } else {
         [self scrubbingJumpInterval:-VLCJumpInterval];
     }
 }
 
+- (void)jumpInterval:(NSInteger)interval
+{
+    NSInteger duration = [VLCPlaybackController sharedInstance].mediaDuration;
+    if (duration==0) {
+        return;
+    }
+    VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
+    VLCMediaPlayer *player = vpc.mediaPlayer;
+
+    CGFloat intervalFraction = ((CGFloat)interval)/((CGFloat)duration);
+    CGFloat currentFraction = player.position;
+    currentFraction += intervalFraction;
+    player.position = currentFraction;
+}
+
 - (void)scrubbingJumpInterval:(NSInteger)interval
 {
     NSInteger duration = [VLCPlaybackController sharedInstance].mediaDuration;