Browse Source

[Playback] Update initial control center playback position

Mike JS. Choi 7 years ago
parent
commit
68d279d76c
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Sources/VLCPlaybackController.m

+ 5 - 3
Sources/VLCPlaybackController.m

@@ -1113,8 +1113,10 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
         CGFloat lastPosition = .0;
         NSInteger duration = 0;
 
-        if (item.lastPosition)
+        if (item.lastPosition) {
             lastPosition = item.lastPosition.floatValue;
+        }
+        
         duration = item.duration.intValue;
 
         if (lastPosition < .95 && _mediaPlayer.position < lastPosition) {
@@ -1125,7 +1127,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
                 continuePlayback = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinuePlayback] integerValue];
 
             if (continuePlayback == 1) {
-                _mediaPlayer.position = lastPosition;
+                [self jumpForward:(duration * lastPosition) / 1000.];
             } else if (continuePlayback == 0) {
                 VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"CONTINUE_PLAYBACK", nil)
                                                                   message:[NSString stringWithFormat:NSLocalizedString(@"CONTINUE_PLAYBACK_LONG", nil), item.title]
@@ -1134,7 +1136,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
                                                         otherButtonTitles:NSLocalizedString(@"BUTTON_CONTINUE", nil), nil];
                 alert.completion = ^(BOOL cancelled, NSInteger buttonIndex) {
                     if (!cancelled) {
-                        _mediaPlayer.position = lastPosition;
+                        [self setPlaybackPosition:lastPosition];
                     }
                 };
                 [alert show];