Skip to content

Commit

Permalink
Fix getting microphone permission for HarmonyOS VAD+ASR example (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Nov 30, 2024
1 parent c9d3b6c commit a3d6e1a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ struct Index {
const permissions: Permissions[] = ["ohos.permission.MICROPHONE"];
let allowed: boolean = await allAllowed(permissions);
if (!allowed) {
requestPermissions(permissions);
console.log("request to access the microphone");
const status: boolean = await requestPermissions(permissions);

if (!status) {
console.error('access to microphone is denied')
this.resultForMic = "Failed to get microphone permission. Please retry";
return;
}

allowed = await allAllowed(permissions);
if (!allowed) {
Expand Down

0 comments on commit a3d6e1a

Please sign in to comment.