循环背景音乐?

  1. 为我的iOS游戏播放背景音乐的最佳方式是什么? 我该怎么做?

  2. 让这个音乐文件播放的最佳格式是什么?

  3. 这首歌曲会不会乐于在整个游戏中播放,更改视图时不会中断?

  4. 我怎样才能循环这个音乐?

您可以使用AVAudioPlayer

 NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3"]; NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil]; player.numberOfLoops = -1; //infinite [player play]; 

你可以通过设置currentTime来跳过:

 player.currentTime = 10; //jump to 10th second