AudioServicesPlaySystemSound nonfunctional with AVCaptureSession audio device

Originator:aaronvegh
Number:rdar://10292971 Date Originated:15-Oct-2011 09:51 PM
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
Under iOS 5, when using an AudioServicesPlaySystemSound call, it will not work when there is an active AVCaptureSession with an audio device active. 

Steps to Reproduce:

1. Create an AudioServicesPlaySystemSound call. In my class's init method, setup the sound:

NSURL *pipSound   = [[NSBundle mainBundle] URLForResource: @"pip"
                                                withExtension: @"wav"];
    
 // Store the URL as a CFURLRef instance
 self.soundFileURLRef = (__bridge_retained CFURLRef) pipSound;
  
 // Create a system sound object representing the sound file.
 AudioServicesCreateSystemSoundID ( soundFileURLRef, &soundFileObject );

Then in the action method, play the sound:

AudioServicesPlaySystemSound (soundFileObject);


2. Create an AVCaptureSession, adding an audioDevice:

AVCaptureDeviceInput *newAudioInput = [[AVCaptureDeviceInput alloc] initWithDevice:[self audioDevice] error:nil];
AVCaptureSession *newCaptureSession = [[AVCaptureSession alloc] init];
[newCaptureSession addInput:newAudioInput];

3. Activate the method that plays the sound.


Expected Results:
The AudioServicesPlaySystemSound should go off.

Actual Results:
It doesn't go off.

Regression:
Works as expected under iOS4.3 and earlier. To demonstrate, comment out the [newCaptureSession addInput:newAudioInput]; call -- the sound will play just fine.


Notes:
Love you guys. Keep up the good work.

Comments

Reproducible in iOS 5

I am seeing this problem too and can confirm it's an issue in iOS 5. It's preventing me from setting audio sounds for start/end of video capture. :(

By daniel.raffel at March 9, 2012, 7:46 p.m. (reply...)

I am experiencing exact the same issue.

This was working before iOS 5 as the OP mentioned but is broken in iOS 5.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!