Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to record the voice from Bluetooth headset and play on iPhone speaker simultaneously?
    primarykey
    data
    text
    <p>I am making an app that requires recording the voice coming from a Bluetooth headset and playing it on the iPhone speaker (not on Bluetooth headset speaker). I tried:</p> <pre><code>AVAudioSession* audioSession = [AVAudioSession sharedInstance]; [audioSession setDelegate:self]; [audioSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil]; [audioSession setActive: YES error: nil]; // set up for bluetooth microphone input UInt32 allowBluetoothInput = 1; AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,sizeof (allowBluetoothInput),&amp;allowBluetoothInput); // problem if this is not zero // check the audio route UInt32 size = sizeof(CFStringRef); CFStringRef route; OSStatus result = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &amp;size, &amp;route); NSLog(@"route = %@", route); </code></pre> <p>After that I want to play the music file to iPhone speaker, and I used the code:</p> <pre><code>- (IBAction)playAudio:(id)sender { [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &amp;audioRouteOverride); UInt32 size = sizeof(CFStringRef); CFStringRef route; OSStatus result = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &amp;size, &amp;route); NSLog(@"route = %@", route); // NSLog(@"route = %@", route); //[self playAudiokam]; if (!_audioRecorder.recording) { NSError *error; _audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:_audioRecorder.url error:&amp;error]; _audioPlayer.delegate = self; if (error) NSLog(@"Error: %@", [error localizedDescription]); else [_audioPlayer play]; } } </code></pre> <p>Here my code is working, but not <em>simultaneously</em>. Apps require speaker continue playing music and recording the voice from Bluetooth headset.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload