diff --git a/AsyncDisplayKit/ASVideoNode.mm b/AsyncDisplayKit/ASVideoNode.mm index 210df9c762..3f41c06281 100644 --- a/AsyncDisplayKit/ASVideoNode.mm +++ b/AsyncDisplayKit/ASVideoNode.mm @@ -47,6 +47,8 @@ //TODO: Have a bash at supplying a preview image node so that we're deferring the construction of the video as it eats memory at the moment // [[[[playerItem tracks] objectAtIndex:0] assetTrack] asset] +//TODO: URL file videos don't seem to repeat + #pragma mark - Construction and Layout - (instancetype)initWithURL:(NSURL*)url diff --git a/examples/Videos/Sample/ViewController.m b/examples/Videos/Sample/ViewController.m index 5c4c0488ef..3d4698028b 100644 --- a/examples/Videos/Sample/ViewController.m +++ b/examples/Videos/Sample/ViewController.m @@ -33,9 +33,8 @@ - (ASVideoNode *)guitarVideo; { - ASVideoNode *videoNode = [[ASVideoNode alloc] init]; - - videoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-3045b261-7e93-4492-b7e5-5d6358376c9f-editedLiveAndDie.mov"]]; + AVAsset* asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-3045b261-7e93-4492-b7e5-5d6358376c9f-editedLiveAndDie.mov"]]; + ASVideoNode *videoNode = [[ASVideoNode alloc] initWithAsset:asset]; videoNode.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height/3); @@ -48,12 +47,11 @@ - (ASVideoNode *)nicCageVideo; { - ASVideoNode *nicCageVideo = [[ASVideoNode alloc] init]; + AVAsset* asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-753fe655-86bb-46da-89b7-aa59c60e49c0-niccage.mp4"]]; + ASVideoNode *nicCageVideo = [[ASVideoNode alloc] initWithAsset:asset]; nicCageVideo.delegate = self; - nicCageVideo.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"https://files.parsetfss.com/8a8a3b0c-619e-4e4d-b1d5-1b5ba9bf2b42/tfss-753fe655-86bb-46da-89b7-aa59c60e49c0-niccage.mp4"]]; - nicCageVideo.frame = CGRectMake([UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/3, [UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/3); nicCageVideo.gravity = AVLayerVideoGravityResize; @@ -68,10 +66,8 @@ - (ASVideoNode *)simonVideo; { - ASVideoNode *simonVideo = [[ASVideoNode alloc] init]; - NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"simon" ofType:@"mp4"]]; - simonVideo.asset = [AVAsset assetWithURL:url]; + ASVideoNode *simonVideo = [[ASVideoNode alloc] initWithURL:url]; simonVideo.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - ([UIScreen mainScreen].bounds.size.height/3), [UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/3);