处理语音模块麦克风占用问题,现在在非录音状态下不会一直占用麦克风
Some checks failed
Check / lint (push) Has been cancelled
Check / typecheck (push) Has been cancelled
Check / build (build, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:app, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:app, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Has been cancelled

This commit is contained in:
wangyifeng 2025-07-02 13:57:08 +08:00
parent 82e14bb969
commit d76ec030e6

View File

@ -313,7 +313,7 @@ export default {
let that = this let that = this
// //
that.checkPermission(true) that.checkPermission()
// #ifdef APP-PLUS // #ifdef APP-PLUS
recorderManager.onStop((res) => { recorderManager.onStop((res) => {
@ -393,7 +393,7 @@ export default {
that.permissionInfo = permissionInfo that.permissionInfo = permissionInfo
} }
}, },
continueAppMicro(isFirstRequestPer = false) { continueAppMicro() {
let that = this let that = this
RecordApp.UniWebViewActivate(that) //AppWebView RecordApp.UniWebViewActivate(that) //AppWebView
RecordApp.RequestPermission( RecordApp.RequestPermission(
@ -401,9 +401,7 @@ export default {
console.log('已获得录音权限,可以开始录音了') console.log('已获得录音权限,可以开始录音了')
that.permisionState = true that.permisionState = true
that.isCheckingPermission = false that.isCheckingPermission = false
if (isFirstRequestPer) { that.stopRecord()
that.stopRecord()
}
}, },
(msg, isUserNotAllow) => { (msg, isUserNotAllow) => {
that.isCheckingPermission = false that.isCheckingPermission = false
@ -415,7 +413,7 @@ export default {
}, },
) )
}, },
async checkPermission(isFirstRequestPer = false) { async checkPermission() {
let that = this let that = this
// #ifdef APP-PLUS // #ifdef APP-PLUS
// os // os
@ -455,7 +453,7 @@ export default {
if (typeof plus !== 'undefined') { if (typeof plus !== 'undefined') {
handleFindWebview(`handleRequestAndroidPermission('micro')`) handleFindWebview(`handleRequestAndroidPermission('micro')`)
} else { } else {
that.continueAppMicro(isFirstRequestPer) that.continueAppMicro()
} }
// #endif // #endif
// #endif // #endif