From 72585e4262d72bb989e37c88b04db4abaa8dd11c Mon Sep 17 00:00:00 2001 From: Scott Goodson Date: Sat, 19 Nov 2016 21:59:14 -0800 Subject: [PATCH] Revert "Prevent premature placeholder image clearing when setting the video asset at a later point in time." See test failure in https://github.com/facebook/AsyncDisplayKit/pull/2626 This reverts commit 4ad8361eeaef1f0bce8fab3c89b6cd28fd043999. --- AsyncDisplayKit/ASVideoNode.mm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/AsyncDisplayKit/ASVideoNode.mm b/AsyncDisplayKit/ASVideoNode.mm index d9d009fba1..9dc4d22077 100644 --- a/AsyncDisplayKit/ASVideoNode.mm +++ b/AsyncDisplayKit/ASVideoNode.mm @@ -405,20 +405,17 @@ static NSString * const kRate = @"rate"; } } -- (void)_clearPlayer -{ - ASDN::MutexLocker l(__instanceLock__); - - self.player = nil; - self.currentItem = nil; - self.playerState = ASVideoNodePlayerStateUnknown; -} - - (void)clearFetchedData { [super clearFetchedData]; - [self _clearPlayer]; + { + ASDN::MutexLocker l(__instanceLock__); + + self.player = nil; + self.currentItem = nil; + self.playerState = ASVideoNodePlayerStateUnknown; + } } - (void)didEnterVisibleState @@ -508,7 +505,7 @@ static NSString * const kRate = @"rate"; - (void)_setAndFetchAsset:(AVAsset *)asset url:(NSURL *)assetURL { - [self _clearPlayer]; // Clear the player but not the underlying ASNetworkImageNode to avoid clearing the placeholder image and showing the background before the video starts. + [self clearFetchedData]; _asset = asset; _assetURL = assetURL; [self setNeedsDataFetch];