I have been working on a problem from around 12 hours now and I am stumped. The first bit of code is the MoviePlayerViewController and the second bit is for Audio. The Second bit works when loading the path from an indexPath of a Table yet I cant get the first bit of code to do the same thing by loading from an Array.
I need to convert this bit of code to...
This bite of code...
I need to convert this bit of code to...
Code:
// Play movie from the bundle
NSString *path = [[NSBundle mainBundle] pathForResource:@"Movie-1" ofType:@"mp4" inDirectory:nil];
// Create custom movie player
moviePlayer = [[[CustomMoviePlayerViewController alloc] initWithPath:path] autorelease];
// Show the movie player as modal
[self presentModalViewController:moviePlayer animated:YES];
// Prep and play the movie
[moviePlayer readyPlayer];
}
This bite of code...
Code:
NSUInteger row = [indexPath row];
NSString *rowTitle = [filmSound objectAtIndex:row];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], rowTitle]];
NSError *error;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];