2012-03-01 37 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