【发布时间】:2014-02-23 03:52:18
【问题描述】:
我正在寻找一款能够播放可重叠视频的 iPhone 应用。像这样:
我该怎么做?
【问题讨论】:
-
那么……你尝试了什么?
标签: iphone objective-c
我正在寻找一款能够播放可重叠视频的 iPhone 应用。像这样:
我该怎么做?
【问题讨论】:
标签: iphone objective-c
1) 低效方式:如果您想同时播放所有媒体。 媒体播放器的网格视图。
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CollectionCell forIndexPath:indexPath]; // 获取网址 播放器 *mediaPlayer = [[self playerArray]objectAtIndex:indexPath.row]; NSURL* videoURL = [NSURL URLWithString:mediaPlayer.url]; MPMoviePlayerController* mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL]; [mPlayer 准备播放]; [mPlayer 播放]; //用于部分查看..... [mPlayer.view setFrame:CGRectMake(/*你的框架*/)]; [mPlayer.view.backgroundColor = [UIColor grayColor]; [单元格添加子视图:mPlayer.view]; 返回单元格; }2) 高效方式:当用户点击单元格时,用缩略图放置网格并用 UIImageview 替换媒体播放器对象(在这种情况下,将上述代码放在 didSelectRow 中)
【讨论】: