I'm trying to add an audio input to my AVCaptureSession()
and it works great. However I would also like to support users who wish to play music in the background from other apps such as Spotify and maintain this audioInput for my recording. How is this possible?
let captureSession = AVCaptureSession()
let audioDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeAudio)
audioInput = AVCaptureDeviceInput.deviceInputWithDevice(audioDevice, error:&err) as? AVCaptureDeviceInput
if captureSession.canAddInput(videoCapture) {
captureSession.addInput(videoCapture)
// This line Kills spotify playing in the background
captureSession.addInput(audioInput as AVCaptureInput)
}