Commit bb5b5ab5 authored by Mike JS. Choi's avatar Mike JS. Choi Committed by Carola

[Playback] Update initial control center playback position

(cherry picked from commit 68d279d7)
parent 93169d9f
...@@ -1110,8 +1110,10 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -1110,8 +1110,10 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
CGFloat lastPosition = .0; CGFloat lastPosition = .0;
NSInteger duration = 0; NSInteger duration = 0;
if (item.lastPosition) if (item.lastPosition) {
lastPosition = item.lastPosition.floatValue; lastPosition = item.lastPosition.floatValue;
}
duration = item.duration.intValue; duration = item.duration.intValue;
if (lastPosition < .95 && _mediaPlayer.position < lastPosition) { if (lastPosition < .95 && _mediaPlayer.position < lastPosition) {
...@@ -1122,7 +1124,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -1122,7 +1124,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
continuePlayback = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinuePlayback] integerValue]; continuePlayback = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinuePlayback] integerValue];
if (continuePlayback == 1) { if (continuePlayback == 1) {
_mediaPlayer.position = lastPosition; [self jumpForward:(duration * lastPosition) / 1000.];
} else if (continuePlayback == 0) { } else if (continuePlayback == 0) {
VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"CONTINUE_PLAYBACK", nil) VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"CONTINUE_PLAYBACK", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"CONTINUE_PLAYBACK_LONG", nil), item.title] message:[NSString stringWithFormat:NSLocalizedString(@"CONTINUE_PLAYBACK_LONG", nil), item.title]
...@@ -1131,7 +1133,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -1131,7 +1133,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
otherButtonTitles:NSLocalizedString(@"BUTTON_CONTINUE", nil), nil]; otherButtonTitles:NSLocalizedString(@"BUTTON_CONTINUE", nil), nil];
alert.completion = ^(BOOL cancelled, NSInteger buttonIndex) { alert.completion = ^(BOOL cancelled, NSInteger buttonIndex) {
if (!cancelled) { if (!cancelled) {
_mediaPlayer.position = lastPosition; [self setPlaybackPosition:lastPosition];
} }
}; };
[alert show]; [alert show];
......
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