में एकाधिक वीडियो प्लेइंग समस्या मेरे ऐप में मैं UITableViewCell
में एकाधिक वीडियो चलाने की कोशिश कर रहा हूं, इसके लिए मैं MPMoviePlayerController
का उपयोग कर रहा हूं, यह बिना किसी समस्या के वीडियो चलाता है। लेकिन यह एक समय में एक वीडियो चलाता है और दूसरे सेल में मुझे ब्लैक स्क्रीन लगता है कि पहली बार एक सेल दिखाई देता है, यह वीडियो चलाता है लेकिन जैसे ही मैं दूसरी पंक्ति के लिए स्क्रॉल करता हूं, पहला सेल वीडियो दृश्य ब्लैक स्क्रीन के साथ गायब हो जाता है। मैं तालिका दृश्य को स्क्रॉल करने के बावजूद सभी वीडियो दृश्य को कैसे दिखाना नहीं चाहता हूं।UITableViewCell
कस्टम सेल प्रारंभ:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self){
NSArray *nibArray=[[NSBundle mainBundle]loadNibNamed:@"CustomCell" owner:self options:nil];
self=[nibArray objectAtIndex:0];
_player = [[MPMoviePlayerController alloc] init];
_player.view.frame = CGRectMake(0,0,320,300);
_player.movieSourceType = MPMovieSourceTypeStreaming;
[_player setContentURL:[NSURL URLWithString:@"http://files.parse.com/ef5649ee-75c6-4c76-ba3b-37be4d281125/b35589f7-c0aa-4ca8-9f7c-fd31b2dc8492-vedioTeaser.mov"]];
[_player prepareToPlay];
[_player play];
[self addSubview:_player.view];
}
return self;
}
CellForRowAtIndexPath विधि
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil){
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}else{
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section], nil] withRowAnimation:UITableViewRowAnimationAutomatic];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
किसी भी मदद अत्यधिक सराहना की है कि इस कोड कस्टम सेल में मैं प्ले वीडियो के लिए उपयोग कर रहा हूँ है।
अरे @vinod - क्या आपको अंततः इसके लिए एक सुरुचिपूर्ण समाधान मिला? मैं इसके साथ भी संघर्ष कर रहा हूं (मुझे नियंत्रण की आवश्यकता है ताकि कच्चे AVFoundation कोई अच्छा न हो) – Boaz