[英]iOS AVAudioRecorder record without stopping background audio
我需要允許我的應用在不停止背景音樂播放器的情況下錄制音頻。
我正在使用AVAudioRecorder。
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
但是,無論何時調用[audioplayer record],背景音樂都會停止播放。
我該怎么做才能使背景音樂不停止播放?
謝謝。
您還需要添加MixWithOthers類別選項:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:nil];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.