I want to play video on Tableview using MPMoviePlayer . So, I have 10 videos, and I need to upload the video to tableview. Therefore, scrolling through the table, do not want to play the video. When the scrolling of the table is completed, the current visible video of the cellular index should be automatically played inside the cell. How to implement this?
Below is the code for each cell,
[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]];
source share