这是在 viewDidLoad 下定义的 - 尝试将音频的 URL 路径放入数组 - 放入数组后,想逐页循环 - 尝试翻页并自动播放自动播放每个页面的音频
定义音频 6
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"part-%d.mp3"];
NSURL *url = [NSURL fileURLWithPath:filePath];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
audioPlayer.numberOfLoops = 1; //repeat once
self.video =[[NSMutableArray alloc]initWithCapacity:Audio];
for (int i=0; i <Audio; i++)
{
[self.video addObject:paths];
}
[audioPlayer play];