Merge pull request #3459 from dreampiggy/bugfix/player_cache_poster_image
The poster image should not trigger a frameChange callback
This commit is contained in:
commit
707db2e016
|
@ -145,18 +145,18 @@
|
||||||
|
|
||||||
if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {
|
if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {
|
||||||
UIImage *image = (UIImage *)self.animatedProvider;
|
UIImage *image = (UIImage *)self.animatedProvider;
|
||||||
// Use the poster image if available
|
// Cache the poster image if available, but should not callback to avoid caller thread issues
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
|
UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
|
||||||
#else
|
#else
|
||||||
UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];
|
UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];
|
||||||
#endif
|
#endif
|
||||||
if (posterFrame) {
|
if (posterFrame) {
|
||||||
self.currentFrame = posterFrame;
|
// HACK: The first frame should not check duration and immediately display
|
||||||
|
self.needsDisplayWhenImageBecomesAvailable = YES;
|
||||||
SD_LOCK(self->_lock);
|
SD_LOCK(self->_lock);
|
||||||
self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame;
|
self.frameBuffer[@(self.currentFrameIndex)] = posterFrame;
|
||||||
SD_UNLOCK(self->_lock);
|
SD_UNLOCK(self->_lock);
|
||||||
[self handleFrameChange];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue