Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ISSUE-016

腾讯游戏麦克风权限问题

常见表现

已授予麦克风权限,但游戏依旧提示没有权限。

相关源码

libGCloudVoice.a CProcessingGraph.o

bool ApolloTVE::CProcessingGraph::IsMicEnable() {
    bool bRet;
    if (this->m_bM1Process) { // Mac
         int64_t TimeMs = GetTimeMs();
         bool bWait = true;
         while (bWait) {
             if (GetTimeMs() - TimeMs > 100) {
                 bWait = false;
             }
             [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
                   bRet = granted;
                   bWait = false;
             }];
         }
    }
    else {
        [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
             bRet = granted;
        }];
    }
    return bRet;
}

原因分析

语音SDK在查询麦克风权限时,期望游戏处于暂停状态,并在暂停状态结束后立即获得查询结果。

但是通过PlayCover运行的游戏,查询麦克风权限时并不会被暂停,而是处于完全异步的状态。

解决方法

使用PlayCover Nightly版,右键游戏图标 - 设置 - 绕过设置,启用“checkMicPermissionSync”选项。