I'm still pretty new to Obj-C and the idea of blocks. I read this post about displaying images from url retrieved from ALAssets: display image from url retrieved from ALAsset on iPhone
Besides the ability to view image files in UITableViewusing the structure ALAsset, I want to be able to play video, which is also stored in a folder with pictures. The video ad is displayed in the same way as the image, so I would like to use this list of videos in a table and play it. (In other words, I want to play the video using the structure of the object library)
Can this be done with MPMoviePlayerController?
From this post above I am going to. I need the code inside this function to get the resource URL for the video file:
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
};
If this is correct, what code will I need to put inside this function so that I can successfully play the video through MPMoviePlayerController?
For reference only, my code for displaying assets in UITableViewis here:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = @"id";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[[cell imageView] setImage:[UIImage imageWithCGImage:[[assets objectAtIndex:indexPath.row] thumbnail]]];
[[cell textLabel] setText:[NSString stringWithFormat:@"Item %d", indexPath.row+1]];
return cell;
}
This is my first post, so I'm sorry if I post it incorrectly. Thank you for your help.
source
share