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

How can I know ASVideoNode occurred an error? #252

Closed
bawn opened this issue May 9, 2017 · 4 comments
Closed

How can I know ASVideoNode occurred an error? #252

bawn opened this issue May 9, 2017 · 4 comments

Comments

@bawn
Copy link

bawn commented May 9, 2017

Texture version : 2.3.1

For example load .flv video or load timeout. So far I have not found any error callback.

@SergeyPetrachkov
Copy link
Contributor

SergeyPetrachkov commented May 11, 2017

Hi @bawn ! I've added to ASVideoNode.h the following:

- (void)videoNodeDidFailToInitAsset:(ASVideoNode *)videoNode withError:(NSError *)error;

and then in ASVideoNode.mm inside
- (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray<NSString *> *)requestedKeys

i add

[self.delegate videoNodeDidFailToInitAsset:self withError:error];

like this :

ASDisplayNodeAssertMainThread();
 
 for (NSString *key in requestedKeys) {
   NSError *error = nil;
   AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error];
   if (keyStatus == AVKeyValueStatusFailed) {
       NSLog(@"Asset loading failed with error: %@", error);
       [self.delegate videoNodeDidFailToInitAsset:self withError:error];

   }
 }
 
 if ([asset isPlayable] == NO) {
   NSLog(@"Asset is not playable.");
   return;
 }

then you can detect errors. I've never submitted that Improvement proposal to the Texture team but i think you might find it helpful.

@SergeyPetrachkov
Copy link
Contributor

SergeyPetrachkov commented May 11, 2017

and don't forget to add these files to your git and update CI build host to work around all your pod updates in case you use it.

@bawn
Copy link
Author

bawn commented May 11, 2017

@petrachkov Thanks, This is really useful. I think you can try submit a RP.

@SergeyPetrachkov
Copy link
Contributor

Just have done that. Waiting for approval :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants