1

'I have programmed a camera to record video. And, in order to "capture" the data output for the video to have sound, I use the following code to set the audio.

AVAudioSession.sharedInstance().requestRecordPermission { (granted: Bool) -> Void in
            if granted {
                let audioCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeAudio)
                do {
                    let audioInput = try AVCaptureDeviceInput(device: audioCaptureDevice)
                    self.session?.addInput(audioInput)
                } catch {
                }
            }
        }

The problem is that I would like to play music via a bluetooth speaker at the same time that the video is recording. I have discovered that the above code causes music to only play from the device's speakers and not from a connected Bluetooth device.

I have reviewed a lot of stack overflow posts on this topic, however I have yet to find a satisfactory solution to my problem. How can I record video using the device's camera and mic while allowing to play music from a connected bluetooth speaker using Swift 2 programming?

1 Answer 1

0

I've been dealing with this same problem since May 2014.

I made this question here: Keep bluetooth sound when initializing AVAudioSession and also tried opening a paid support ticket with Apple that you can see their response as an answer on that question. But here it is for reference as well:

There is no supported way to achieve the desired functionality given the currently shipping system configurations. If you would like for Apple to consider adding support for such features in the future, please submit an enhancement request via the Bug Reporter tool at http://bugreport.apple.com.

So since there was no supported way, I made a proper feature request on their bug reporting system, which they never replied to me, until this week, when they said:

This is an older report and much has changed since it was filed. We are closing it. If this is still an issue for you, or if you have questions regarding the resolution of this issue, please update your bug report with them.

So, I checked with the latest iOS versions, betas, etc. Still the same.

So unless I'm missing something new, unfortunately the answer is: "We can't record and play through BlueTooth at the same time"

Hopefully you'll post your findings if you ever find a way to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.