播放声音时不会停止录制Avcapture

时间:2012-02-14 15:01:22

标签: ios avaudioplayer avcapture

我有一个视频记录,那我有一段AVAudioPlayer,问题是当声音,你停止registazione视频。

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];``

提前致谢

1 个答案:

答案 0 :(得分:0)

解决方案创建AVaudiosession到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);