Note that there are some explanatory texts on larger screens.

plurals
  1. POplay video from URL retrieved from ALAsset in iOS
    primarykey
    data
    text
    <p>I'm still fairly new to Obj-C and the idea of blocks. I read this post about displaying images from url retrieved from ALAssets: <a href="https://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone">display image from URL retrieved from ALAsset in iPhone</a></p> <p>Besides being able to view picture files in a <code>UITableView</code> using the <code>ALAsset</code> framework, I want to be able to play a video that is stored in the pictures folder as well. The video asset shows up just as a picture would, so I would like to be able to tap that video listing in the table and have it play. (In other words, I want to play a video using the Assets Library Framework) </p> <p>Can this be done with <code>MPMoviePlayerController</code>? </p> <p>From that post above I'm gathering I need code inside this function to get an asset URL for a video file:</p> <pre><code>ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { }; </code></pre> <p>If this is right, what code would I need to put inside that function so that I could successfully play the video via <code>MPMoviePlayerController</code>?</p> <p>Just for reference, my code for displaying the assets in a <code>UITableView</code> is here:</p> <pre><code>- (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; } </code></pre> <p>This is my first post so I'm sorry if I post it wrong. Thanks for your help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload