I have an application that plays back recorded sound, as well as repeating sounds. Sounds are played correctly through the built-in iPad speaker, and if I connect the cord from the headphone jack to the stereo input, it also plays well. When I connect my iPad to my bluetooth stereo input, all sounds from my other applications (written for iPhone, running on my iPad) work just fine, like all other sounds from my device.
The problem is that my application written for the iPad does not play along the Bluetooth path, but instead plays from the built-in speakers.
In my applet in the didFinishLaunchingWithOptions (...) method, I posted the following:
NSError *error = nil; [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeDefault error:&error]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; [[AVAudioSession sharedInstance] setActive:YES error:&error];
This code is called and no errors are returned.
In my controller code, I recorded samples that I play using AVAudioPlayer as follows:
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:recordURL error:&error]; audioPlayer.numberOfLoops = 0; [audioPlayer setDelegate:self]; [audioPlayer play];
In other areas, I have drones that play short sounds .01 seconds, repeating in a stream controlled circuit, and I do this with OpenAL:
alSourcePlay(sourceID);
This is the same code that I have in other applications written for the iPhone, which works as desired.
I understand that there are other topics related to the bluetooth input, but I have a certain problem with the output of the Bluetooth audio signals from my iPad application.
ios objective-c ipad avaudioplayer avaudiosession
Cal30
source share