我对Obj-C和块的想法还是比较新的。我看到这篇文章有关显示从URL从ALAssets检索到的图像:display image from URL retrieved from ALAsset in iPhone从iOS中的ALAsset中检索的URL播放视频
除了能够使用ALAsset
框架来查看一个UITableView
图片文件,我希望能够播放存储在图片文件夹中的视频好。视频资源就像一张图片一样显示,所以我希望能够在表格中点击该视频列表并让它播放。 (换句话说,我想用Assets Library Framework播放视频)
这可以用MPMoviePlayerController
来完成吗?
从那个帖子上面我收集我需要这个代码函数内部获得的资产网址的视频文件:
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
};
如果这是正确的,我需要什么样的代码放在该函数内部以便我可以通过MPMoviePlayerController
成功播放视频?
仅供参考,我的一个UITableView
显示资产代码是在这里:
- (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;
}
这是我的第一篇文章,所以我很抱歉,如果我将它张贴错了。感谢您的帮助
这对我不起作用。该URL包含类似'assets-library://asset/asset.MOV?id = 12345&ext = mov'。 MoviePlayerController不显示任何内容。 – 2013-01-16 12:44:17