diff --git a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m index 3bfefa481590bd3218f34b93177271fe0c31791c..f0b02643ba26058e35a95ef79500e78717ea473b 100644 --- a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m +++ b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m @@ -240,6 +240,16 @@ completionBlock:completionBlock]; } +static const int64_t MinimumDuration = 3 * 60 * 1000; +static const float MinimumStorePercent = 0.5; +static const float MaximumStorePercent = 0.95; + +BOOL ShouldStorePlaybackPosition(float position, int64_t duration) +{ + return duration > MinimumDuration && + position > MinimumStorePercent && position < MaximumStorePercent; +} + - (void)storePlaybackPositionForItem:(VLCInputItem *)inputItem player:(VLCPlayerController *)playerController { @@ -262,9 +272,8 @@ [self storeLegacyPlaybackPositionForInputItem:inputItem withPlayer:playerController]; } - float position = playerController.position; - if (position > .05 && position < .95 && libraryMediaItem.duration > 180000) { - libraryMediaItem.lastPlaybackPosition = position; + if (ShouldStorePlaybackPosition(playerController.position, libraryMediaItem.duration)) { + libraryMediaItem.lastPlaybackPosition = playerController.position; } } @@ -281,7 +290,7 @@ NSMutableArray *mediaList = [[defaults objectForKey:@"recentlyPlayedMediaList"] mutableCopy]; NSString *mrl = inputItem.MRL; - if (relativePos > .05 && relativePos < .95 && dur > 180) { + if (ShouldStorePlaybackPosition(relativePos, dur*1000)) { msg_Dbg(getIntf(), "Store current playback position of %f", relativePos); [mutDict setObject:[NSNumber numberWithInteger:pos] forKey:inputItem.MRL];