我正在尋找一種方法來恢復我的應用程序使用AVAudioPlayer播放自己的聲音後由另一個應用播放的音頻。現在,如果我正在聽音樂並啓動我的應用程序,它會暫停音樂,播放我的聲音,但不會恢復背景音樂。使用AVAudioPlayer播放聲音後恢復背景音頻
下面是我在做什麼,產生的聲音回放:
myChime = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"chime" ofType:@"mp3"]] error:nil];
myChime.delegate = self;
[myChime play];
// Here I am looking to resume the audio that the system was playing before my application played its sound. I have seen many applications do this such as, GPS apps that speak a voice direction and then resume the music.
許多應用程序(如MotionX-GPS)將允許iPod播放背景音樂,直到出現配音,然後暫停音樂,播放「左轉」聲音並恢復iPod播放。我想知道一旦我的聲音完成播放後如何恢復以前的系統音頻播放。 – wasabi
我也面臨這個問題。你能否在這裏提供任何示例代碼?提前致謝。 – Gopinath
你能幫我解決這個問題嗎?我花了兩天時間呢?等待你的回覆。請參閱我的問題以供參考:http://stackoverflow.com/questions/12475034/how-to-stop-and-resume-background-audio-from-iphone-app – Gopinath