HarmonyOS 多次调用createAudioCapturer报 failed, code is 6800301, message is system error

HarmonyOS 多次调用createAudioCapturer报 failed, code is 6800301, message is system error。

HarmonyOS
2024-11-12 10:41:59
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
FengTianYa

​确认一下权限是否加上。

EntryAbility.ets​

onWindowStageCreate(windowStage: window.WindowStage) { 
  // Main window is created, set main page for this ability 
  hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); 
  let atManager = abilityAccessCtrl.createAtManager(); 
  atManager.requestPermissionsFromUser(this.context, ['ohos.permission.MICROPHONE']).then((data) => { 
    console.info('data:' + JSON.stringify(data)); 
    console.info('data permissions:' + data.permissions); 
    console.info('data authResults:' + data.authResults); 
  }).catch((err) => { 
    console.info('data:' + JSON.stringify(err)); 
  }); 
  windowStage.loadContent('pages/Index', (err, data) => { 
    if (err.code) { 
      hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); 
      return; 
    } 
    hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); 
  });
分享
微博
QQ
微信
回复
2024-11-12 17:05:13
相关问题
冷启动报错Error message
2114浏览 • 1回复 待解决