Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added error reporting callback to ASVideoNode #260

Merged
merged 3 commits into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
- [ASDisplayNode] Pass drawParameter in rendering context callbacks [Michael Schneider](https://github.com/maicki)[#248](https://github.com/TextureGroup/Texture/pull/248)
- [ASTextNode] Move to class method of drawRect:withParameters:isCancelled:isRasterizing: for drawing [Michael Schneider] (https://github.com/maicki)[#232](https://github.com/TextureGroup/Texture/pull/232)
- [ASDisplayNode] Remove instance:-drawRect:withParameters:isCancelled:isRasterizing: (https://github.com/maicki)[#232](https://github.com/TextureGroup/Texture/pull/232)
- [ASVideoNode] Added error reporing to ASVideoNode and it's delegate [#260](https://github.com/TextureGroup/Texture/pull/260)
26 changes: 17 additions & 9 deletions Source/ASVideoNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
@protocol ASVideoNodeDelegate;

typedef NS_ENUM(NSInteger, ASVideoNodePlayerState) {
ASVideoNodePlayerStateUnknown,
ASVideoNodePlayerStateInitialLoading,
ASVideoNodePlayerStateReadyToPlay,
ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying,
ASVideoNodePlayerStatePlaying,
ASVideoNodePlayerStateLoading,
ASVideoNodePlayerStatePaused,
ASVideoNodePlayerStateFinished
ASVideoNodePlayerStateUnknown,
ASVideoNodePlayerStateInitialLoading,
ASVideoNodePlayerStateReadyToPlay,
ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying,
ASVideoNodePlayerStatePlaying,
ASVideoNodePlayerStateLoading,
ASVideoNodePlayerStatePaused,
ASVideoNodePlayerStateFinished
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reserve the old indentation.

};

NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -110,7 +110,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param videoNode The video node.
* @param state player state that is going to be set.
* @discussion Delegate method invoked when player changes it's state to
* ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused
* ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused
* and asks delegate if state change is valid
*/
- (BOOL)videoNode:(ASVideoNode*)videoNode shouldChangePlayerStateTo:(ASVideoNodePlayerState)state;
Expand Down Expand Up @@ -147,6 +147,13 @@ NS_ASSUME_NONNULL_BEGIN
* @param videoNode The videoNode
*/
- (void)videoNodeDidRecoverFromStall:(ASVideoNode *)videoNode;
/**
* @abstract Delegate method invoked when an error occurs while trying to play a video
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "while trying to load an asset".

* @param videoNode The videoNode.
* @param currentItem The error that occurs
*/
- (void)videoNodeDidFailToInitAssetFor:(ASVideoNode *)videoNode withError:(NSError *)error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To follow convention, let's make it -(void)videoNode:(ASVideoNode *)videoNode didFailToLoadAssetWithError:(NSError *)error.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a newline already. Please remove this one.


@end

Expand All @@ -157,3 +164,4 @@ NS_ASSUME_NONNULL_BEGIN
@end

NS_ASSUME_NONNULL_END

3 changes: 2 additions & 1 deletion Source/ASVideoNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ - (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray<NSString *> *)requ
NSError *error = nil;
AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error];
if (keyStatus == AVKeyValueStatusFailed) {
NSLog(@"Asset loading failed with error: %@", error);
NSLog(@"Asset loading failed with error: %@", error);
[self.delegate videoNodeDidFailToInitAssetFor:self withError:error];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we pass along the asset and maybe the key at hand? I imagine those objects might be helpful for investigations. Should be something like -(void)videoNode:(ASVideoNode *)videoNode didFailToLoadValueForKey:(NSString *)key asset:(AVAsset *)asset error:(NSError *)error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, please use 2 spaces for indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is updated.

}
}

Expand Down