2012-03-01 65 views
0

我正在使用兩個一起玩的AVAudioPlayer對象。當發生中斷時,我暫停兩個對象,當中斷結束時,我播放兩個AVAudioPlayer對象,但奇怪的是,第一個播放但另一個不播放。如果我先玩第二個玩家,那麼第二個玩家會玩,但第一個玩家不會玩。有人可以幫我嗎?中斷結束後恢復兩個AVAudioPlayer

回答

0
//This isn't a solution, but should work fine in case you need to want like this !! 

//While resuming your first AVAudioPlayer object 
NSTimer *timer=[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(playSecondObject) userInfo:nil repeats:NO]; 

[AVAudioPlayerObject1 play] //from pause 

}

- (void) playSecondObject 
{ 
[AVAudioPlayerObject2 play]; 
//The timer will fire and call this method and can play second object, 
the time difference can be checked by you to set the exact that what you want? 
} 

//Hope this helps 
+0

試過,但不起作用。奇怪的是我正在使用mp3音頻格式,如果我使用caf格式,那麼它是最好的,並且即使沒有定時器也會播放。但咖啡館的規模太大,我無法應對。 :( – necixy 2012-03-02 06:18:56