Avoid calling startRecording and stopRecording when not needed.