From 90601c4ec86279b32026b8c13abe239e13de2837 Mon Sep 17 00:00:00 2001 From: Sergey Petrachkov Date: Thu, 18 May 2017 14:17:30 +0700 Subject: [PATCH 1/3] Fixed bug where ASVideoNodeDelegate error reporting callback would crash an app because of not responding to selector; refs #291 --- Source/ASVideoNode.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/ASVideoNode.mm b/Source/ASVideoNode.mm index ce61ab3b2..9439aff4a 100644 --- a/Source/ASVideoNode.mm +++ b/Source/ASVideoNode.mm @@ -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; @@ -153,7 +154,9 @@ - (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray *)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]; + } } } @@ -604,6 +607,7 @@ - (void)setDelegate:(id)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:)]; } } From 6633c8fb0a66bcd7fda5ffeed77f2c1dc62c5446 Mon Sep 17 00:00:00 2001 From: Sergey Petrachkov Date: Thu, 18 May 2017 14:19:59 +0700 Subject: [PATCH 2/3] updated changelog.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d28b712a..2cfb348ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,3 +25,4 @@ - [Fix] Fix a potential crash when cell nodes that need layout are deleted during the same runloop. [Adlai Holler](https://github.com/Adlai-Holler) [#279](https://github.com/TextureGroup/Texture/pull/279) - [Batch fetching] Add ASBatchFetchingDelegate that takes scroll velocity and remaining time into account [Huy Nguyen](https://github.com/nguyenhuy) [#281](https://github.com/TextureGroup/Texture/pull/281) - [Fix] Fix a major regression in our image node contents caching. [Adlai Holler](https://github.com/Adlai-Holler) [#287](https://github.com/TextureGroup/Texture/pull/287) +- [Fix] Fixed a bug where ASVideoNodeDelegate error reporting callback would crash an app because of not responding to selector. [Sergey Petrachkov](https://github.com/Petrachkov) [#291](https://github.com/TextureGroup/Texture/issues/291) From 8a8035186d77fe159c76f408087bed2e7e9fb088 Mon Sep 17 00:00:00 2001 From: Sergey Petrachkov Date: Thu, 18 May 2017 17:37:30 +0700 Subject: [PATCH 3/3] fixed typo in const name of ASVideoNodeDelegate method in delegate flags; refs #292 --- Source/ASVideoNode.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/ASVideoNode.mm b/Source/ASVideoNode.mm index 9439aff4a..84486a831 100644 --- a/Source/ASVideoNode.mm +++ b/Source/ASVideoNode.mm @@ -58,7 +58,7 @@ @interface ASVideoNode () unsigned int delegateVideoNodeDidSetCurrentItem:1; unsigned int delegateVideoNodeDidStallAtTimeInterval:1; unsigned int delegateVideoNodeDidRecoverFromStall:1; - unsigned int delegateVideoNodeDidFailToLoadValuesForKey:1; + unsigned int delegateVideoNodeDidFailToLoadValueForKey:1; } _delegateFlags; BOOL _shouldBePlaying; @@ -154,7 +154,7 @@ - (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray *)requ AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error]; if (keyStatus == AVKeyValueStatusFailed) { NSLog(@"Asset loading failed with error: %@", error); - if (_delegateFlags.delegateVideoNodeDidFailToLoadValuesForKey) { + if (_delegateFlags.delegateVideoNodeDidFailToLoadValueForKey) { [self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error]; } } @@ -607,7 +607,7 @@ - (void)setDelegate:(id)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:)]; + _delegateFlags.delegateVideoNodeDidFailToLoadValueForKey = [delegate respondsToSelector:@selector(videoNode:didFailToLoadValueForKey:asset:error:)]; } }