Tôi muốn phát video trên Tableview
bằng cách sử dụng MPMoviePlayer
. Vì vậy, tôi có 10 video và tôi cần phải tải các video trên tableview. Vì vậy, trong khi di chuyển trên tableview, không muốn chơi video. Sau khi hoàn tất quá trình xem bảng, video chỉ mục ô hiện tại sẽ cần được tự động phát bên trong ô. Làm thế nào tôi có thể thực hiện điều này?Phát video tự động trên ô Tableview trong iOS
Xem dưới đây để biết mã trên mỗi tế bào,
[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]];
bạn có thể vui lòng gửi mã của mình tại đây để tôi có thể kiểm tra và cho bạn biết nếu có bất kỳ sự cố nào trong mã của bạn nếu có thể. –