diff --git a/AsyncDisplayKit/ASVideoNode.h b/AsyncDisplayKit/ASVideoNode.h index 178ceff5c7..e525d1a2dc 100644 --- a/AsyncDisplayKit/ASVideoNode.h +++ b/AsyncDisplayKit/ASVideoNode.h @@ -41,6 +41,11 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isPlaying; @property (nullable, nonatomic, strong, readwrite) AVAsset *asset; +/** + ** @abstract The URL with which the asset was initialized. + ** @discussion Setting the URL will overwrite the current asset with a newly created AVURLAsset created from the given URL, and AVAsset *asset will point to that newly created AVURLAsset. Please don't set both assetURL and asset. + ** @return Current URL the asset was initialized or nil if no URL was given. + **/ @property (nullable, nonatomic, strong, readwrite) NSURL *assetURL; @property (nullable, nonatomic, strong, readwrite) AVVideoComposition *videoComposition; @property (nullable, nonatomic, strong, readwrite) AVAudioMix *audioMix; diff --git a/AsyncDisplayKit/ASVideoNode.mm b/AsyncDisplayKit/ASVideoNode.mm index 8771e703d9..5f679f5cc1 100644 --- a/AsyncDisplayKit/ASVideoNode.mm +++ b/AsyncDisplayKit/ASVideoNode.mm @@ -442,6 +442,8 @@ static NSString * const kStatus = @"status"; - (void)setAssetURL:(NSURL *)assetURL { + ASDN::MutexLocker l(__instanceLock__); + if (!ASObjectIsEqual(assetURL, self.assetURL)) { self.asset = [AVURLAsset assetWithURL:assetURL]; }