Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 783011b

Browse files
committed
[ASVideoNode] Added a couple comments for clarity and to identify future improvement areas.
1 parent 8801b61 commit 783011b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

AsyncDisplayKit/ASNetworkImageNode.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ - (void)displayWillStart
267267
}
268268
}
269269

270+
// TODO: Consider removing this; it predates ASInterfaceState, which now ensures that even non-range-managed nodes get a -fetchData call.
270271
[self fetchData];
271272

272273
if (self.image == nil && _downloaderImplementsSetPriority) {

AsyncDisplayKit/ASVideoNode.mm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,18 +339,22 @@ - (void)fetchData
339339
{
340340
[super fetchData];
341341

342-
{
343342
ASDN::MutexLocker l(_videoLock);
344343
AVAsset *asset = self.asset;
345344
// Return immediately if the asset is nil;
346345
if (asset == nil || self.playerState == ASVideoNodePlayerStateInitialLoading) {
347346
return;
348347
}
349-
NSArray<NSString *> *requestedKeys = @[@"playable"];
348+
349+
// FIXME: Nothing appears to prevent this method from sending the delegate notification / calling load on the asset
350+
// multiple times, even after the asset is fully loaded and ready to play. There should probably be a playerState
351+
// for NotLoaded or such, besides Unknown, so this can be easily checked before proceeding.
350352
self.playerState = ASVideoNodePlayerStateInitialLoading;
351353
if (_delegateFlags.delegateVideoNodeDidStartInitialLoading) {
352354
[_delegate videoNodeDidStartInitialLoading:self];
353355
}
356+
357+
NSArray<NSString *> *requestedKeys = @[@"playable"];
354358
[asset loadValuesAsynchronouslyForKeys:requestedKeys completionHandler:^{
355359
ASPerformBlockOnMainThread(^{
356360
if (_delegateFlags.delegateVideoNodeDidFinishInitialLoading) {
@@ -359,7 +363,6 @@ - (void)fetchData
359363
[self prepareToPlayAsset:asset withKeys:requestedKeys];
360364
});
361365
}];
362-
}
363366
}
364367

365368
- (void)periodicTimeObserver:(CMTime)time

0 commit comments

Comments
 (0)