SanHQin 10 months ago
parent
commit
f358319807
1 changed files with 16 additions and 9 deletions
  1. 16 9
      src/components/pages/classroomObservation/components/chatArea.vue

+ 16 - 9
src/components/pages/classroomObservation/components/chatArea.vue

@@ -523,7 +523,7 @@ export default {
 				status: 0, //0--未录音  1--正在录音  2--暂停  3--录音结束
 				timer:null,
 				timeDuration:0,
-				audioBlob:null,
+				audioBlob:[],
 			},
 			roleList: [],
 			publicRoleList: [],
@@ -695,6 +695,11 @@ export default {
 				this.controlsStatus = 1;
 				this.recordedForm.status = 1;
 				this.$message.success("已开始录音");
+				this.recordedForm.timer = setInterval(()=>{
+					this.recordedForm.timeDuration+=1;
+					this.updateRecordedTime({duration:this.recordedForm.timeDuration})
+					console.log(this.recordedForm)
+				},1000)
 				let flag = true;
 				let textList = [];
 				this.recordedForm.timeDuration = 0;
@@ -713,11 +718,6 @@ export default {
 						this.transcriptionData.content = "";
 						this.editorBarData.content = "";
 						textList = [];
-						this.recordedForm.timer = setInterval(()=>{
-							this.recordedForm.timeDuration+=1;
-							this.updateRecordedTime({duration:this.recordedForm.timeDuration})
-							console.log(this.recordedForm)
-						},1000)
 					}
 					this.showGetTextLoading = true;
 					let privText = e.privText;
@@ -815,15 +815,19 @@ export default {
         "scenarioStopButton"
       ).click()
 			// 录音借宿
-			iiframe.contentWindow.sessionStopped = (s,e)=>{
+			iiframe.contentWindow.onSessionStopped = (s,e)=>{
 				this.recordedForm.status = 3;
 				this.controlsStatus = 2;
 				this.$message.success("已结束录音")
 				clearInterval(this.recordedForm.timer);
 				console.log("结束录音👇")
 				console.log("结束录音",e);
-				this.recordedForm.audioBlob = e.preaudio;
-				this.uploadFile(this.recordedForm.audioBlob,{changeText:false,flag:true})
+				this.recordedForm.audioBlob.push(e.preaudio);
+				let blob = new Blob(this.recordedForm.audioBlob,{
+					type: 'audio/mp3',
+				})
+				this.uploadFile(blob,{changeText:false,flag:true})
+				iiframe.contentWindow.onSessionStopped = null;
 			}
 			
 			// this.uploadFileLoading = true;
@@ -1332,6 +1336,9 @@ export default {
 								if(changeText)_this.wavFileGetText(file);
 								_this.$emit("changeAudioUrl", data);
 								_this.loading = false;
+								_this.recordedForm.audioBlob = [];
+								_this.recordedForm.time = "00:00:00"
+								_this.recordedForm.timeDuration = 0;
 								_this.progressData.uploadLoading = false;
 								return;
 							}