问题
I record audio/video with AVFoundation using AVCaptureVideoDataOutput and AVCaptureAudioDataOutput. But when I add my AVCaptureAudioDataOutput to my AVCaptureSession, AVFoundation stop background music (in my case from iPod app).
So I'm looking for a solution to let my music playing during my record ?
Thanks,
Alak
ps: I'm targeting iOS8 and I user Swift 2.0
回答1:
    do {
      try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: [AVAudioSessionCategoryOptions.MixWithOthers, AVAudioSessionCategoryOptions.DefaultToSpeaker])
      try AVAudioSession.sharedInstance().setActive(true)
    } catch {
      print("error")
    }
    captureSession = AVCaptureSession()
    来源:https://stackoverflow.com/questions/32480732/avcapturesession-avcaptureaudiodataoutput-and-background-music