From d565a3752930dcfc29a47e7b8daf666939d4f219 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 26 Jan 2020 18:05:39 +0800 Subject: [PATCH] Fix the issue that `maxBufferSize` property does not correctlly works for `SDAnimatedImageView`, should setup the player's property --- SDWebImage/Core/SDAnimatedImageView.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SDWebImage/Core/SDAnimatedImageView.m b/SDWebImage/Core/SDAnimatedImageView.m index f0b811c4..e9734383 100644 --- a/SDWebImage/Core/SDAnimatedImageView.m +++ b/SDWebImage/Core/SDAnimatedImageView.m @@ -19,6 +19,7 @@ @interface SDAnimatedImageView () { BOOL _initFinished; // Extra flag to mark the `commonInit` is called NSRunLoopMode _runLoopMode; + NSUInteger _maxBufferSize; double _playbackRate; } @@ -153,6 +154,9 @@ // RunLoop Mode self.player.runLoopMode = self.runLoopMode; + // Max Buffer Size + self.player.maxBufferSize = self.maxBufferSize; + // Play Rate self.player.playbackRate = self.playbackRate; @@ -207,6 +211,16 @@ return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; } +- (void)setMaxBufferSize:(NSUInteger)maxBufferSize +{ + _maxBufferSize = maxBufferSize; + self.player.maxBufferSize = maxBufferSize; +} + +- (NSUInteger)maxBufferSize { + return _maxBufferSize; // Defaults to 0 +} + - (void)setPlaybackRate:(double)playbackRate { _playbackRate = playbackRate;