Skip to content

Commit

Permalink
Fixed bug where ASVideoNodeDelegate error reporting callback would cr…
Browse files Browse the repository at this point in the history
…ash an app because of not responding to selector;

refs TextureGroup#291
  • Loading branch information
SergeyPetrachkov committed May 18, 2017
1 parent d30c357 commit 90601c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/ASVideoNode.mm
Expand Up @@ -58,6 +58,7 @@ @interface ASVideoNode ()
unsigned int delegateVideoNodeDidSetCurrentItem:1;
unsigned int delegateVideoNodeDidStallAtTimeInterval:1;
unsigned int delegateVideoNodeDidRecoverFromStall:1;
unsigned int delegateVideoNodeDidFailToLoadValuesForKey:1;
} _delegateFlags;

BOOL _shouldBePlaying;
Expand Down Expand Up @@ -153,7 +154,9 @@ - (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray<NSString *> *)requ
AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error];
if (keyStatus == AVKeyValueStatusFailed) {
NSLog(@"Asset loading failed with error: %@", error);
[self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error];
if (_delegateFlags.delegateVideoNodeDidFailToLoadValuesForKey) {
[self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error];
}
}
}

Expand Down Expand Up @@ -604,6 +607,7 @@ - (void)setDelegate:(id<ASVideoNodeDelegate>)delegate
_delegateFlags.delegateVideoNodeDidSetCurrentItem = [delegate respondsToSelector:@selector(videoNode:didSetCurrentItem:)];
_delegateFlags.delegateVideoNodeDidStallAtTimeInterval = [delegate respondsToSelector:@selector(videoNode:didStallAtTimeInterval:)];
_delegateFlags.delegateVideoNodeDidRecoverFromStall = [delegate respondsToSelector:@selector(videoNodeDidRecoverFromStall:)];
_delegateFlags.delegateVideoNodeDidFailToLoadValuesForKey = [delegate respondsToSelector:@selector(videoNode:didFailToLoadValueForKey:asset:error:)];
}
}

Expand Down

0 comments on commit 90601c4

Please sign in to comment.