|
@@ -148,6 +148,7 @@ export default {
|
|
|
startRecorder() {
|
|
|
let _this = this;
|
|
|
if (!_this.isRecord) {
|
|
|
+
|
|
|
recorder.destroy(); // 销毁录音
|
|
|
_this.isRecord = true;
|
|
|
recorder.start().then(
|
|
@@ -162,6 +163,7 @@ export default {
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
+
|
|
|
_this.isRecord = false;
|
|
|
recorder.stop(); // 结束录音
|
|
|
this.getMp3Data()
|
|
@@ -222,14 +224,29 @@ export default {
|
|
|
let iiframe = this.$refs['iiframe']
|
|
|
// iiframe.contentWindow.doPronunciationAssessmentOnceAsync('', { files: [audioFile] })
|
|
|
let _this = this
|
|
|
- window.onRecognizedResult = function (e) {
|
|
|
- console.log('onRecognizedResult', e);
|
|
|
- let privText = e.privText
|
|
|
- // e.privText
|
|
|
- // JSON.parse(e.privJson).NBest[0].PronunciationAssessment
|
|
|
+ let _result = '';
|
|
|
+ // window.onRecognizedResult = function (e) {
|
|
|
+ // console.log('onRecognizedResult', e);
|
|
|
+ // let privText = e.privText
|
|
|
+ // // e.privText
|
|
|
+ // // JSON.parse(e.privJson).NBest[0].PronunciationAssessment
|
|
|
+ // _this.beforeUpload1(audioFile, 3, _result);
|
|
|
+ // }
|
|
|
+
|
|
|
+ iiframe.contentWindow.onRecognizedResult = function(e){
|
|
|
+ console.log("转译中")
|
|
|
+ console.log(e)
|
|
|
+ let privText = e.privText;
|
|
|
+ console.log(privText)
|
|
|
+ _result += privText;
|
|
|
+ }
|
|
|
+
|
|
|
+ iiframe.contentWindow.onSessionStopped = function(e){
|
|
|
+ console.log("转译完成")
|
|
|
+ console.log(e)
|
|
|
+ _this.beforeUpload1(audioFile, 3, _result);
|
|
|
+ }
|
|
|
|
|
|
- _this.beforeUpload1(audioFile, 3, privText);
|
|
|
- }
|
|
|
iiframe.contentWindow.doContinuousPronunciationAssessment('', { files: [audioFile] })
|
|
|
|
|
|
_this.isloading = true
|