|
|
@@ -283,19 +283,33 @@ export default {
|
|
|
};
|
|
|
|
|
|
iiframe.contentWindow.ConversationTranscriber();
|
|
|
- setTimeout(()=>{
|
|
|
- navigator.permissions && navigator.permissions.query({ name: 'microphone' }).then(permissionStatus => {
|
|
|
- if (permissionStatus.state !== "granted") {
|
|
|
- // 没有开启录音权限,直接确定停止录音
|
|
|
- this.recordedForm.status = "0";
|
|
|
- let iframe = this.$refs["iiframe"];
|
|
|
- iframe.contentWindow.onSessionStopped = null;
|
|
|
- iframe.contentWindow.window.onRecognizedResult = null;
|
|
|
- this.$message.success(this.lang.ssNoPermStop);
|
|
|
- return;
|
|
|
+ // 优化录音权限检测和处理流程,防止多次触发和潜在异常
|
|
|
+ setTimeout(async () => {
|
|
|
+ try {
|
|
|
+ if (navigator.permissions) {
|
|
|
+ const permissionStatus = await navigator.permissions.query({ name: 'microphone' });
|
|
|
+ if (permissionStatus.state !== "granted") {
|
|
|
+ // 没有开启录音权限,直接确定停止录音
|
|
|
+ this.recordedForm.status = "0";
|
|
|
+ const iframe = this.$refs["iiframe"];
|
|
|
+ if (iframe && iframe.contentWindow) {
|
|
|
+ if (typeof iframe.contentWindow.onSessionStopped !== "undefined") {
|
|
|
+ iframe.contentWindow.onSessionStopped = null;
|
|
|
+ }
|
|
|
+ if (iframe.contentWindow.window && typeof iframe.contentWindow.window.onRecognizedResult !== "undefined") {
|
|
|
+ iframe.contentWindow.window.onRecognizedResult = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.$message && this.lang && this.lang.ssNoPermStop) {
|
|
|
+ this.$message.success(this.lang.ssNoPermStop);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('麦克风权限检测异常:', error);
|
|
|
}
|
|
|
- })
|
|
|
- },10000)
|
|
|
+ }, 10000);
|
|
|
|
|
|
},
|
|
|
async onFinishRecordWithMicrosoft() {
|