I answered my own problem in the unlikely case someone else has a similar setup. The audio session doesn't seem to like bluetooth when plugged into an output that is attached to a buffer that hasn't yet filled. That was my understanding at least. Because of that, the session needed to be setup as the very last thing, once the output has some audio data coming through. My solution was to listen for data on the audio player and once it was filled, setup the audio session. It looked like this:
print("Starting Tap")
audioPlayerNode?.installTap(onBus: 0, bufferSize: 64, format: nil) { (buffer, time) in
if buffer.frameLength > 0 {
self.setupAudioSession()
self.printCurrentAudioSessionState()
self.audioPlayerNode?.removeTap(onBus: 0)
print("Tap Stopped")
}
}
Maybe that will help someone. The audio session setup remained the same.
Post
Replies
Boosts
Views
Activity
Wondering if you found any temporary workaround for this?