在我的init方法中,我初始化sound_a.wav。AVAudioPlayer动态地更改声音网址
AVAudioPlayer *snd = [[AVAudioPlayer alloc] initWithContentsOfURL:[[NSBundle mainBundle]
URLForResource:@"sound_a" withExtension:@"wav"] error: nil];
根据情景我需要播放不同的声音(让我们假设声音是sound_b)。
我需要什么代码才能在飞行中更改此代码?
检查我的答案。 'AVQueuePlayer'可以帮助你 – dit