AVCaptureSession cancels background audio

后端 未结 3 738
失恋的感觉
失恋的感觉 2020-12-31 21:44

Whenever I start an AVCaptureSession running with the microphone as an input it cancels whatever background music is currently running (iPod music for instance). If I comme

3条回答
  •  臣服心动
    2020-12-31 22:27

    I had the same problem and used this in my app and it worked:

    UInt32 audioRouteOverride = kAudioSessionCategory_AmbientSound;
    AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,sizeof (audioRouteOverride),&audioRouteOverride);
    

    I was able to record video and audio and at the same time play a sound out of the speakers.

提交回复
热议问题