Reputation: 597
Edited:
From my earlier question (below), I have a handle on my assets (video) and I also have an implementation of my PlayVideoViewController but I am stuck on how to pass this asset to the playVideoViewController object. Here is a code snippet of the implementation:
(void)viewDidLoad { [super viewDidLoad];
.... }
In my line 1., it gives me a "Use of undeclared identifier 'asset'" error. If I can pass 'asset' then I can resolve the issue but the only examples I have seen use .nib not storyboard so for example, using .NIB, the call is: PlayVideoViewController *playVideoViewController = [[PlayVideoViewController alloc ] initWithNibName:@"PlayVideoViewController" bundle:nil asset:asset]; Please help on how to pass the 'asset'.
==
I can't figure out just one thing and I hope someone can help me out. Please note I am not using a .nib but storyboards and that is why I am stuck here.
I have loaded assets (videos) into a tableview and when a user selects a tableviewcell, the app transitions to a new view controller (PlayVideoViewController) that just plays the video. From the class loading the asset (*asset) and letting the user select it, I have this code snippet:
ALAsset *asset = [assets objectAtIndex:row];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard.storyboard" bundle:nil];
PlayVideoViewController *playVideoViewController = [storyboard instantiateViewControllerWithIdentifier:@"PlayVideoViewController"];
[self.navigationController pushViewController:playVideoViewController animated:YES ];
How do I pass the selected video to PlayVideoViewController so it just plays the video? How so I incorporate that into my code and kindly show me an example?
Upvotes: 1
Views: 261
Reputation: 597
This might help someone else: in order to resolve the issue, I simply created an ALAsset object in the new viewcontroller and passed the object to it after storyBoard:instantiateViewControllerWithIdentifier.
Upvotes: 0
Reputation: 89509
Create a "@property
" in your PlayVideoViewController's ".h
" (interface) file that takes a file URL or some way to reference your video.
Then, after you instantiate your playVideoViewController and before you push, simply set that property's value to the file URL so your new controller knows where to get the video from.
Upvotes: 0