【发布时间】:2015-10-11 19:06:14
【问题描述】:
我想使用MPMoviePlayer 在Tableview 上播放视频。所以我有 10 个视频,我需要在 tableview 上加载视频。因此,在 tableview 上滚动时,不想播放视频。一旦 tableview 滚动完成,当前可见的单元格索引视频需要在单元格内自动播放。我该如何实现?
每个单元格的代码见下文,
[self.players.view removeFromSuperview];
NSURL *videoURL = [NSURL URLWithString:str_videourl];
self.players = [[MPMoviePlayerController alloc]init];
[self.players.view setFrame:videoView.frame];
self.players.controlStyle = MPMovieControlStyleEmbedded;
self.players.shouldAutoplay = YES;
self.players.movieSourceType = MPMovieSourceTypeStreaming;
[self.players setContentURL:videoURL];
self.players.scalingMode = MPMovieScalingModeAspectFill;
self.players.view.tag=indexPath.section;
[cell.viewBase addSubview:self.players.view];
[self.players prepareToPlay];
[self.players.view setBackgroundColor:[UIColor clearColor]];
【问题讨论】:
-
您能否将您的代码发送到这里,以便我检查并告诉您代码中是否有任何问题。
标签: ios objective-c mpmovieplayer