userchuxu
2016-06-26 15:22:10 +08:00
一:// 点击播放视频.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// 9.0 之后的视频播放.
// 获得视频播放地址.
HMVideo *video = self.videos[indexPath.row];
NSURL *url = [NSURL URLWithString:video.url];
AVPlayerViewController *av = [[AVPlayerViewController alloc] init];
[av.player play];
// 跳转控制器
[self presentViewController:av animated:YES completion:^{
//
}];
}
二:// MPMoviePlayerViewController 使用.
- (void)testWithIndexPath:(NSIndexPath *)indexPath
{
// 获得视频播放地址.
HMVideo *video = self.videos[indexPath.row];
NSURL *url = [NSURL URLWithString:video.url];
// 1.实例化视频播放器. MPMoviePlayerViewController
MPMoviePlayerViewController *mv = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
// 跳转控制器.
// 注意:不能添加全局断点.
[self presentMoviePlayerViewControllerAnimated:mv];
}