|
|
@@ -174,6 +174,16 @@ export default {
|
|
|
this.onStartRecordWithMicrosoft();
|
|
|
},
|
|
|
toggleRecording() {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
if (this.recordedForm.status == 1) {
|
|
|
// 检查录音时间是否至少为5秒
|
|
|
const now = new Date();
|
|
|
@@ -208,6 +218,7 @@ export default {
|
|
|
}
|
|
|
this.onStartRecordWithMicrosoft();
|
|
|
}
|
|
|
+ })
|
|
|
},
|
|
|
// ============ start 微软录音转译
|
|
|
onStartRecordWithMicrosoft() {
|
|
|
@@ -272,6 +283,18 @@ 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;
|
|
|
+ }
|
|
|
+ }),10000)
|
|
|
+
|
|
|
},
|
|
|
async onFinishRecordWithMicrosoft() {
|
|
|
if (this.recordedForm.status == 1) {
|
|
|
@@ -642,11 +665,11 @@ export default {
|
|
|
input.onchange = (e) => {
|
|
|
const fileList = e.target.files;
|
|
|
const file = fileList[0]
|
|
|
- this.recordingStartTime = new Date().toLocaleString("zh-CN", {
|
|
|
+ this.recordingStartTime = new Date(window.recordingStartTime?window.recordingStartTime:new Date()).toLocaleString("zh-CN", {
|
|
|
hour12: false,
|
|
|
timeZone: "Asia/Shanghai"
|
|
|
}).replace(/\//g, "-");
|
|
|
- this.recordingEndTime = new Date().toLocaleString("zh-CN", {
|
|
|
+ this.recordingEndTime = new Date(window.recordingEndTime?window.recordingEndTime:new Date()).toLocaleString("zh-CN", {
|
|
|
hour12: false,
|
|
|
timeZone: "Asia/Shanghai"
|
|
|
}).replace(/\//g, "-");
|