I am trying to play videos. I have a table view, if you select the first row, video A plays, if you select the second row, video B plays. This works fine if I open the app, and select a row, however. When I am done with that video, if I then select the next video, nothing happens.
Help?
Help?
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MPMoviePlayerController *player;
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath;
NSInteger row = [indexPath row];
if(row == 0) {
moviePath = [bundle pathForResource:@"video_a" ofType:@"m4v"];
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
} else {
moviePath = [bundle pathForResource:@"video_b" ofType:@"m4v"];
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
}
[player play];
}