首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >基于iOS模式的MPVolumeView中断

基于iOS模式的MPVolumeView中断
EN

Stack Overflow用户
提问于 2015-12-17 23:29:14
回答 1查看 816关注 0票数 2

我正在开发一个VoIP应用程序,该应用程序使用MPVolumeView来允许用户调整系统音量。在iOS 9.1发布之前,这一切都很好,很棒。然后,我发现如果我将AVAudioSession模式设置为AVAudioSessionModeVoiceChatMPVolumeView滑块就会崩溃。(即滑块不再调整系统音量。)如果我将模式改为AvAudioSessionModeDefaultMPVolumeView就会像预期的那样工作,但麦克风会记录来自iPad扬声器的音频。(换句话说,语音处理被关闭了--我需要VoIP调用。)在iOS 9.1之前,我可以将AudioSession模式设置为AVAudioSessionModeDefault,然后在AudioComponentDescription中将componentSubType设置为kAudioUnitSubType_VoiceProcessingIO,一切正常。不幸的是,情况似乎已不再如此。有没有人知道如何保持语音处理,并让MPVolumeView工作岗位iOS 9.1?

下面是我设置AVAudioSession的代码:

代码语言:javascript
运行
复制
    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

    // Make sure the session on this thread matches.
    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth error:nil];

    // Here is the main connundrum: I want to set AVAudioSessionModeDefault so that the MPVolumeView will work,
    // but when I do that the mic picks up the audio from the speaker and plays it back creating an unwanted feeback loop.
    // If I set the mode to AVAudioSessionModeVoiceChat the voice processing (primarily the AEC) fixes the feeback loop,
    // but then the MPVolumeView no longers works.  (It no longer adjusts the system volume.
    //Question: How can I have BOTH the voice processing AND the MPVolumeView adjust the system volume?
    if(!appDelegate.viewController.voiceChatMode)
        [audioSession setMode:AVAudioSessionModeDefault error:nil];
    else
        [audioSession setMode:AVAudioSessionModeVoiceChat error:nil];

    [audioSession setPreferredIOBufferDuration:0.005 error:nil];
    [audioSession setActive:YES error:nil];
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-06 23:26:19

在与苹果的技术支持部门交谈后,他们直截了当地回答:

根据核心音频工程,与MPVolumeView不再调整系统的音量问题是一个已知的问题(r. 17292753),目前登录在我们的错误数据库。

恐怕我不知道怎么解决这个问题。否则,关于VoIP支持,建议聊天应用程序没有音量滑块,而是依靠手机的音量按钮。

所以你就有了。希望他们很快就能修好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34346209

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档