Check if avSession.category is already set to "AVAudioSessionCategoryPlayAndRecord" before recording, so as not to override it with "AVAudioSessionCategoryRecord". This way, applications that require to play media and record audio simultaneously, may do so in a straightforward manner; i.e. set the AVAudioSessionCategory to "AVAudioSessionCategoryPlayAndRecord", and then just play the media and start recording.