0

I have a view where a video record, then I have a section AVAudioPlayer, the problem is that when the sound, you stop registazione Video.

testAudioPlayer = [[AVAudioPlayer alloc] initWithData:sampleData error:&audioError];
[sampleData release];

if(audioError != nil) {
    NSLog(@"An audio error occurred: \"%@\"", audioError);
}
else {
    [testAudioPlayer setVolume:100];
    [testAudioPlayer setNumberOfLoops: -1];
    [testAudioPlayer play];``

thanks in advance

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
  • 2
    i search this from another post but i don't know where remove code please help me!!I figured it out: I just had to remove some code within AVCam that allocated AVCaptureDeviceInput - audioInput. That was unnecessary and conflicted with my audio playback code – user1178728 Feb 14 '12 at 18:59

1 Answers1

0

The Solution create AVaudiosession to viewdidload

NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory:     AVAudioSessionCategoryPlayAndRecord error: &setCategoryError]; 

if (setCategoryError) { NSLog(@"%@",[setCategoryError description]); }

OSStatus propertySetError = 0;
UInt32 allowMixing = true;

propertySetError = AudioSessionSetProperty ( kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof (allowMixing), &allowMixing); 
WrightsCS
  • 50,551
  • 22
  • 134
  • 186