Record Video and play audio at same time ios
Couple thing you can try:
1) Play audio on the background queue:
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0)) { self.player.play()}
2) Move the code you have in viewDidAppear
(including prepareToPlay()
) to viewDidLoad
. I assume this will be a less helpful suggestions since playing is user-initiated but there is a delay between prepareToPlay()
and when your audio is ready.
If you try these and the delay is still too much, you simply might have to use something other than AVAudioPlayer
, such as OpenAL
.