This repository was archived by the owner on Feb 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments